Skip to content

Commit b7e951f

Browse files
authored
Various unrelated fixes to kimai update script (#4549)
* Ensure lsb-release is installed Fixes 4548 * Change to use same syntax as check for composer There's a proposed solution to #4247 (which doesn't seem to have been committed - I'll fix that in a moment). I've changed the test I'm using to match that suggestion. * Re-install composer See #4550 * Try to catch download errors During troubleshooting of another error, I ran into a condition where downloading the new version failed. It seems that this is because the earlier call to get the $RELEASE had failed. This change is an attempt to catch download errors, and alert the user, and to not rm the existing install until we know the download worked. * Re-install php-fpm I missed in the earlier commit that this wasn't getting reinstalled
1 parent f735e37 commit b7e951f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

ct/kimai.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ function update_script() {
2323
header_info
2424
check_container_storage
2525
check_container_resources
26+
if ! command -v lsb_release; then
27+
apt install -y lsb-release
28+
fi
2629
if [[ ! -d /opt/kimai ]]; then
2730
msg_error "No ${APP} Installation Found!"
2831
exit
@@ -36,8 +39,8 @@ function update_script() {
3639
$STD apt-get update
3740
$STD apt-get remove -y php"${CURRENT_PHP//./}"*
3841
$STD apt-get install -y \
39-
php8.4 \
40-
php8.4-{gd,mysql,mbstring,bcmath,xml,curl,zip,intl} \
42+
php8.4 composer \
43+
php8.4-{gd,mysql,mbstring,bcmath,xml,curl,zip,intl,fpm} \
4144
libapache2-mod-php8.4
4245
msg_ok "Migrated PHP $CURRENT_PHP to 8.4"
4346
fi
@@ -58,9 +61,13 @@ function update_script() {
5861
msg_ok "Backup completed"
5962

6063
msg_info "Updating ${APP} to ${RELEASE}"
61-
rm -rf /opt/kimai
64+
trap "echo Unable to download release file for version ${RELEASE}; try again later" ERR
65+
set -e
6266
curl -fsSL "https://github.com/kimai/kimai/archive/refs/tags/${RELEASE}.zip" -o $(basename "https://github.com/kimai/kimai/archive/refs/tags/${RELEASE}.zip")
6367
unzip -q "${RELEASE}".zip
68+
set +e
69+
trap - ERR
70+
rm -rf /opt/kimai
6471
mv kimai-"${RELEASE}" /opt/kimai
6572
[ -d "$BACKUP_DIR/var" ] && cp -r "$BACKUP_DIR/var" /opt/kimai/
6673
[ -f "$BACKUP_DIR/.env" ] && cp "$BACKUP_DIR/.env" /opt/kimai/

0 commit comments

Comments
 (0)