]> Kevux Git Server - fll/commitdiff
Update: Configuration settings changes.
authorKevin Day <thekevinday@gmail.com>
Sat, 2 Oct 2021 05:17:26 +0000 (00:17 -0500)
committerKevin Day <thekevinday@gmail.com>
Sat, 2 Oct 2021 05:17:26 +0000 (00:17 -0500)
There will likely be several of these kinds of changes as I continue to implement functionality in controller and test it against my system.

19 files changed:
level_3/controller/data/settings/entries/default.entry
level_3/controller/data/settings/example/entries/environment.entry
level_3/controller/data/settings/example/rules/delay/long.rule [new file with mode: 0644]
level_3/controller/data/settings/example/rules/delay/short.rule [new file with mode: 0644]
level_3/controller/data/settings/example/rules/environment/exporting.rule [new file with mode: 0644]
level_3/controller/data/settings/rules/boot/devices.rule [new file with mode: 0644]
level_3/controller/data/settings/rules/boot/filesystem.rule
level_3/controller/data/settings/rules/boot/modules.rule
level_3/controller/data/settings/rules/boot/proc.rule [new file with mode: 0644]
level_3/controller/data/settings/rules/boot/root.rule [new file with mode: 0644]
level_3/controller/data/settings/rules/net/all.rule
level_3/controller/data/settings/rules/net/loopback.rule
level_3/controller/data/settings/rules/program/terminal.rule
level_3/controller/data/settings/rules/service/dbus.rule
level_3/controller/data/settings/rules/service/logger.rule
level_3/controller/data/settings/rules/service/mouse.rule
level_3/controller/data/settings/rules/task/clock.rule
level_3/controller/data/settings/rules/task/keyboard.rule
level_3/controller/data/settings/rules/task/ntpdate.rule [new file with mode: 0644]

index ad102ec4bffc6c6cba099c9419fa6b059dd932fc..f0e1189791b1e738e84d6bf560ffa2d3bd52d50b 100644 (file)
@@ -17,10 +17,13 @@ main:
   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
@@ -35,8 +38,8 @@ keyboard:
   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
index f09fea40d16095213ea76ec1e8a92e3a59c27815..137031c75e4cd8d65271fc77da1b24c7b8e19219 100644 (file)
@@ -4,3 +4,4 @@ main:
   start environment default
   start environment exported
   start environment empty
+  start environment exporting
diff --git a/level_3/controller/data/settings/example/rules/delay/long.rule b/level_3/controller/data/settings/example/rules/delay/long.rule
new file mode 100644 (file)
index 0000000..e9557a6
--- /dev/null
@@ -0,0 +1,10 @@
+# fss-000d
+#
+# Rule for a long delay.
+#
+
+setting:
+  name "Delay for 3 minutes."
+
+script:
+  start sleep 3m
diff --git a/level_3/controller/data/settings/example/rules/delay/short.rule b/level_3/controller/data/settings/example/rules/delay/short.rule
new file mode 100644 (file)
index 0000000..f014a22
--- /dev/null
@@ -0,0 +1,10 @@
+# fss-000d
+#
+# Rule for a short delay.
+#
+
+setting:
+  name "Delay for 3 seconds."
+
+script:
+  start sleep 3s
diff --git a/level_3/controller/data/settings/example/rules/environment/exporting.rule b/level_3/controller/data/settings/example/rules/environment/exporting.rule
new file mode 100644 (file)
index 0000000..4353948
--- /dev/null
@@ -0,0 +1,22 @@
+# 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
diff --git a/level_3/controller/data/settings/rules/boot/devices.rule b/level_3/controller/data/settings/rules/boot/devices.rule
new file mode 100644 (file)
index 0000000..6dee78a
--- /dev/null
@@ -0,0 +1,33 @@
+# 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
index 8618eb482ba7a8fb10bddbf6d6baed18901137ad..641686e49cd082285677475ec7b3c56e01b87c0a 100644 (file)
@@ -6,9 +6,16 @@
 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
index 58b85697e09a453cab3274b6fb23a61c19a9c718..2852aef61da71d4bb1521877c3a0efe1a5d44ec9 100644 (file)
@@ -6,17 +6,23 @@
 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
   }
diff --git a/level_3/controller/data/settings/rules/boot/proc.rule b/level_3/controller/data/settings/rules/boot/proc.rule
new file mode 100644 (file)
index 0000000..12ffc18
--- /dev/null
@@ -0,0 +1,29 @@
+# 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
+  }
diff --git a/level_3/controller/data/settings/rules/boot/root.rule b/level_3/controller/data/settings/rules/boot/root.rule
new file mode 100644 (file)
index 0000000..f5c63fe
--- /dev/null
@@ -0,0 +1,67 @@
+# 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
+  }
index 5d089cca533fea5562b07c09f6626c4bb33a9b3c..1d306024e28f106cb56f9052d4ae743c6a0a75c8 100644 (file)
@@ -5,6 +5,7 @@
 
 setting:
   name "System Network"
+  capability cap_net_admin=
 
 command:
   start network start
index aff02b4da28ccdf025fc76c910ccfc7f4706d45b..957eb9cde2a281c82941889e81049266b8459f66 100644 (file)
@@ -10,10 +10,10 @@ setting:
 
 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
   }
index 99dd544d5e77f86a5e083a8293682f3d1b0ef20b..81c7412b6218a459cefe365b4f5e0aa63bfb7204 100644 (file)
@@ -5,25 +5,20 @@
 # -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
index d9cdb113cc93f23ee82aac549f39303fd28a0b96..989b117d1854b0c7402954d971600623f3a82a34 100644 (file)
@@ -5,7 +5,7 @@
 
 setting:
   name "D-BUS"
-  capability "all="
+  capability all=
   nice 15
 
 service:
index 3d0f7cde639357eb7cfef1730db93e89edc480b0..ad4eda2623a179099be3db90710aeb2454416ad7 100644 (file)
@@ -5,7 +5,7 @@
 
 setting:
   name "System Logger"
-  capability "all="
+  capability all=
   nice 19
   scheduler idle
 
index 06a392c419abd849d1e001a9812a01d7ccaa31e7..0c413004c830f3df845b3f9990aa7f4d142367ff 100644 (file)
@@ -5,18 +5,28 @@
 
 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"
index f0c789daa7e161b7f7d69e4b88e28ba05ea2b928..5e919143455059e969c8e9626e52d9466d42c2dc 100644 (file)
@@ -5,27 +5,34 @@
 
 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
index 07edc8a82e17e9462be50959656ba77733db3640..ac3042e2e8dc556338d2fdc87a2b3cb2cb810975 100644 (file)
@@ -5,5 +5,4 @@
 
 setting:
   name "System Keyboard"
-  capability "all="
   nice 15
diff --git a/level_3/controller/data/settings/rules/task/ntpdate.rule b/level_3/controller/data/settings/rules/task/ntpdate.rule
new file mode 100644 (file)
index 0000000..2040744
--- /dev/null
@@ -0,0 +1,28 @@
+# 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
+  }