From 5651aec30e1ff8585c5743db4b87d04f194dd2a7 Mon Sep 17 00:00:00 2001 From: Bob Mottram <bob@freedombone.net> Date: Wed, 8 Aug 2018 22:16:35 +0100 Subject: [PATCH] Check if install has completed when webadmin daemon starts --- src/freedombone-installer | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/freedombone-installer b/src/freedombone-installer index fa1c8ece6..c444da96b 100755 --- a/src/freedombone-installer +++ b/src/freedombone-installer @@ -543,20 +543,30 @@ if [ -f "$install_state_file" ]; then install_state=$(cat "$install_state_file") # shellcheck disable=SC2086 if [ $install_state -ne $INSTALL_STATE_COMMAND_SUCCESS ]; then - chown www-data:www-data "$webadmin_install_dir/log.txt" - # remove the setup file containing login details - if [ -f "$setup_file" ]; then - rm "$setup_file" - fi - if [ -f /etc/nginx/.webadminpasswd ]; then - rm /etc/nginx/.webadminpasswd + if grep -q 'install_final' "$COMPLETION_FILE"; then + echo -n "$INSTALL_STATE_COMMAND_SUCCESS" > "$install_state_file" + install_state=$INSTALL_STATE_COMMAND_SUCCESS + else + chown www-data:www-data "$webadmin_install_dir/log.txt" + # remove the setup file containing login details + if [ -f "$setup_file" ]; then + rm "$setup_file" + fi + if [ -f /etc/nginx/.webadminpasswd ]; then + rm /etc/nginx/.webadminpasswd + fi + echo -n "$INSTALL_STATE_FIRST_BOOT" > "$install_state_file" + install_state=$INSTALL_STATE_FIRST_BOOT fi + fi +else + if grep -q 'install_final' "$COMPLETION_FILE"; then + echo -n "$INSTALL_STATE_COMMAND_SUCCESS" > "$install_state_file" + install_state=$INSTALL_STATE_COMMAND_SUCCESS + else echo -n "$INSTALL_STATE_FIRST_BOOT" > "$install_state_file" install_state=$INSTALL_STATE_FIRST_BOOT fi -else - echo -n "$INSTALL_STATE_FIRST_BOOT" > "$install_state_file" - install_state=$INSTALL_STATE_FIRST_BOOT fi while true -- GitLab