ConfServices 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # This file is part of the 'dragora-installer'.
  2. #
  3. # Purpose: Show detected services to activate/deactivate.
  4. addEntry()
  5. {
  6. service=$1
  7. description=$2
  8. if test -s "/media/dragora-root/etc/perp/${service}/rc.main"
  9. then
  10. # Detect current changes for previous installations
  11. sticky_bit=$(find /media/dragora-root/etc/perp -name "$service" -perm -1000 -print)
  12. if test -n "$sticky_bit"
  13. then
  14. _toggle_flag=on
  15. else
  16. _toggle_flag=off
  17. fi
  18. echo "\"${service}\" \"\" $_toggle_flag \"${description}\" \\" \
  19. >> "${SUBTMPDIR}/ConfServices"
  20. fi
  21. unset -v service description sticky_bit _toggle_flag
  22. }
  23. cat << EOF > "${SUBTMPDIR}/ConfServices"
  24. dialog --colors \\
  25. --backtitle "\\ZbChoosing the running services" \\
  26. --title "PERSISTENT PROCESS ON BOOT" --no-cancel \\
  27. --item-help --checklist \\
  28. "A \"persistent process\" is any program intended to be \\
  29. long-running, highly available, and purpose critical. \\
  30. Also known and often described as a \"service\", a persistent \\
  31. process normally provides some essential, on-demand system \\
  32. service.\\n\\n\\
  33. Please select the daemons that you want to start, monitor, log,\\n\\
  34. and control as persistent processes from system startup." 15 71 0 \\
  35. EOF
  36. addEntry acpid "Advanced Configuration and Power Interface event daemon."
  37. addEntry connmand "A daemon for managing Internet connections."
  38. addEntry crond "Cron daemon. [required]"
  39. addEntry dbus "D-Bus daemon."
  40. addEntry devmon "Device monitor (udevil)."
  41. addEntry dhcpcd "DHCP client/daemon (If selected you should deselect 'connmand' to avoid conflicts)"
  42. addEntry inetd "Internet super-server."
  43. addEntry sshd "The OpenSSH (SSH) daemon."
  44. addEntry syslogd "Log systems messages. [required]"
  45. addEntry udevd "Device event managing daemon. [required]"
  46. unset -f addEntry
  47. echo ' 2> "${SUBTMPDIR}/return-ConfServices"' >> "${SUBTMPDIR}/ConfServices"
  48. # Show the menu
  49. . "${SUBTMPDIR}/ConfServices"
  50. test -s "${SUBTMPDIR}/return-ConfServices" || return 0;
  51. # Set sticky bit according to the selection
  52. for service in acpid connmand crond dbus devmon dhcpcd inetd \
  53. sshd syslogd udevd ; \
  54. do
  55. if grep -q -o -m 1 "$service" "${SUBTMPDIR}/return-ConfServices"
  56. then
  57. chmod a+t /media/dragora-root/etc/perp/${service}
  58. else
  59. chmod a-t /media/dragora-root/etc/perp/${service}
  60. fi
  61. done
  62. unset -v service