diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/button.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/button.service similarity index 100% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/button.service rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/button.service diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service new file mode 100644 index 0000000..454c957 --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-watchclock-dog.service @@ -0,0 +1,12 @@ +[Unit] +Description=Monitor time jumps and restart meshtasticd +After=network.target + +[Service] +ExecStart=/usr/local/bin/femto-watchclock-dog.sh +Restart=always +User=root + +[Install] +WantedBy=multi-user.target + diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/wifi-mesh-control.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service similarity index 66% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/wifi-mesh-control.service rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service index 3860f53..c01cff4 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/wifi-mesh-control.service +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-wifi-mesh-control.service @@ -1,11 +1,11 @@ [Unit] Description=Meshtastic control of wifi After=meshtasticd.service -Requires=meshtasticd.service [Service] -ExecStart=/usr/local/bin/wifi-mesh-control.sh +ExecStart=/usr/local/bin/femto-wifi-mesh-control.sh Restart=always +RestartSec=5 User=root [Install] diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/settime.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/settime.service similarity index 100% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/settime.service rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/settime.service diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/ifup@.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/ifup@.service deleted file mode 100644 index 67ee7b8..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/ifup@.service +++ /dev/null @@ -1,20 +0,0 @@ -[Unit] -Description=ifup for %I -After=local-fs.target network-pre.target apparmor.service systemd-sysctl.service -Before=network.target shutdown.target network-online.target -Conflicts=shutdown.target -BindsTo=sys-subsystem-net-devices-%i.device -After=sys-subsystem-net-devices-%i.device -DefaultDependencies=no -IgnoreOnIsolate=yes - -[Service] -# avoid stopping on shutdown via stopping system-ifup.slice -Slice=system.slice -ExecStart=/bin/sh -ec 'ifup --allow=hotplug %I; ifup --allow=auto %I; \ - if ifquery %I >/dev/null; then ifquery --state %I >/dev/null; fi' -ExecStop=/sbin/ifdown %I -RemainAfterExit=true -#TimeoutStartSec=5min -TimeoutStartSec=10s -TimeoutStopSec=10s diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index edb8ca7..0fae240 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -67,9 +67,12 @@ upgrade() { # build and display package intro package_intro() { - echo "Loading package info..." - # check if each field in the package info is supported by the package, and if so get it and insert it into the package info dialog - dialog --no-collapse --colors --title "$title" --yes-label "Continue" --no-label "Back" --yesno "\ + while true; do + echo "Loading package info..." + license_button="" + if $package_dir/$1.sh -O | grep -q 'G' && $package_dir/$1.sh -I; then license_button="--help-button --help-label License"; fi + # check if each field in the package info is supported by the package, and if so get it and insert it into the package info dialog + dialog --no-collapse --colors --title "$title" $license_button --yes-label "Continue" --no-label "Back" --yesno "\ $($package_dir/$1.sh -N)\n\ $(if $package_dir/$1.sh -O | grep -q 'A'; then echo -e "by $($package_dir/$1.sh -A)"; fi)\n\ $(if $package_dir/$1.sh -O | grep -q 'D'; then echo "\n$($package_dir/$1.sh -D)"; fi)\n\ @@ -79,8 +82,16 @@ $([ -n "$($package_dir/$1.sh -E)" ] && $package_dir/$1.sh -I && echo "Service st $(if output=$($package_dir/$1.sh -L); [ -n "$output" ]; then echo "Installs to: \Zu$output\Zn\n"; fi)\ $(if output=$($package_dir/$1.sh -C); [ -n "$output" ]; then echo "Conflicts with: \Zu$output\Zn\n"; fi)\ $(if $package_dir/$1.sh -O | grep -q 'U'; then echo "\nFor more information, visit $($package_dir/$1.sh -U)"; fi)" 0 0 - [ $? -eq 1 ] && return 1 #if cancel/no - package_menu $1 # after user hits "OK", move on to package menu + exit_status=$? # This line checks the exit status of the dialog command + if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog + return + elif [ $exit_status -eq 2 ]; then # Help ("extra") button + dialog --no-collapse --colors --title "$($package_dir/$1.sh -N) License" --msgbox "$($package_dir/$1.sh -G)" 0 0 + else + package_menu $1 # after user hits "OK", move on to package menu + return + fi + done } package_menu() { @@ -89,8 +100,6 @@ package_menu() { echo "Loading package menu..." # for each line, check if it's supported by the package, display it if the current install state of the package is appropriate (example: don't display "install" if the package is already installed, don't display "stop service" for a package with no services) service_state=$(femto-utils.sh -C "$($package_dir/$1.sh -E)") - license_button="" - if $package_dir/$1.sh -O | grep -q 'G' && $package_dir/$1.sh -I; then license_button="--help-button --help-label License"; fi menu_list="\ $(if $package_dir/$1.sh -O | grep -q 'l' && $package_dir/$1.sh -I; then echo "Run software x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'i' && ! $package_dir/$1.sh -I; then echo "Install x"; fi) \ @@ -103,31 +112,25 @@ package_menu() { $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "Start/restart service x"; fi) \ $(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Detailed service status x"; fi)" menu_count=$(( $(echo "$menu_list" | grep -o " x" | wc -l) $(if $package_dir/$1.sh -O | grep -q 'e' && $package_dir/$1.sh -I; then echo "+1"; fi) )) # count the number of menu items by counting how many times " x" shows up, +1 if there's a service. This is a stupid way to do this, but because each menu item only contains one space (the rest being space-sized invisible chars) it works. It's late at night, OKAY?! - choice=$(dialog --no-collapse --colors --title "$($package_dir/$1.sh -N)" --cancel-label "Back" --default-item "$choice" $license_button --menu "$(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Service status: $(femto-utils.sh -R "$service_state")"; fi)" $(( menu_count + 9 )) 45 $(( menu_count + 3 )) \ + choice=$(dialog --no-collapse --colors --title "$($package_dir/$1.sh -N)" --cancel-label "Back" --default-item "$choice" --menu "$(if $package_dir/$1.sh -O | grep -q 'S' && $package_dir/$1.sh -I; then echo "Service status: $(femto-utils.sh -R "$service_state")"; fi)" $(( menu_count + 9 )) 45 $(( menu_count + 3 )) \ $menu_list \ " " "" \ "Back to software manager" "" 3>&1 1>&2 2>&3) - exit_status=$? # This line checks the exit status of the dialog command - if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog - break - elif [ $exit_status -eq 2 ]; then # Help ("extra") button - dialog --no-collapse --colors --title "$($package_dir/$1.sh -N) License" --msgbox "$($package_dir/$1.sh -G)" 0 0 - else - # execute the actual commands - case $choice in - "Run software") echo "Launching $($package_dir/$1.sh -N)..." && eval "$($package_dir/$1.sh -l)" ;; - "Install") install $1 ;; - "Uninstall") uninstall $1 ;; - "Initialize") initialize $1 ;; - "Upgrade") upgrade $1 ;; - "Enable service") echo "Enabling and starting service..." && eval "$package_dir/$1.sh -e" && eval "$package_dir/$1.sh -r" ;; - "Disable service") echo "Disabling and stopping service..." && eval "$package_dir/$1.sh -d" && eval "$package_dir/$1.sh -s" ;; - "Stop service") echo "Stopping service..." && eval "$package_dir/$1.sh -s" ;; - "Start/restart service") echo "Starting/restarting service..." && eval "$package_dir/$1.sh -r" ;; - "Detailed service status") echo "Getting service status..." && dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;; - "Back to software manager") break ;; - esac - fi + [ $? -eq 1 ] && break # Exit the loop if the user selects "Cancel" or closes the dialog + # execute the actual commands + case $choice in + "Run software") echo "Launching $($package_dir/$1.sh -N)..." && eval "$($package_dir/$1.sh -l)" ;; + "Install") install $1 ;; + "Uninstall") uninstall $1 ;; + "Initialize") initialize $1 ;; + "Upgrade") upgrade $1 ;; + "Enable service") echo "Enabling and starting service..." && eval "$package_dir/$1.sh -e" && eval "$package_dir/$1.sh -r" ;; + "Disable service") echo "Disabling and stopping service..." && eval "$package_dir/$1.sh -d" && eval "$package_dir/$1.sh -s" ;; + "Stop service") echo "Stopping service..." && eval "$package_dir/$1.sh -s" ;; + "Start/restart service") echo "Starting/restarting service..." && eval "$package_dir/$1.sh -r" ;; + "Detailed service status") echo "Getting service status..." && dialog --no-collapse --title "$title" --msgbox "$(eval "$package_dir/$1.sh -S")" 0 0 ;; + "Back to software manager") break ;; + esac done }