Skip to content

Commit c356f77

Browse files
authored
Refactor: Remove redundant dependencies & unify unzip usage (#4780)
* refactor unzip / remove dep * remove deps from alpine packages * remove gnupg * remove gnupg
1 parent dcfe80e commit c356f77

File tree

121 files changed

+276
-368
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+276
-368
lines changed

ct/2fauth.sh

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

2222
function update_script() {
23-
header_info
24-
check_container_storage
25-
check_container_resources
26-
27-
# Check if installation is present | -f for file, -d for folder
28-
if [[ ! -d "/opt/2fauth" ]]; then
29-
msg_error "No ${APP} Installation Found!"
30-
exit
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
27+
# Check if installation is present | -f for file, -d for folder
28+
if [[ ! -d "/opt/2fauth" ]]; then
29+
msg_error "No ${APP} Installation Found!"
30+
exit
31+
fi
32+
33+
# Crawling the new version and checking whether an update is required
34+
RELEASE=$(curl -fsSL https://api.github.com/repos/Bubka/2FAuth/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
35+
if [[ "${RELEASE}" != "$(cat /opt/2fauth_version.txt)" ]] || [[ ! -f /opt/2fauth_version.txt ]]; then
36+
msg_info "Updating $APP to ${RELEASE}"
37+
38+
$STD apt-get update
39+
$STD apt-get -y upgrade
40+
41+
# Creating Backup
42+
msg_info "Creating Backup"
43+
mv "/opt/2fauth" "/opt/2fauth-backup"
44+
if ! dpkg -l | grep -q 'php8.3'; then
45+
cp /etc/nginx/conf.d/2fauth.conf /etc/nginx/conf.d/2fauth.conf.bak
46+
fi
47+
msg_ok "Backup Created"
48+
49+
# Upgrade PHP
50+
if ! dpkg -l | grep -q 'php8.3'; then
51+
$STD apt-get install -y \
52+
lsb-release \
53+
gpg
54+
curl -fsSL https://packages.sury.org/php/apt.gpg | gpg --dearmor -o /usr/share/keyrings/deb.sury.org-php.gpg
55+
echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" >/etc/apt/sources.list.d/php.list
56+
$STD apt-get update
57+
$STD apt-get install -y php8.3-{bcmath,common,ctype,curl,fileinfo,fpm,gd,mbstring,mysql,xml,cli,intl}
58+
sed -i 's/php8.2/php8.3/g' /etc/nginx/conf.d/2fauth.conf
3159
fi
3260

33-
# Crawling the new version and checking whether an update is required
34-
RELEASE=$(curl -fsSL https://api.github.com/repos/Bubka/2FAuth/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
35-
if [[ "${RELEASE}" != "$(cat /opt/2fauth_version.txt)" ]] || [[ ! -f /opt/2fauth_version.txt ]]; then
36-
msg_info "Updating $APP to ${RELEASE}"
37-
38-
$STD apt-get update
39-
$STD apt-get -y upgrade
40-
41-
# Creating Backup
42-
msg_info "Creating Backup"
43-
mv "/opt/2fauth" "/opt/2fauth-backup"
44-
if ! dpkg -l | grep -q 'php8.3'; then
45-
cp /etc/nginx/conf.d/2fauth.conf /etc/nginx/conf.d/2fauth.conf.bak
46-
fi
47-
msg_ok "Backup Created"
48-
49-
# Upgrade PHP
50-
if ! dpkg -l | grep -q 'php8.3'; then
51-
$STD apt-get install -y \
52-
lsb-release \
53-
gpg
54-
curl -fsSL https://packages.sury.org/php/apt.gpg | gpg --dearmor -o /usr/share/keyrings/deb.sury.org-php.gpg
55-
echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
56-
$STD apt-get update
57-
$STD apt-get install -y php8.3-{bcmath,common,ctype,curl,fileinfo,fpm,gd,mbstring,mysql,xml,cli,intl}
58-
sed -i 's/php8.2/php8.3/g' /etc/nginx/conf.d/2fauth.conf
59-
fi
60-
61-
# Execute Update
62-
curl -fsSL -o "${RELEASE}.zip" "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip"
63-
unzip -q "${RELEASE}.zip"
64-
mv "2FAuth-${RELEASE//v/}/" "/opt/2fauth"
65-
mv "/opt/2fauth-backup/.env" "/opt/2fauth/.env"
66-
mv "/opt/2fauth-backup/storage" "/opt/2fauth/storage"
67-
cd "/opt/2fauth" || return
68-
69-
chown -R www-data: "/opt/2fauth"
70-
chmod -R 755 "/opt/2fauth"
71-
72-
export COMPOSER_ALLOW_SUPERUSER=1
73-
$STD composer install --no-dev --prefer-source
74-
75-
php artisan 2fauth:install
76-
77-
$STD systemctl restart nginx
78-
79-
# Cleaning up
80-
msg_info "Cleaning Up"
81-
rm -rf "v${RELEASE}.zip"
82-
if dpkg -l | grep -q 'php8.2'; then
83-
$STD apt-get remove --purge -y php8.2*
84-
fi
85-
$STD apt-get -y autoremove
86-
$STD apt-get -y autoclean
87-
msg_ok "Cleanup Completed"
88-
89-
# Last Action
90-
echo "${RELEASE}" >/opt/2fauth_version.txt
91-
msg_ok "Updated $APP to ${RELEASE}"
92-
else
93-
msg_ok "No update required. ${APP} is already at ${RELEASE}"
61+
# Execute Update
62+
curl -fsSL -o "${RELEASE}.zip" "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip"
63+
$STD unzip "${RELEASE}.zip"
64+
mv "2FAuth-${RELEASE//v/}/" "/opt/2fauth"
65+
mv "/opt/2fauth-backup/.env" "/opt/2fauth/.env"
66+
mv "/opt/2fauth-backup/storage" "/opt/2fauth/storage"
67+
cd "/opt/2fauth" || return
68+
69+
chown -R www-data: "/opt/2fauth"
70+
chmod -R 755 "/opt/2fauth"
71+
72+
export COMPOSER_ALLOW_SUPERUSER=1
73+
$STD composer install --no-dev --prefer-source
74+
75+
php artisan 2fauth:install
76+
77+
$STD systemctl restart nginx
78+
79+
# Cleaning up
80+
msg_info "Cleaning Up"
81+
rm -rf "v${RELEASE}.zip"
82+
if dpkg -l | grep -q 'php8.2'; then
83+
$STD apt-get remove --purge -y php8.2*
9484
fi
95-
exit
85+
$STD apt-get -y autoremove
86+
$STD apt-get -y autoclean
87+
msg_ok "Cleanup Completed"
88+
89+
# Last Action
90+
echo "${RELEASE}" >/opt/2fauth_version.txt
91+
msg_ok "Updated $APP to ${RELEASE}"
92+
else
93+
msg_ok "No update required. ${APP} is already at ${RELEASE}"
94+
fi
95+
exit
9696
}
9797

9898
start
@@ -102,4 +102,4 @@ description
102102
msg_ok "Completed Successfully!\n"
103103
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
104104
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
105-
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:80${CL}"
105+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:80${CL}"

ct/adventurelog.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function update_script() {
3737
msg_info "Updating ${APP} to ${RELEASE}"
3838
mv /opt/adventurelog/ /opt/adventurelog-backup/
3939
curl -fsSL -o /opt/v${RELEASE}.zip "https://github.com/seanmorley15/AdventureLog/archive/refs/tags/v${RELEASE}.zip"
40-
unzip -q /opt/v${RELEASE}.zip -d /opt/
40+
$STD unzip /opt/v${RELEASE}.zip -d /opt/
4141
mv /opt/AdventureLog-${RELEASE} /opt/adventurelog
4242

4343
mv /opt/adventurelog-backup/backend/server/.env /opt/adventurelog/backend/server/.env
@@ -78,4 +78,4 @@ description
7878
msg_ok "Completed Successfully!\n"
7979
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
8080
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
81-
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
81+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"

ct/alpine-it-tools.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function update_script() {
3636
curl -fsSL -o it-tools.zip "$DOWNLOAD_URL"
3737
mkdir -p /usr/share/nginx/html
3838
rm -rf /usr/share/nginx/html/*
39-
unzip -q it-tools.zip -d /tmp/it-tools
39+
$STD unzip it-tools.zip -d /tmp/it-tools
4040
cp -r /tmp/it-tools/dist/* /usr/share/nginx/html
4141
rm -rf /tmp/it-tools
4242
rm -f it-tools.zip

ct/baikal.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function update_script() {
3737
cd /opt
3838
curl -fsSL "https://github.com/sabre-io/baikal/releases/download/${RELEASE}/baikal-${RELEASE}.zip" -o $(basename "https://github.com/sabre-io/baikal/releases/download/${RELEASE}/baikal-${RELEASE}.zip")
3939
mv /opt/baikal /opt/baikal-backup
40-
unzip -o -q "baikal-${RELEASE}.zip"
40+
$STD unzip -o "baikal-${RELEASE}.zip"
4141
cp -r /opt/baikal-backup/config/baikal.yaml /opt/baikal/config/
4242
cp -r /opt/baikal-backup/Specific/ /opt/baikal/
4343
chown -R www-data:www-data /opt/baikal/

ct/barcode-buddy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function update_script() {
3838
cd /opt
3939
mv /opt/barcodebuddy/ /opt/barcodebuddy-backup
4040
curl -fsSL "https://github.com/Forceu/barcodebuddy/archive/refs/tags/v${RELEASE}.zip" -o $(basename "https://github.com/Forceu/barcodebuddy/archive/refs/tags/v${RELEASE}.zip")
41-
unzip -q "v${RELEASE}.zip"
41+
$STD unzip "v${RELEASE}.zip"
4242
mv "/opt/barcodebuddy-${RELEASE}" /opt/barcodebuddy
4343
cp -r /opt/barcodebuddy-backup/data/. /opt/barcodebuddy/data
4444
chown -R www-data:www-data /opt/barcodebuddy/data

ct/bookstack.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function update_script() {
3636
msg_info "Updating ${APP} to v${RELEASE}"
3737
mv /opt/bookstack /opt/bookstack-backup
3838
curl -fsSL "https://github.com/BookStackApp/BookStack/archive/refs/tags/v${RELEASE}.zip" -o "/opt/BookStack-${RELEASE}.zip"
39-
unzip -q "/opt/BookStack-${RELEASE}.zip" -d /opt
39+
$STD unzip "/opt/BookStack-${RELEASE}.zip" -d /opt
4040
mv "/opt/BookStack-${RELEASE}" /opt/bookstack
4141
cp /opt/bookstack-backup/.env /opt/bookstack/.env
4242
[[ -d /opt/bookstack-backup/public/uploads ]] && cp -a /opt/bookstack-backup/public/uploads/. /opt/bookstack/public/uploads/

ct/commafeed.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function update_script() {
4242

4343
msg_info "Updating ${APP} to ${RELEASE}"
4444
curl -fsSL "https://github.com/Athou/commafeed/releases/download/${RELEASE}/commafeed-${RELEASE}-h2-jvm.zip" -o $(basename "https://github.com/Athou/commafeed/releases/download/${RELEASE}/commafeed-${RELEASE}-h2-jvm.zip")
45-
unzip -q commafeed-"${RELEASE}"-h2-jvm.zip
45+
$STD unzip commafeed-"${RELEASE}"-h2-jvm.zip
4646
rsync -a --exclude 'data/' commafeed-"${RELEASE}"-h2/ /opt/commafeed/
4747
rm -rf commafeed-"${RELEASE}"-h2 commafeed-"${RELEASE}"-h2-jvm.zip
4848
echo "${RELEASE}" >/opt/${APP}_version.txt

ct/crafty-controller.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function update_script() {
4646

4747
msg_info "Updating Crafty-Controller to v${RELEASE}"
4848
curl -fsSL "https://gitlab.com/crafty-controller/crafty-4/-/archive/v${RELEASE}/crafty-4-v${RELEASE}.zip" -o $(basename "https://gitlab.com/crafty-controller/crafty-4/-/archive/v${RELEASE}/crafty-4-v${RELEASE}.zip")
49-
unzip -q crafty-4-v${RELEASE}.zip
49+
$STD unzip crafty-4-v${RELEASE}.zip
5050
cp -a crafty-4-v${RELEASE}/. /opt/crafty-controller/crafty/crafty-4/
5151
rm -rf crafty-4-v${RELEASE}
5252
cd /opt/crafty-controller/crafty/crafty-4

ct/documenso.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function update_script() {
3838
rm -rf /opt/documenso
3939
cd /opt
4040
curl -fsSL "https://github.com/documenso/documenso/archive/refs/tags/v${RELEASE}.zip" -o v${RELEASE}.zip
41-
unzip -q v${RELEASE}.zip
41+
$STD unzip v${RELEASE}.zip
4242
mv documenso-${RELEASE} /opt/documenso
4343
cd /opt/documenso
4444
mv /opt/.env /opt/documenso/.env

ct/fileflows.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function update_script() {
4747
msg_info "Updating $APP to latest version"
4848
temp_file=$(mktemp)
4949
curl -fsSL https://fileflows.com/downloads/zip -o "$temp_file"
50-
unzip -oq -d /opt/fileflows "$temp_file"
50+
$STD unzip -o -d /opt/fileflows "$temp_file"
5151
msg_ok "Updated $APP to latest version"
5252

5353
msg_info "Starting $APP"

0 commit comments

Comments
 (0)