From 51673aef32483b640492da3a858bf80d6187b5c3 Mon Sep 17 00:00:00 2001 From: billz Date: Fri, 3 Nov 2023 12:15:28 +0000 Subject: [PATCH] Fix: move debuglog.sh install to _patch_system_files() --- installers/common.sh | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 3e124d04..70ed7006 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -286,11 +286,12 @@ function _create_hostapd_scripts() { _install_log "Creating hostapd logging & control scripts" sudo mkdir $raspap_dir/hostapd || _install_status 1 "Unable to create directory '$raspap_dir/hostapd'" - # Move logging shell scripts - sudo cp "$webroot_dir/installers/"*log.sh "$raspap_dir/hostapd" || _install_status 1 "Unable to move logging scripts" - # Move service control shell scripts - sudo cp "$webroot_dir/installers/"service*.sh "$raspap_dir/hostapd" || _install_status 1 "Unable to move service control scripts" - # Make enablelog.sh and disablelog.sh not writable by www-data group. + # Copy logging shell scripts + sudo cp "$webroot_dir/installers/"enablelog.sh "$raspap_dir/hostapd" || _install_status 1 "Unable to move logging scripts" + sudo cp "$webroot_dir/installers/"disablelog.sh "$raspap_dir/hostapd" || _install_status 1 "Unable to move logging scripts" + # Copy service control shell scripts + sudo cp "$webroot_dir/installers/"servicestart.sh "$raspap_dir/hostapd" || _install_status 1 "Unable to move service control scripts" + # Change ownership and permissions of hostapd control scripts sudo chown -c root:root "$raspap_dir/hostapd/"*.sh || _install_status 1 "Unable change owner and/or group" sudo chmod 750 "$raspap_dir/hostapd/"*.sh || _install_status 1 "Unable to change file permissions" _install_status 0 @@ -301,10 +302,10 @@ function _create_lighttpd_scripts() { _install_log "Creating lighttpd control scripts" sudo mkdir $raspap_dir/lighttpd || _install_status 1 "Unable to create directory '$raspap_dir/lighttpd" - # Move service control shell scripts + # Copy service control shell scripts echo "Copying configport.sh to $raspap_dir/lighttpd" sudo cp "$webroot_dir/installers/"configport.sh "$raspap_dir/lighttpd" || _install_status 1 "Unable to move service control scripts" - # Make configport.sh writable by www-data group + # Change ownership and permissions of lighttpd scripts echo "Changing file ownership" sudo chown -c root:root "$raspap_dir/lighttpd/"*.sh || _install_status 1 "Unable change owner and/or group" sudo chmod 750 "$raspap_dir/lighttpd/"*.sh || _install_status 1 "Unable to change file permissions" @@ -539,18 +540,12 @@ function _create_openvpn_scripts() { _install_log "Creating OpenVPN control scripts" sudo mkdir $raspap_dir/openvpn || _install_status 1 "Unable to create directory '$raspap_dir/openvpn'" - _install_log "Creating RaspAP debug log control script" - sudo mkdir $raspap_dir/system || _install_status 1 "Unable to create directory '$raspap_dir/system'" - - # Move service auth control, logging and debug shell scripts + # Copy service auth control and logging scripts sudo cp "$webroot_dir/installers/"configauth.sh "$raspap_dir/openvpn" || _install_status 1 "Unable to move auth control script" sudo cp "$webroot_dir/installers/"openvpnlog.sh "$raspap_dir/openvpn" || _install_status 1 "Unable to move logging script" - sudo cp "$webroot_dir/installers/"debuglog.sh "$raspap_dir/system" || _install_status 1 "Unable to move debug logging script" # Restrict script execution to root user sudo chown -c root:root "$raspap_dir/openvpn/"*.sh || _install_status 1 "Unable change owner and/or group" sudo chmod 750 "$raspap_dir/openvpn/"*.sh || _install_status 1 "Unable to change file permissions" - sudo chown -c root:root "$raspap_dir/system/"*.sh || _install_status 1 "Unable change owner and/or group" - sudo chmod 750 "$raspap_dir/system/"*.sh || _install_status 1 "Unable to change file permissions" _install_status 0 } @@ -750,6 +745,16 @@ function _patch_system_files() { sudo cp "$webroot_dir/installers/raspap.sudoers" $raspap_sudoers || _install_status 1 "Unable to apply raspap.sudoers to $raspap_sudoers" sudo chmod 0440 $raspap_sudoers || _install_status 1 "Unable to change file permissions for $raspap_sudoers" + install_log "Creating RaspAP debug log control script" + sudo mkdir $raspap_dir/system || _install_status 1 "Unable to create directory '$raspap_dir/system'" + + # Copy debug shell script + sudo cp "$webroot_dir/installers/"debuglog.sh "$raspap_dir/system" || _install_status 1 "Unable to move debug logging script" + + # Set ownership and permissions + sudo chown -c root:root "$raspap_dir/system/"*.sh || _install_status 1 "Unable change owner and/or group" + sudo chmod 750 "$raspap_dir/system/"*.sh || _install_status 1 "Unable to change file permissions" + # Add symlink to prevent wpa_cli cmds from breaking with multiple wlan interfaces _install_log "Symlinked wpa_supplicant hooks for multiple wlan interfaces" if [ ! -f /usr/share/dhcpcd/hooks/10-wpa_supplicant ]; then