There will likely be several of these kinds of changes as I continue to implement functionality in controller and test it against my system.
item console
boot:
- start boot filesystem require
- start boot modules require
+ start boot root require
+ start boot proc asynchronous require
+ start boot dev asynchronous require
+ start boot filesystem asynchronous
+ start boot modules wait
- start service logger wait
+ start service logger
start service dbus asynchronous
ready
start task keyboard asynchronous
console:
+ start service mouse asynchronous
start program terminal require wait
- start service mouse
maintenance:
- execute bash --login
+ execute /bin/bash --login
start environment default
start environment exported
start environment empty
+ start environment exporting
--- /dev/null
+# fss-000d
+#
+# Rule for a long delay.
+#
+
+setting:
+ name "Delay for 3 minutes."
+
+script:
+ start sleep 3m
--- /dev/null
+# fss-000d
+#
+# Rule for a short delay.
+#
+
+setting:
+ name "Delay for 3 seconds."
+
+script:
+ start sleep 3s
--- /dev/null
+# fss-000d
+
+setting:
+ name "Environment with PATH"
+ environment PATH custom_variable
+ script bash
+
+script:
+ start {
+ echo
+ echo "================================="
+ echo "Exported Environment is isolated."
+ echo "================================="
+
+ export custom_variable="is not retained"
+ echo "export custom_variable='$custom_variable'"
+ echo
+ echo "Now for 'env' command:"
+ }
+
+command:
+ start env
--- /dev/null
+# fss-000d
+#
+# Rule for initializing the /dev filesystem.
+#
+
+setting:
+ name "Setup /dev filesystem"
+
+ on start need boot root
+
+command:
+ start mount /dev
+
+script:
+ start {
+ if [[ ! -d /dev/pts ]] ; then
+ mkdir /dev/pts
+ fi
+
+ if [[ ! -d /dev/shm ]] ; then
+ mkdir /dev/shm
+ fi
+
+ exit 0
+ }
+
+command:
+ start mount /dev/pts
+ stop umount -l /dev/pts
+
+command:
+ start mount /dev/shm
+ stop umount -l /dev/shm
setting:
name "Setup Filesystem"
+ on start need boot root
+ on start need boot proc
+ on start need boot devices
+
+ on stop need boot proc
+ on stop need boot devices
+
command:
- start mount -a -O no_netdev
- stop umount -arf -O no_netdev
+ start mount -n -a -O no_netdev
+ stop umount -n -arf -O no_netdev
command:
start swapon -a
setting:
name "Setup Kernel Modules"
- on start need boot filesystem
+ on start need boot root
+ on start need boot proc
+ on start want boot filesystem
script:
start {
if [[ ! -f /proc/modules ]] ; then
- exit 0;
+ exit 0
fi
- if [[ ! -e /lib/modules/$(uname -r)/modules.dep ]] ; then
- depmod;
+ if [[ -d /modules ]] ; then
+ if [[ ! -e /modules/$(uname -r)/modules.dep ]] ; then
+ depmod
+ else
+ depmod -A
+ fi
fi
- return 0;
+ exit 0
}
--- /dev/null
+# fss-000d
+#
+# Rule for initializing the /proc filesystem.
+#
+
+setting:
+ name "Setup /proc Filesystem"
+
+ on start need boot root
+
+command:
+ start mount /proc
+
+script:
+ start {
+ if [[ -d /proc/bus/usb ]] ; then
+ mount /proc/bus/usb
+ fi
+
+ exit 0
+ }
+
+ stop {
+ if [[ -d /proc/bus/usb ]] ; then
+ umount -l /proc/bus/usb
+ fi
+
+ exit 0
+ }
--- /dev/null
+# fss-000d
+#
+# Rule for initializing the root filesystem, assuring certain directories always exist.
+#
+
+setting:
+ name "Setup Root Filesystem"
+
+command:
+ start mount -o remount,rw /
+
+script:
+ start {
+ if [[ ! -d /dev ]] ; then
+ mkdir /dev
+ fi
+
+ if [[ ! -d /dev/pts ]] ; then
+ mkdir /dev/pts
+ fi
+
+ if [[ ! -d /dev/shm ]] ; then
+ mkdir /dev/shm
+ fi
+
+ if [[ ! -d /firmware ]] ; then
+ mkdir /firmware
+ fi
+
+ if [[ ! -d /mnt ]] ; then
+ mkdir /mnt
+ fi
+
+ if [[ ! -d /modules ]] ; then
+ mkdir /modules
+ fi
+
+ if [[ ! -d /proc ]] ; then
+ mkdir /proc
+ fi
+
+ if [[ ! -d /sys ]] ; then
+ mkdir /sys
+ fi
+
+ if [[ ! -d /tmp ]] ; then
+ mkdir /tmp
+ fi
+
+ if [[ ! -d /var ]] ; then
+ mkdir /var
+ fi
+
+ if [[ ! -d /var/log ]] ; then
+ mkdir /var/log
+ fi
+
+ if [[ ! -d /var/run ]] ; then
+ mkdir /var/run
+ fi
+
+ if [[ ! -d /var/tmp ]] ; then
+ mkdir /var/tmp
+ fi
+
+ exit 0
+ }
setting:
name "System Network"
+ capability cap_net_admin=
command:
start network start
script:
start {
- ip addr add 127.0.0.1/8 label lo dev lo;
- ip link set lo up;
+ ip addr add 127.0.0.1/8 label lo dev lo
+ ip link set lo up
}
stop {
- ip link set lo down;
+ ip link set lo down
}
# -m = don't prompt for login.
setting:
- name "System Terminal"
- capability "all="
+ name "System Terminals"
command:
- #pid_file /var/run/tty/tty1.pid
-
- start agetty -8 9600 tty1 linux
-
-command:
- #pid_file /var/run/tty/tty2.pid
-
start agetty -8 9600 tty2 linux
command:
- #pid_file /var/run/tty/tty3.pid
-
start agetty -8 9600 tty3 linux
command:
- #pid_file /var/run/tty/tty4.pid
-
start agetty -8 9600 tty4 linux
+
+# Wait for things to complete before opening the terminal on tty1.
+command:
+ start sleep 3s
+
+command:
+ start agetty -8 9600 tty1 linux
setting:
name "D-BUS"
- capability "all="
+ capability all=
nice 15
service:
setting:
name "System Logger"
- capability "all="
+ capability all=
nice 19
scheduler idle
setting:
name "Console Mouse"
- capability "all="
+ capability all=
nice 15
- # @todo consider adding iki support.
-
script:
start {
- # @todo read settings from /etc/mouse, and replace below.
+ # This works if gpm service is run as root, but if not then this should be in a separate rule file with appropriate access to write to /var/run (don't forget to chown!).
+ if [[ ! -d /var/run/mouse/ && -d /var/run ]] ; then
+ mkdir /var/run/mouse/
+ fi
}
service:
pid_file /var/run/mouse/mouse.pid
+ # @todo consider a new type, such as "variable" than can be used to get the variable and store it in an iki parseable variable.
+ # This, however, may be too complicated than desirable (in terms of passing output back to the parent process).
+ # such as:
+ #variable device command fss_basic_read -can 0 device /etc/mouse
+ #variable protocal script {
+ # fss_basic_read -can 0 device /etc/mouse
+ #}
+ #variable options set ""
+
# @todo
- start gpm -m [device] -t [protocol] [options]
+ start gpm -m variable:"device" -t variable:"protocol" variable:"options"
setting:
name "Setup Clock"
- capability "all="
+ capability cap_sys_time=
nice 15
+ on start want boot filesystem
+ on start want net all
+
script:
start {
+ clock_file=/etc/clock
clock_mode=
+ clock_server=
+ clock_ntpdate=
- if [[ -f /etc/clock ]] ; then
- clock_mode=$(fss_basic_read -c 0 -n mode /etc/clock);
+ if [[ -f $clock_file ]] ; then
+ clock_mode=$(fss_basic_read -can 0 mode $clock_file);
+ clock_server=$(fss_basic_read -can 0 server $clock_file)
+ clock_ntpdate=$(fss_basic_read -can 0 ntpdate $clock_file)
fi
if [[ $clock_mode == "local" ]] ; then
hwclock --hctosys;
- elif [[ $clock_mode == "ntpdate" ]] ; then
- ntpdate $(fss_basic_read -c 0 -n server /etc/clock) &&
- hwclock --systohc --utc
elif [[ $clock_mode == "ntp" ]] ; then
- if [[ $(fss_basic_read -c 0 -n ntpdate /etc/clock) == "yes" ]] ; then
- ntpdate $(fss_basic_read -c 0 -n server /etc/clock) &&
+ if [[ $clock_ntpdate == "yes" ]] ; then
+ ntpdate $clock_server &&
hwclock --systohc --utc
fi
+ elif [[ $clock_mode == "ntpdate" && $clock_host != "" ]] ; then
+ ntpdate $clock_server
elif [[ $clock_mode == "utc" ]] ; then
hwclock --hctosys --utc;
fi
setting:
name "System Keyboard"
- capability "all="
nice 15
--- /dev/null
+# fss-000d
+#
+# Rule for executing ntpdate.
+#
+
+setting:
+ name "System Clock Using NTP Date"
+ capability cap_sys_time=
+ nice 15
+
+ on start want boot filesystem
+ on start need net all
+
+script:
+ start {
+ clock_file=/etc/clock
+ clock_mode=
+ clock_server=
+
+ if [[ -f $clock_file ]] ; then
+ clock_mode=$(fss_basic_read -can 0 mode $clock_file);
+ clock_server=$(fss_basic_read -can 0 server $clock_file)
+ fi
+
+ if [[ $clock_mode == "ntpdate" && $clock_host != "" ]] ; then
+ ntpdate $clock_server
+ fi
+ }