Skip to content

Commit ea9f19d

Browse files
authored
More fixes (#3587)
1 parent e7b1cf4 commit ea9f19d

File tree

6 files changed

+107
-110
lines changed

6 files changed

+107
-110
lines changed

ct/actualbudget.sh

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -20,52 +20,52 @@ color
2020
catch_errors
2121

2222
function update_script() {
23-
header_info
24-
check_container_storage
25-
check_container_resources
23+
header_info
24+
check_container_storage
25+
check_container_resources
2626

27-
if [[ ! -d /opt/actualbudget ]]; then
28-
msg_error "No ${APP} Installation Found!"
29-
exit
27+
if [[ ! -d /opt/actualbudget ]]; then
28+
msg_error "No ${APP} Installation Found!"
29+
exit
30+
fi
31+
32+
RELEASE=$(curl -fsSL https://api.github.com/repos/actualbudget/actual/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
33+
if [[ ! -f /opt/actualbudget_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/actualbudget_version.txt)" ]]; then
34+
msg_info "Stopping ${APP}"
35+
systemctl stop actualbudget
36+
msg_ok "${APP} Stopped"
37+
38+
msg_info "Updating ${APP} to ${RELEASE}"
39+
cd /tmp || exit
40+
curl -fsSL "https://github.com/actualbudget/actual/archive/refs/tags/v${RELEASE}.tar.gz" -o "v${RELEASE}.tar.gz"
41+
42+
mv /opt/actualbudget /opt/actualbudget_bak
43+
tar -xzf "v${RELEASE}.tar.gz"
44+
mv "actual-${RELEASE}" /opt/actualbudget
45+
46+
mkdir -p /opt/actualbudget-data/{server-files,upload,migrate,user-files,migrations,config}
47+
for dir in server-files .migrate user-files migrations; do
48+
if [[ -d /opt/actualbudget_bak/$dir ]]; then
49+
mv /opt/actualbudget_bak/$dir/* /opt/actualbudget-data/$dir/ || true
50+
fi
51+
done
52+
if [[ -f /opt/actualbudget-data/migrate/.migrations ]]; then
53+
sed -i 's/null/1732656575219/g' /opt/actualbudget-data/migrate/.migrations
54+
sed -i 's/null/1732656575220/g' /opt/actualbudget-data/migrate/.migrations
55+
fi
56+
if [[ -f /opt/actualbudget/server-files/account.sqlite ]] && [[ ! -f /opt/actualbudget-data/server-files/account.sqlite ]]; then
57+
mv /opt/actualbudget/server-files/account.sqlite /opt/actualbudget-data/server-files/account.sqlite
58+
fi
59+
60+
if [[ -f /opt/actualbudget_bak/selfhost.key ]]; then
61+
mv /opt/actualbudget_bak/selfhost.key /opt/actualbudget/selfhost.key
62+
mv /opt/actualbudget_bak/selfhost.crt /opt/actualbudget/selfhost.crt
3063
fi
3164

32-
RELEASE=$(curl -fsSL https://api.github.com/repos/actualbudget/actual/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
33-
if [[ ! -f /opt/actualbudget_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/actualbudget_version.txt)" ]]; then
34-
msg_info "Stopping ${APP}"
35-
systemctl stop actualbudget
36-
msg_ok "${APP} Stopped"
37-
38-
msg_info "Updating ${APP} to ${RELEASE}"
39-
cd /tmp
40-
curl -fsSL -O https://github.com/actualbudget/actual/archive/refs/tags/v${RELEASE}.tar.gz
41-
42-
mv /opt/actualbudget /opt/actualbudget_bak
43-
tar -xzf "v${RELEASE}.tar.gz"
44-
mv actual-${RELEASE} /opt/actualbudget
45-
46-
mkdir -p /opt/actualbudget-data/{server-files,upload,migrate,user-files,migrations,config}
47-
for dir in server-files .migrate user-files migrations; do
48-
if [[ -d /opt/actualbudget_bak/$dir ]]; then
49-
mv /opt/actualbudget_bak/$dir/* /opt/actualbudget-data/$dir/ || true
50-
fi
51-
done
52-
if [[ -f /opt/actualbudget-data/migrate/.migrations ]]; then
53-
sed -i 's/null/1732656575219/g' /opt/actualbudget-data/migrate/.migrations
54-
sed -i 's/null/1732656575220/g' /opt/actualbudget-data/migrate/.migrations
55-
fi
56-
if [[ -f /opt/actualbudget/server-files/account.sqlite ]] && [[ ! -f /opt/actualbudget-data/server-files/account.sqlite ]]; then
57-
mv /opt/actualbudget/server-files/account.sqlite /opt/actualbudget-data/server-files/account.sqlite
58-
fi
59-
60-
if [[ -f /opt/actualbudget_bak/selfhost.key ]]; then
61-
mv /opt/actualbudget_bak/selfhost.key /opt/actualbudget/selfhost.key
62-
mv /opt/actualbudget_bak/selfhost.crt /opt/actualbudget/selfhost.crt
63-
fi
64-
65-
if [[ -f /opt/actualbudget_bak/.env ]]; then
66-
mv /opt/actualbudget_bak/.env /opt/actualbudget-data/.env
67-
else
68-
cat <<EOF >/opt/actualbudget-data/.env
65+
if [[ -f /opt/actualbudget_bak/.env ]]; then
66+
mv /opt/actualbudget_bak/.env /opt/actualbudget-data/.env
67+
else
68+
cat <<EOF >/opt/actualbudget-data/.env
6969
ACTUAL_UPLOAD_DIR=/opt/actualbudget-data/upload
7070
ACTUAL_DATA_DIR=/opt/actualbudget-data
7171
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
7575
ACTUAL_HTTPS_KEY=/opt/actualbudget/selfhost.key
7676
ACTUAL_HTTPS_CERT=/opt/actualbudget/selfhost.crt
7777
EOF
78-
fi
79-
cd /opt/actualbudget
80-
$STD yarn workspaces focus @actual-app/sync-server --production
81-
echo "${RELEASE}" >/opt/actualbudget_version.txt
82-
msg_ok "Updated ${APP}"
83-
84-
msg_info "Starting ${APP}"
85-
cat <<EOF >/etc/systemd/system/actualbudget.service
78+
fi
79+
cd /opt/actualbudget || exit
80+
$STD yarn workspaces focus @actual-app/sync-server --production
81+
echo "${RELEASE}" >/opt/actualbudget_version.txt
82+
msg_ok "Updated ${APP}"
83+
84+
msg_info "Starting ${APP}"
85+
cat <<EOF >/etc/systemd/system/actualbudget.service
8686
[Unit]
8787
Description=Actual Budget Service
8888
After=network.target
@@ -101,19 +101,19 @@ RestartSec=10
101101
WantedBy=multi-user.target
102102
EOF
103103

104-
systemctl daemon-reload
105-
systemctl start actualbudget
106-
msg_ok "Started ${APP}"
107-
108-
msg_info "Cleaning Up"
109-
rm -rf /opt/actualbudget_bak
110-
rm -rf "/tmp/v${RELEASE}.tar.gz"
111-
msg_ok "Cleaned"
112-
msg_ok "Updated Successfully"
113-
else
114-
msg_ok "No update required. ${APP} is already at ${RELEASE}"
115-
fi
116-
exit
104+
systemctl daemon-reload
105+
systemctl start actualbudget
106+
msg_ok "Started ${APP}"
107+
108+
msg_info "Cleaning Up"
109+
rm -rf /opt/actualbudget_bak
110+
rm -rf "/tmp/v${RELEASE}.tar.gz"
111+
msg_ok "Cleaned"
112+
msg_ok "Updated Successfully"
113+
else
114+
msg_ok "No update required. ${APP} is already at ${RELEASE}"
115+
fi
116+
exit
117117
}
118118

119119
start
@@ -123,4 +123,4 @@ description
123123
msg_ok "Completed Successfully!\n"
124124
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
125125
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
126-
echo -e "${TAB}${GATEWAY}${BGN}https://${IP}:5006${CL}"
126+
echo -e "${TAB}${GATEWAY}${BGN}https://${IP}:5006${CL}"

ct/emby.sh

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,29 @@ color
2020
catch_errors
2121

2222
function update_script() {
23-
header_info
24-
check_container_storage
25-
check_container_resources
26-
if [[ ! -d /opt/emby-server ]]; then
27-
msg_error "No ${APP} Installation Found!"
28-
exit
29-
fi
30-
LATEST=$(curl -fsSL https://api.github.com/repos/MediaBrowser/Emby.Releases/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
31-
msg_info "Stopping ${APP}"
32-
systemctl stop emby-server
33-
msg_ok "Stopped ${APP}"
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
if [[ ! -d /opt/emby-server ]]; then
27+
msg_error "No ${APP} Installation Found!"
28+
exit
29+
fi
30+
LATEST=$(curl -fsSL https://api.github.com/repos/MediaBrowser/Emby.Releases/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
31+
msg_info "Stopping ${APP}"
32+
systemctl stop emby-server
33+
msg_ok "Stopped ${APP}"
3434

35-
msg_info "Updating ${APP}"
36-
$STD curl -fsSL "https://github.com/MediaBrowser/Emby.Releases/releases/download/${LATEST}/emby-server-deb_${LATEST}_amd64.deb" -O
37-
$STD dpkg -i emby-server-deb_${LATEST}_amd64.deb
38-
rm emby-server-deb_${LATEST}_amd64.deb
39-
msg_ok "Updated ${APP}"
35+
msg_info "Updating ${APP}"
36+
$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"
37+
$STD dpkg -i "emby-server-deb_${LATEST}_amd64.deb"
38+
rm "emby-server-deb_${LATEST}_amd64.deb"
39+
msg_ok "Updated ${APP}"
4040

41-
msg_info "Starting ${APP}"
42-
systemctl start emby-server
43-
msg_ok "Started ${APP}"
44-
msg_ok "Updated Successfully"
45-
exit
41+
msg_info "Starting ${APP}"
42+
systemctl start emby-server
43+
msg_ok "Started ${APP}"
44+
msg_ok "Updated Successfully"
45+
exit
4646
}
4747

4848
start

ct/snipeit.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,12 @@ function update_script() {
3939
mv /opt/snipe-it /opt/snipe-it-backup
4040
temp_file=$(mktemp)
4141
curl -fsSL "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
42-
tar zxf $temp_file
43-
mv snipe-it-${RELEASE} /opt/snipe-it
44-
$STD curl -fsSL "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip" -O
45-
unzip -q v${RELEASE}.zip
46-
mv snipe-it-${RELEASE} /opt/snipe-it
42+
tar zxf "$temp_file"
43+
mv "snipe-it-${RELEASE}" /opt/snipe-it
4744
cp /opt/snipe-it-backup/.env /opt/snipe-it/.env
4845
cp -r /opt/snipe-it-backup/public/uploads/ /opt/snipe-it/public/uploads/
4946
cp -r /opt/snipe-it-backup/storage/private_uploads /opt/snipe-it/storage/private_uploads
50-
cd /opt/snipe-it/
47+
cd /opt/snipe-it/ || exit
5148
export COMPOSER_ALLOW_SUPERUSER=1
5249
$STD composer install --no-dev --optimize-autoloader --no-interaction
5350
$STD composer dump-autoload
@@ -58,7 +55,7 @@ function update_script() {
5855
$STD php artisan view:clear
5956
chown -R www-data: /opt/snipe-it
6057
chmod -R 755 /opt/snipe-it
61-
rm -rf /opt/v${RELEASE}.zip
58+
rm -rf "$temp_file"
6259
rm -rf /opt/snipe-it-backup
6360
msg_ok "Updated ${APP}"
6461

install/daemonsync-install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $STD apt-get install -y g++-multilib
1818
msg_ok "Installed Dependencies"
1919

2020
msg_info "Installing Daemon Sync Server"
21-
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"
21+
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"
2222
$STD dpkg -i daemonsync_2.2.0.0059_amd64.deb
2323
msg_ok "Installed Daemon Sync Server"
2424

install/deconz-install.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ update_os
1515

1616
msg_info "Setting Phoscon Repository"
1717
VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)"
18-
curl -fsSL http://phoscon.de/apt/deconz.pub.key >/etc/apt/trusted.gpg.d/deconz.pub.asc
18+
curl -fsSL "http://phoscon.de/apt/deconz.pub.key" >/etc/apt/trusted.gpg.d/deconz.pub.asc
1919
echo "deb [arch=amd64] http://phoscon.de/apt/deconz $VERSION main" >/etc/apt/sources.list.d/deconz.list
2020
msg_ok "Setup Phoscon Repository"
2121

2222
msg_info "Installing deConz"
2323
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)
24-
curl -fsSL "http://security.ubuntu.com/ubuntu/pool/main/o/openssl/$libssl" -O
25-
$STD dpkg -i $libssl
24+
curl -fsSL "http://security.ubuntu.com/ubuntu/pool/main/o/openssl/$libssl" -o "$libssl"
25+
$STD dpkg -i "$libssl"
2626
$STD apt-get update
2727
$STD apt-get install -y deconz
2828
msg_ok "Installed deConz"
@@ -51,7 +51,7 @@ motd_ssh
5151
customize
5252

5353
msg_info "Cleaning up"
54-
rm -rf $libssl
54+
rm -rf "$libssl"
5555
$STD apt-get -y autoremove
5656
$STD apt-get -y autoclean
5757
msg_ok "Cleaned"

install/paperless-ngx-install.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,18 @@ $STD apt-get install -y \
5858
tesseract-ocr \
5959
tesseract-ocr-eng
6060

61-
cd /tmp
61+
cd /tmp || exit
6262
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")
6363
$STD tar -xzf ghostscript-10.04.0.tar.gz
64-
cd ghostscript-10.04.0
64+
cd ghostscript-10.04.0 || exit
6565
$STD ./configure
6666
$STD make
6767
$STD sudo make install
6868
msg_ok "Installed OCR Dependencies"
6969

7070
msg_info "Installing JBIG2"
7171
$STD git clone https://github.com/ie13/jbig2enc /opt/jbig2enc
72-
cd /opt/jbig2enc
72+
cd /opt/jbig2enc || exit
7373
$STD bash ./autogen.sh
7474
$STD bash ./configure
7575
$STD make
@@ -78,23 +78,23 @@ rm -rf /opt/jbig2enc
7878
msg_ok "Installed JBIG2"
7979

8080
msg_info "Installing Paperless-ngx (Patience)"
81-
Paperlessngx=$(curl -fsSL https://github.com/paperless-ngx/paperless-ngx/releases/latest | grep "title>Release" | cut -d " " -f 5)
82-
cd /opt
83-
$STD curl -fsSL "https://github.com/paperless-ngx/paperless-ngx/releases/download/$Paperlessngx/paperless-ngx-$Paperlessngx.tar.xz" -O
84-
$STD tar -xf paperless-ngx-$Paperlessngx.tar.xz -C /opt/
81+
Paperlessngx=$(curl -fsSL "https://github.com/paperless-ngx/paperless-ngx/releases/latest" | grep "title>Release" | cut -d " " -f 5)
82+
cd /opt || exit
83+
$STD curl -fsSL "https://github.com/paperless-ngx/paperless-ngx/releases/download/$Paperlessngx/paperless-ngx-$Paperlessngx.tar.xz" -o "paperless-ngx-$Paperlessngx.tar.xz"
84+
$STD tar -xf "paperless-ngx-$Paperlessngx.tar.xz" -C /opt/
8585
mv paperless-ngx paperless
86-
rm paperless-ngx-$Paperlessngx.tar.xz
87-
cd /opt/paperless
86+
rm "paperless-ngx-$Paperlessngx.tar.xz"
87+
cd /opt/paperless || exit
8888
$STD pip install --upgrade pip
8989
$STD pip install -r requirements.txt
90-
curl -fsSL -o /opt/paperless/paperless.conf https://raw.githubusercontent.com/paperless-ngx/paperless-ngx/main/paperless.conf.example
90+
curl -fsSL "https://raw.githubusercontent.com/paperless-ngx/paperless-ngx/main/paperless.conf.example" -o /opt/paperless/paperless.conf
9191
mkdir -p {consume,data,media,static}
9292
sed -i -e 's|#PAPERLESS_REDIS=redis://localhost:6379|PAPERLESS_REDIS=redis://localhost:6379|' /opt/paperless/paperless.conf
9393
sed -i -e "s|#PAPERLESS_CONSUMPTION_DIR=../consume|PAPERLESS_CONSUMPTION_DIR=/opt/paperless/consume|" /opt/paperless/paperless.conf
9494
sed -i -e "s|#PAPERLESS_DATA_DIR=../data|PAPERLESS_DATA_DIR=/opt/paperless/data|" /opt/paperless/paperless.conf
9595
sed -i -e "s|#PAPERLESS_MEDIA_ROOT=../media|PAPERLESS_MEDIA_ROOT=/opt/paperless/media|" /opt/paperless/paperless.conf
9696
sed -i -e "s|#PAPERLESS_STATICDIR=../static|PAPERLESS_STATICDIR=/opt/paperless/static|" /opt/paperless/paperless.conf
97-
echo "${Paperlessngx}" >/opt/${APPLICATION}_version.txt
97+
echo "${Paperlessngx}" >/opt/"${APPLICATION}"_version.txt
9898
msg_ok "Installed Paperless-ngx"
9999

100100
msg_info "Installing Natural Language Toolkit (Patience)"
@@ -121,7 +121,7 @@ sed -i -e "s|#PAPERLESS_DBNAME=paperless|PAPERLESS_DBNAME=$DB_NAME|" /opt/paperl
121121
sed -i -e "s|#PAPERLESS_DBUSER=paperless|PAPERLESS_DBUSER=$DB_USER|" /opt/paperless/paperless.conf
122122
sed -i -e "s|#PAPERLESS_DBPASS=paperless|PAPERLESS_DBPASS=$DB_PASS|" /opt/paperless/paperless.conf
123123
sed -i -e "s|#PAPERLESS_SECRET_KEY=change-me|PAPERLESS_SECRET_KEY=$SECRET_KEY|" /opt/paperless/paperless.conf
124-
cd /opt/paperless/src
124+
cd /opt/paperless/src || exit
125125
$STD python3 manage.py migrate
126126
msg_ok "Set up PostgreSQL database"
127127

0 commit comments

Comments
 (0)