diff --git a/ct/actualbudget.sh b/ct/actualbudget.sh index c818ceabe..53d4d5fdc 100644 --- a/ct/actualbudget.sh +++ b/ct/actualbudget.sh @@ -20,52 +20,52 @@ color catch_errors function update_script() { - header_info - check_container_storage - check_container_resources + header_info + check_container_storage + check_container_resources - if [[ ! -d /opt/actualbudget ]]; then - msg_error "No ${APP} Installation Found!" - exit + if [[ ! -d /opt/actualbudget ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + RELEASE=$(curl -fsSL https://api.github.com/repos/actualbudget/actual/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [[ ! -f /opt/actualbudget_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/actualbudget_version.txt)" ]]; then + msg_info "Stopping ${APP}" + systemctl stop actualbudget + msg_ok "${APP} Stopped" + + msg_info "Updating ${APP} to ${RELEASE}" + cd /tmp || exit + curl -fsSL "https://github.com/actualbudget/actual/archive/refs/tags/v${RELEASE}.tar.gz" -o "v${RELEASE}.tar.gz" + + mv /opt/actualbudget /opt/actualbudget_bak + tar -xzf "v${RELEASE}.tar.gz" + mv "actual-${RELEASE}" /opt/actualbudget + + mkdir -p /opt/actualbudget-data/{server-files,upload,migrate,user-files,migrations,config} + for dir in server-files .migrate user-files migrations; do + if [[ -d /opt/actualbudget_bak/$dir ]]; then + mv /opt/actualbudget_bak/$dir/* /opt/actualbudget-data/$dir/ || true + fi + done + if [[ -f /opt/actualbudget-data/migrate/.migrations ]]; then + sed -i 's/null/1732656575219/g' /opt/actualbudget-data/migrate/.migrations + sed -i 's/null/1732656575220/g' /opt/actualbudget-data/migrate/.migrations + fi + if [[ -f /opt/actualbudget/server-files/account.sqlite ]] && [[ ! -f /opt/actualbudget-data/server-files/account.sqlite ]]; then + mv /opt/actualbudget/server-files/account.sqlite /opt/actualbudget-data/server-files/account.sqlite fi - RELEASE=$(curl -fsSL https://api.github.com/repos/actualbudget/actual/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') - if [[ ! -f /opt/actualbudget_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/actualbudget_version.txt)" ]]; then - msg_info "Stopping ${APP}" - systemctl stop actualbudget - msg_ok "${APP} Stopped" + if [[ -f /opt/actualbudget_bak/selfhost.key ]]; then + mv /opt/actualbudget_bak/selfhost.key /opt/actualbudget/selfhost.key + mv /opt/actualbudget_bak/selfhost.crt /opt/actualbudget/selfhost.crt + fi - msg_info "Updating ${APP} to ${RELEASE}" - cd /tmp - curl -fsSL -O https://github.com/actualbudget/actual/archive/refs/tags/v${RELEASE}.tar.gz - - mv /opt/actualbudget /opt/actualbudget_bak - tar -xzf "v${RELEASE}.tar.gz" - mv actual-${RELEASE} /opt/actualbudget - - mkdir -p /opt/actualbudget-data/{server-files,upload,migrate,user-files,migrations,config} - for dir in server-files .migrate user-files migrations; do - if [[ -d /opt/actualbudget_bak/$dir ]]; then - mv /opt/actualbudget_bak/$dir/* /opt/actualbudget-data/$dir/ || true - fi - done - if [[ -f /opt/actualbudget-data/migrate/.migrations ]]; then - sed -i 's/null/1732656575219/g' /opt/actualbudget-data/migrate/.migrations - sed -i 's/null/1732656575220/g' /opt/actualbudget-data/migrate/.migrations - fi - if [[ -f /opt/actualbudget/server-files/account.sqlite ]] && [[ ! -f /opt/actualbudget-data/server-files/account.sqlite ]]; then - mv /opt/actualbudget/server-files/account.sqlite /opt/actualbudget-data/server-files/account.sqlite - fi - - if [[ -f /opt/actualbudget_bak/selfhost.key ]]; then - mv /opt/actualbudget_bak/selfhost.key /opt/actualbudget/selfhost.key - mv /opt/actualbudget_bak/selfhost.crt /opt/actualbudget/selfhost.crt - fi - - if [[ -f /opt/actualbudget_bak/.env ]]; then - mv /opt/actualbudget_bak/.env /opt/actualbudget-data/.env - else - cat </opt/actualbudget-data/.env + if [[ -f /opt/actualbudget_bak/.env ]]; then + mv /opt/actualbudget_bak/.env /opt/actualbudget-data/.env + else + cat </opt/actualbudget-data/.env ACTUAL_UPLOAD_DIR=/opt/actualbudget-data/upload ACTUAL_DATA_DIR=/opt/actualbudget-data ACTUAL_SERVER_FILES_DIR=/opt/actualbudget-data/server-files @@ -75,14 +75,14 @@ ACTUAL_TRUSTED_PROXIES="10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,127.0.0.1/32,::1 ACTUAL_HTTPS_KEY=/opt/actualbudget/selfhost.key ACTUAL_HTTPS_CERT=/opt/actualbudget/selfhost.crt EOF - fi - cd /opt/actualbudget - $STD yarn workspaces focus @actual-app/sync-server --production - echo "${RELEASE}" >/opt/actualbudget_version.txt - msg_ok "Updated ${APP}" + fi + cd /opt/actualbudget || exit + $STD yarn workspaces focus @actual-app/sync-server --production + echo "${RELEASE}" >/opt/actualbudget_version.txt + msg_ok "Updated ${APP}" - msg_info "Starting ${APP}" - cat </etc/systemd/system/actualbudget.service + msg_info "Starting ${APP}" + cat </etc/systemd/system/actualbudget.service [Unit] Description=Actual Budget Service After=network.target @@ -101,19 +101,19 @@ RestartSec=10 WantedBy=multi-user.target EOF - systemctl daemon-reload - systemctl start actualbudget - msg_ok "Started ${APP}" + systemctl daemon-reload + systemctl start actualbudget + msg_ok "Started ${APP}" - msg_info "Cleaning Up" - rm -rf /opt/actualbudget_bak - rm -rf "/tmp/v${RELEASE}.tar.gz" - msg_ok "Cleaned" - msg_ok "Updated Successfully" - else - msg_ok "No update required. ${APP} is already at ${RELEASE}" - fi - exit + msg_info "Cleaning Up" + rm -rf /opt/actualbudget_bak + rm -rf "/tmp/v${RELEASE}.tar.gz" + msg_ok "Cleaned" + msg_ok "Updated Successfully" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi + exit } start @@ -123,4 +123,4 @@ description msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}" -echo -e "${TAB}${GATEWAY}${BGN}https://${IP}:5006${CL}" \ No newline at end of file +echo -e "${TAB}${GATEWAY}${BGN}https://${IP}:5006${CL}" diff --git a/ct/emby.sh b/ct/emby.sh index e9c61d288..502db5c38 100644 --- a/ct/emby.sh +++ b/ct/emby.sh @@ -20,29 +20,29 @@ color catch_errors function update_script() { - header_info - check_container_storage - check_container_resources - if [[ ! -d /opt/emby-server ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi - LATEST=$(curl -fsSL https://api.github.com/repos/MediaBrowser/Emby.Releases/releases/latest | grep '"tag_name":' | cut -d'"' -f4) - msg_info "Stopping ${APP}" - systemctl stop emby-server - msg_ok "Stopped ${APP}" - - msg_info "Updating ${APP}" - $STD curl -fsSL "https://github.com/MediaBrowser/Emby.Releases/releases/download/${LATEST}/emby-server-deb_${LATEST}_amd64.deb" -O - $STD dpkg -i emby-server-deb_${LATEST}_amd64.deb - rm emby-server-deb_${LATEST}_amd64.deb - msg_ok "Updated ${APP}" - - msg_info "Starting ${APP}" - systemctl start emby-server - msg_ok "Started ${APP}" - msg_ok "Updated Successfully" + header_info + check_container_storage + check_container_resources + if [[ ! -d /opt/emby-server ]]; then + msg_error "No ${APP} Installation Found!" exit + fi + LATEST=$(curl -fsSL https://api.github.com/repos/MediaBrowser/Emby.Releases/releases/latest | grep '"tag_name":' | cut -d'"' -f4) + msg_info "Stopping ${APP}" + systemctl stop emby-server + msg_ok "Stopped ${APP}" + + msg_info "Updating ${APP}" + $STD curl -fsSL "https://github.com/MediaBrowser/Emby.Releases/releases/download/${LATEST}/emby-server-deb_${LATEST}_amd64.deb" -o "emby-server-deb_${LATEST}_amd64.deb" + $STD dpkg -i "emby-server-deb_${LATEST}_amd64.deb" + rm "emby-server-deb_${LATEST}_amd64.deb" + msg_ok "Updated ${APP}" + + msg_info "Starting ${APP}" + systemctl start emby-server + msg_ok "Started ${APP}" + msg_ok "Updated Successfully" + exit } start diff --git a/ct/snipeit.sh b/ct/snipeit.sh index 27e511d6f..133a45934 100644 --- a/ct/snipeit.sh +++ b/ct/snipeit.sh @@ -39,15 +39,12 @@ function update_script() { mv /opt/snipe-it /opt/snipe-it-backup temp_file=$(mktemp) curl -fsSL "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file" - tar zxf $temp_file - mv snipe-it-${RELEASE} /opt/snipe-it - $STD curl -fsSL "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip" -O - unzip -q v${RELEASE}.zip - mv snipe-it-${RELEASE} /opt/snipe-it + tar zxf "$temp_file" + mv "snipe-it-${RELEASE}" /opt/snipe-it cp /opt/snipe-it-backup/.env /opt/snipe-it/.env cp -r /opt/snipe-it-backup/public/uploads/ /opt/snipe-it/public/uploads/ cp -r /opt/snipe-it-backup/storage/private_uploads /opt/snipe-it/storage/private_uploads - cd /opt/snipe-it/ + cd /opt/snipe-it/ || exit export COMPOSER_ALLOW_SUPERUSER=1 $STD composer install --no-dev --optimize-autoloader --no-interaction $STD composer dump-autoload @@ -58,7 +55,7 @@ function update_script() { $STD php artisan view:clear chown -R www-data: /opt/snipe-it chmod -R 755 /opt/snipe-it - rm -rf /opt/v${RELEASE}.zip + rm -rf "$temp_file" rm -rf /opt/snipe-it-backup msg_ok "Updated ${APP}" diff --git a/install/daemonsync-install.sh b/install/daemonsync-install.sh index 1afc20af3..4ea4bda35 100644 --- a/install/daemonsync-install.sh +++ b/install/daemonsync-install.sh @@ -18,7 +18,7 @@ $STD apt-get install -y g++-multilib msg_ok "Installed Dependencies" msg_info "Installing Daemon Sync Server" -curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/daemonsync_2.2.0.0059_amd64.deb -O "daemonsync_2.2.0.0059_amd64.deb" +curl -fsSL "https://raw.githubusercontent.com/community-scripts/ProxmoxVE/raw/main/misc/daemonsync_2.2.0.0059_amd64.deb" -o "daemonsync_2.2.0.0059_amd64.deb" $STD dpkg -i daemonsync_2.2.0.0059_amd64.deb msg_ok "Installed Daemon Sync Server" diff --git a/install/deconz-install.sh b/install/deconz-install.sh index db317d5f5..04afdd0af 100644 --- a/install/deconz-install.sh +++ b/install/deconz-install.sh @@ -15,14 +15,14 @@ update_os msg_info "Setting Phoscon Repository" VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)" -curl -fsSL http://phoscon.de/apt/deconz.pub.key >/etc/apt/trusted.gpg.d/deconz.pub.asc +curl -fsSL "http://phoscon.de/apt/deconz.pub.key" >/etc/apt/trusted.gpg.d/deconz.pub.asc echo "deb [arch=amd64] http://phoscon.de/apt/deconz $VERSION main" >/etc/apt/sources.list.d/deconz.list msg_ok "Setup Phoscon Repository" msg_info "Installing deConz" libssl=$(curl -fsSL "http://security.ubuntu.com/ubuntu/pool/main/o/openssl/" | grep -o 'libssl1\.1_1\.1\.1f-1ubuntu2\.2[^"]*amd64\.deb' | head -n1) -curl -fsSL "http://security.ubuntu.com/ubuntu/pool/main/o/openssl/$libssl" -O -$STD dpkg -i $libssl +curl -fsSL "http://security.ubuntu.com/ubuntu/pool/main/o/openssl/$libssl" -o "$libssl" +$STD dpkg -i "$libssl" $STD apt-get update $STD apt-get install -y deconz msg_ok "Installed deConz" @@ -51,7 +51,7 @@ motd_ssh customize msg_info "Cleaning up" -rm -rf $libssl +rm -rf "$libssl" $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned" diff --git a/install/paperless-ngx-install.sh b/install/paperless-ngx-install.sh index 204769720..3fd017771 100644 --- a/install/paperless-ngx-install.sh +++ b/install/paperless-ngx-install.sh @@ -58,10 +58,10 @@ $STD apt-get install -y \ tesseract-ocr \ tesseract-ocr-eng -cd /tmp +cd /tmp || exit curl -fsSL "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs10040/ghostscript-10.04.0.tar.gz" -o $(basename "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs10040/ghostscript-10.04.0.tar.gz") $STD tar -xzf ghostscript-10.04.0.tar.gz -cd ghostscript-10.04.0 +cd ghostscript-10.04.0 || exit $STD ./configure $STD make $STD sudo make install @@ -69,7 +69,7 @@ msg_ok "Installed OCR Dependencies" msg_info "Installing JBIG2" $STD git clone https://github.com/ie13/jbig2enc /opt/jbig2enc -cd /opt/jbig2enc +cd /opt/jbig2enc || exit $STD bash ./autogen.sh $STD bash ./configure $STD make @@ -78,23 +78,23 @@ rm -rf /opt/jbig2enc msg_ok "Installed JBIG2" msg_info "Installing Paperless-ngx (Patience)" -Paperlessngx=$(curl -fsSL https://github.com/paperless-ngx/paperless-ngx/releases/latest | grep "title>Release" | cut -d " " -f 5) -cd /opt -$STD curl -fsSL "https://github.com/paperless-ngx/paperless-ngx/releases/download/$Paperlessngx/paperless-ngx-$Paperlessngx.tar.xz" -O -$STD tar -xf paperless-ngx-$Paperlessngx.tar.xz -C /opt/ +Paperlessngx=$(curl -fsSL "https://github.com/paperless-ngx/paperless-ngx/releases/latest" | grep "title>Release" | cut -d " " -f 5) +cd /opt || exit +$STD curl -fsSL "https://github.com/paperless-ngx/paperless-ngx/releases/download/$Paperlessngx/paperless-ngx-$Paperlessngx.tar.xz" -o "paperless-ngx-$Paperlessngx.tar.xz" +$STD tar -xf "paperless-ngx-$Paperlessngx.tar.xz" -C /opt/ mv paperless-ngx paperless -rm paperless-ngx-$Paperlessngx.tar.xz -cd /opt/paperless +rm "paperless-ngx-$Paperlessngx.tar.xz" +cd /opt/paperless || exit $STD pip install --upgrade pip $STD pip install -r requirements.txt -curl -fsSL -o /opt/paperless/paperless.conf https://raw.githubusercontent.com/paperless-ngx/paperless-ngx/main/paperless.conf.example +curl -fsSL "https://raw.githubusercontent.com/paperless-ngx/paperless-ngx/main/paperless.conf.example" -o /opt/paperless/paperless.conf mkdir -p {consume,data,media,static} sed -i -e 's|#PAPERLESS_REDIS=redis://localhost:6379|PAPERLESS_REDIS=redis://localhost:6379|' /opt/paperless/paperless.conf sed -i -e "s|#PAPERLESS_CONSUMPTION_DIR=../consume|PAPERLESS_CONSUMPTION_DIR=/opt/paperless/consume|" /opt/paperless/paperless.conf sed -i -e "s|#PAPERLESS_DATA_DIR=../data|PAPERLESS_DATA_DIR=/opt/paperless/data|" /opt/paperless/paperless.conf sed -i -e "s|#PAPERLESS_MEDIA_ROOT=../media|PAPERLESS_MEDIA_ROOT=/opt/paperless/media|" /opt/paperless/paperless.conf sed -i -e "s|#PAPERLESS_STATICDIR=../static|PAPERLESS_STATICDIR=/opt/paperless/static|" /opt/paperless/paperless.conf -echo "${Paperlessngx}" >/opt/${APPLICATION}_version.txt +echo "${Paperlessngx}" >/opt/"${APPLICATION}"_version.txt msg_ok "Installed Paperless-ngx" msg_info "Installing Natural Language Toolkit (Patience)" @@ -121,7 +121,7 @@ sed -i -e "s|#PAPERLESS_DBNAME=paperless|PAPERLESS_DBNAME=$DB_NAME|" /opt/paperl sed -i -e "s|#PAPERLESS_DBUSER=paperless|PAPERLESS_DBUSER=$DB_USER|" /opt/paperless/paperless.conf sed -i -e "s|#PAPERLESS_DBPASS=paperless|PAPERLESS_DBPASS=$DB_PASS|" /opt/paperless/paperless.conf sed -i -e "s|#PAPERLESS_SECRET_KEY=change-me|PAPERLESS_SECRET_KEY=$SECRET_KEY|" /opt/paperless/paperless.conf -cd /opt/paperless/src +cd /opt/paperless/src || exit $STD python3 manage.py migrate msg_ok "Set up PostgreSQL database"