From 21273774a564d88dbd8c9605ce70e17d874bb7de Mon Sep 17 00:00:00 2001 From: billz Date: Fri, 20 Mar 2020 08:04:50 +0000 Subject: [PATCH] Fix raspap.service install path, add error handling --- installers/common.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 7d345c48..16cc2e01 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -294,10 +294,10 @@ function default_configuration() { if [ ! -f "/etc/systemd/system/iptables.service" ]; then echo "Enabling iptables.service" - sudo cp $webroot_dir/installers/iptables.service /etc/systemd/system/ + sudo cp $webroot_dir/installers/iptables.service /etc/systemd/system/ || install_error "Unable to move iptables.service file" sudo systemctl daemon-reload - sudo systemctl enable iptables.service - sudo systemctl start iptables.service + sudo systemctl enable iptables.service || install_error "Failed to enable iptables.service" + sudo systemctl start iptables.service || install_error "Unable to start iptables.service" fi # Prompt to install RaspAP daemon @@ -319,8 +319,10 @@ function default_configuration() { function enable_raspap_daemon() { install_log "Enabling RaspAP daemon" echo "Disable with: sudo systemctl disable raspap.service" - sudo cp $webroot_dir/installers/raspap.service /lib/systemd/system/ || install_error "Unable to move raspap.service file" + sudo cp $webroot_dir/installers/raspap.service /etc/systemd/system/ || install_error "Unable to move raspap.service file" + sudo systemctl daemon-reload sudo systemctl enable raspap.service || install_error "Failed to enable raspap.service" + sudo systemctl start raspap.service || intall_error "Unable to start raspap.service" } # Add a single entry to the sudoers file