Remove temp $source_dir if exists, sudo rm raspap_install.log

This commit is contained in:
billz 2023-11-25 08:15:10 +00:00
parent c0bf18bf50
commit 2102fb9043
2 changed files with 6 additions and 2 deletions

View file

@ -547,6 +547,10 @@ function _create_openvpn_scripts() {
function _download_latest_files() {
_install_log "Cloning latest files from GitHub"
source_dir="/tmp/raspap-webgui"
if [ -d "$source_dir" ]; then
echo "Temporary download destination $source_dir exists. Removing..."
rm -r "$source_dir"
fi
if [ "$repo" == "RaspAP/raspap-insiders" ]; then
if [ -n "$username" ] && [ -n "$acctoken" ]; then
insiders_source_url="https://${username}:${acctoken}@github.com/$repo"
@ -560,7 +564,7 @@ function _download_latest_files() {
git clone --branch $branch --depth 1 -c advice.detachedHead=false $git_source_url $source_dir || clone=false
fi
if [ "$clone" = false ]; then
_install_status 1 "Unable to download files from github"
_install_status 1 "Unable to download files from GitHub"
echo "The installer cannot continue." >&2
exit 1
fi

View file

@ -188,7 +188,7 @@ function _setup_colors() {
function _log_output() {
readonly LOGFILE_PATH="/tmp"
if [ -f "$LOGFILE_PATH/raspap_install.log" ]; then
rm "$LOGFILE_PATH/raspap_install.log"
sudo rm "$LOGFILE_PATH/raspap_install.log"
fi
exec > >(tee -i $LOGFILE_PATH/raspap_install.log)
exec 2>&1