From 4d2d79b4041bd7d9d53fd9eccc7f4f0c06971a48 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 7 Apr 2019 22:13:05 +0000 Subject: [PATCH] Conditional prompt for reboot --- installers/common.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 57fcf810..884c1eea 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -326,13 +326,17 @@ function optimize_php() { function install_complete() { install_log "Installation completed!" - echo -n "The system needs to be rebooted as a final step. Reboot now? [y/N]: " - read answer - if [[ $answer != "y" ]]; then - echo "Installation reboot aborted." - exit 0 + # Prompt to reboot if wired ethernet (eth0) is connected. + # With default_configuration this will create an active AP on restart. + if ip a | grep -q ': eth0:.*state UP'; then + echo -n "The system needs to be rebooted as a final step. Reboot now? [y/N]: " + read answer + if [[ $answer != "y" ]]; then + echo "Installation reboot aborted." + exit 0 + fi + sudo shutdown -r now || install_error "Unable to execute shutdown" fi - sudo shutdown -r now || install_error "Unable to execute shutdown" } function install_raspap() {