Skip to content

Commit

Permalink
Prevent kano-settings-onboot from running during Safe Mode
Browse files Browse the repository at this point in the history
  • Loading branch information
radujipa committed Nov 23, 2018
1 parent f3dc1ab commit d6e7f6c
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions etc/init.d/kano-settings
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,25 @@ case "$1" in
# A new line, to position the shell prompt underneath
echo "" > /dev/tty1

# If you have a special screen or hardware that needs custom config.txt settings,
# create this sentinel file to avoid system reboots and eventual black screens.
onboot_sentinel_file="/boot/no-config-writes"
if [ ! -f "$onboot_sentinel_file" ]; then
log_action_begin_msg "Running kano-settings-onboot"
/usr/bin/kano-settings-onboot
else
log_action_begin_msg "Disabling kano-settings-onboot due to $onboot_sentinel_file"
systemctl --quiet is-active kano-safe-mode-requested.target
sm_req=$?
systemctl --quiet is-active kano-safe-mode.target
sm=$?

# Check that Safe Mode was not requested and that this is
# not a Safe Mode boot.
if [ $sm_req -ne 0 ] && [ $sm -ne 0 ]; then

# If you have a special screen or hardware that needs custom
# config.txt settings, create this sentinel file to avoid system
# reboots and eventual black screens.
onboot_sentinel_file="/boot/no-config-writes"
if [ ! -f "$onboot_sentinel_file" ]; then
log_action_begin_msg "Running kano-settings-onboot"
/usr/bin/kano-settings-onboot
else
log_action_begin_msg "Disabling kano-settings-onboot due to $onboot_sentinel_file"
fi
fi

# Fix for noobs:
Expand All @@ -37,14 +48,14 @@ case "$1" in
/sbin/setcap cap_net_raw+ep /usr/bin/fping6 || true
/sbin/setcap cap_net_raw+ep /usr/bin/fping || true
/sbin/setcap cap_dac_override,cap_sys_ptrace+ep /usr/bin/systemd-detect-virt || true
log_action_end_msg $?
;;
log_action_end_msg $?
;;
stop)
;;
;;
restart|reload|force-reload|status)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
;;
*)
echo "Usage: kano-settings [start|stop]" >&2
exit 3
Expand Down

0 comments on commit d6e7f6c

Please sign in to comment.