Skip to content

Commit 0373324

Browse files
authored
FIx a bug in update procedure and general code maintenance (#3974)
1 parent 3297df1 commit 0373324

File tree

2 files changed

+40
-41
lines changed

2 files changed

+40
-41
lines changed

ct/wger.sh

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,46 +20,45 @@ color
2020
catch_errors
2121

2222
function update_script() {
23-
header_info
24-
check_container_storage
25-
check_container_resources
26-
if [[ ! -d /home/wger ]]; then
27-
msg_error "No ${APP} Installation Found!"
28-
exit
29-
fi
30-
RELEASE=$(curl -fsSL https://api.github.com/repos/wger-project/wger/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')
31-
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
32-
msg_info "Stopping $APP"
33-
systemctl stop wger
34-
msg_ok "Stopped $APP"
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
if [[ ! -d /home/wger ]]; then
27+
msg_error "No ${APP} Installation Found!"
28+
exit
29+
fi
30+
RELEASE=$(curl -fsSL https://api.github.com/repos/wger-project/wger/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')
31+
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
32+
msg_info "Stopping $APP"
33+
systemctl stop wger
34+
msg_ok "Stopped $APP"
3535

36-
msg_info "Updating $APP to v${RELEASE}"
37-
temp_file=$(mktemp)
38-
cd $temp_file
39-
curl -fsSL "https://github.com/wger-project/wger/archive/refs/tags/$RELEASE.tar.gz" -o "$temp_file"
40-
tar xzf $temp_file
41-
cp -rf wger-$RELEASE/* /home/wger/src
42-
cd /home/wger/src
43-
python3 manage.py migrate &>/dev/null
44-
yarn install &>/dev/null
45-
yarn build:css:sass &>/dev/null
46-
python3 manage.py collectstatic --noinput &>/dev/null
47-
echo "${RELEASE}" >/opt/${APP}_version.txt
48-
msg_ok "Updated $APP to v${RELEASE}"
36+
msg_info "Updating $APP to v${RELEASE}"
37+
temp_file=$(mktemp)
38+
curl -fsSL "https://github.com/wger-project/wger/archive/refs/tags/$RELEASE.tar.gz" -o "$temp_file"
39+
tar xzf "$temp_file"
40+
cp -rf wger-"$RELEASE"/* /home/wger/src
41+
cd /home/wger/src
42+
python3 manage.py migrate &>/dev/null
43+
yarn install &>/dev/null
44+
yarn build:css:sass &>/dev/null
45+
python3 manage.py collectstatic --noinput &>/dev/null
46+
echo "${RELEASE}" >/opt/${APP}_version.txt
47+
msg_ok "Updated $APP to v${RELEASE}"
4948

50-
msg_info "Starting $APP"
51-
systemctl start wger
52-
msg_ok "Started $APP"
49+
msg_info "Starting $APP"
50+
systemctl start wger
51+
msg_ok "Started $APP"
5352

54-
msg_info "Cleaning Up"
55-
rm -rf $temp_file
56-
msg_ok "Cleanup Completed"
53+
msg_info "Cleaning Up"
54+
rm -rf "$temp_file"
55+
msg_ok "Cleanup Completed"
5756

58-
msg_ok "Update Successful"
59-
else
60-
msg_ok "No update required. ${APP} is already at v${RELEASE}"
61-
fi
62-
exit
57+
msg_ok "Update Successful"
58+
else
59+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
60+
fi
61+
exit
6362
}
6463

6564
start
@@ -69,4 +68,4 @@ description
6968
msg_ok "Completed Successfully!\n"
7069
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
7170
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
72-
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
71+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"

install/wger-install.sh

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

1616
msg_info "Installing Dependencies"
1717
$STD apt-get install -y \
18-
git \
19-
gnupg \
20-
apache2 \
21-
libapache2-mod-wsgi-py3
18+
git \
19+
gnupg \
20+
apache2 \
21+
libapache2-mod-wsgi-py3
2222
msg_ok "Installed Dependencies"
2323

2424
msg_info "Installing Python"

0 commit comments

Comments
 (0)