diff --git a/ajax/system/sys_perform_update.php b/ajax/system/sys_perform_update.php index a33984bc..5008bbd1 100644 --- a/ajax/system/sys_perform_update.php +++ b/ajax/system/sys_perform_update.php @@ -8,8 +8,8 @@ if (isset($_POST['csrf_token'])) { } // set installer path + options $path = getenv("DOCUMENT_ROOT"); - $opts = " --update --path $path --yes"; - $installer = "sudo /etc/raspap/system/app-update.sh"; + $opts = " --update --yes --path $path"; + $installer = "sudo /etc/raspap/system/raspbian.sh"; $execUpdate = $installer.$opts; $response = shell_exec($execUpdate); diff --git a/ajax/system/sys_read_logfile.php b/ajax/system/sys_read_logfile.php index 7715fab2..567de9e1 100644 --- a/ajax/system/sys_read_logfile.php +++ b/ajax/system/sys_read_logfile.php @@ -9,7 +9,7 @@ $searchStrings = [ 'Installation completed' => 6, 'error' => 7 ]; -sleep(1); +usleep(500); if (file_exists($logFile)) { $handle = fopen($logFile, 'r'); @@ -40,4 +40,3 @@ if (file_exists($logFile)) { echo json_encode("File does not exist: $logFile"); } - diff --git a/installers/app-update.sh b/installers/app-update.sh deleted file mode 100755 index 183bbacf..00000000 --- a/installers/app-update.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash -# -# RaspAP Application Update -# Safely updates an existing RaspAP installation -# Author: @billz -# Author URI: https://github.com/billz -# Project URI: https://github.com/RaspAP/ -# License: GNU General Public License v3.0 -# License URI: https://github.com/RaspAP/raspap-webgui/blob/master/LICENSE -# -# Reads arguments passed by the RaspAP application and securely executes the -# local raspbian.sh install loader. - -# Exit on error -set -o errexit -# Exit on error inside functions -set -o errtrace -# Exit on pipeline error -set -eo pipefail - -function _main() { - # set defaults - _parse_params "$@" - _load_installer -} - -function _parse_params() { - # set defaults - insiders=0 - acctoken="" - username="" - path="" - - while :; do - case "${1-}" in - -i|--insiders) - insiders=1 - ;; - -t|--token) - acctoken="$2" - shift - ;; - -n|--name) - username="$2" - shift - ;; - -p|--path) - path="$2" - shift - ;; - -*|--*) - echo "Unknown option: $1" - exit 1 - ;; - *) - break - ;; - esac - shift - done -} - -function _load_installer() { - args=() - if [ "$insiders" -eq 1 ]; then - args+=("--insiders") - fi - if [ -n "$path" ]; then - args+=("--path ${path}") - fi - if [ -n "$username" ]; then - args+=("--name ${username}") - fi - if [ -n "$acctoken" ]; then - args+=("--token ${acctoken}") - fi - filtered=() - for arg in "${args[@]}"; do - if [ -n "$arg" ]; then - filtered+=("$arg") - fi - done - - echo "Loading installer..." - echo "${path}/installers/raspbian.sh --update --yes ${filtered[*]}" - $path/installers/raspbian.sh --update --yes ${filtered[*]} || { echo "Failed to execute raspbian.sh - last error: $?"; } -} - -_main "$@" - diff --git a/installers/common.sh b/installers/common.sh index 825ff757..02b6d201 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -781,11 +781,11 @@ function _patch_system_files() { sudo mkdir $raspap_dir/system || _install_status 1 "Unable to create directory '$raspap_dir/system'" fi - _install_log "Creating RaspAP debug log control script" + _install_log "Copying RaspAP debug log control script" sudo cp "$webroot_dir/installers/"debuglog.sh "$raspap_dir/system" || _install_status 1 "Unable to move debug logging script" - _install_log "Creating RaspAP application update script" - sudo cp "$webroot_dir/installers/"app-update.sh "$raspap_dir/system" || _install_status 1 "Unable to move application update script" + _install_log "Copying RaspAP install loader" + sudo cp "$webroot_dir/installers/"raspbian.sh "$raspap_dir/system" || _install_status 1 "Unable to move application update script" # Set ownership and permissions sudo chown -c root:root "$raspap_dir/system/"*.sh || _install_status 1 "Unable change owner and/or group" diff --git a/installers/raspap.sudoers b/installers/raspap.sudoers index e49e20a1..8d3d817c 100644 --- a/installers/raspap.sudoers +++ b/installers/raspap.sudoers @@ -42,7 +42,7 @@ www-data ALL=(ALL) NOPASSWD:/etc/raspap/lighttpd/configport.sh www-data ALL=(ALL) NOPASSWD:/etc/raspap/openvpn/configauth.sh www-data ALL=(ALL) NOPASSWD:/etc/raspap/openvpn/openvpnlog.sh www-data ALL=(ALL) NOPASSWD:/etc/raspap/system/debuglog.sh -www-data ALL=(ALL) NOPASSWD:/etc/raspap/system/app-update.sh +www-data ALL=(ALL) NOPASSWD:/etc/raspap/system/raspbian.sh www-data ALL=(ALL) NOPASSWD:/bin/chmod o+r /tmp/hostapd.log www-data ALL=(ALL) NOPASSWD:/bin/chmod o+r /var/log/dnsmasq.log www-data ALL=(ALL) NOPASSWD:/bin/chmod o+r /tmp/wireguard.log