diff --git a/ct/iobroker.sh b/ct/iobroker.sh index faf0d255507..ca3fecfd0ba 100644 --- a/ct/iobroker.sh +++ b/ct/iobroker.sh @@ -11,7 +11,7 @@ var_cpu="${var_cpu:-2}" var_ram="${var_ram:-2048}" var_disk="${var_disk:-8}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" @@ -20,18 +20,18 @@ color catch_errors function update_script() { - header_info - check_container_storage - check_container_resources - if [[ ! -d /opt/iobroker ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi - msg_info "Updating ${APP} LXC" - $STD apt-get update - $STD apt-get -y upgrade - msg_ok "Updated Successfully" + header_info + check_container_storage + check_container_resources + if [[ ! -d /opt/iobroker ]]; then + msg_error "No ${APP} Installation Found!" exit + fi + msg_info "Updating ${APP} LXC" + $STD apt update + $STD apt -y upgrade + msg_ok "Updated Successfully" + exit } start @@ -41,4 +41,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}http://${IP}:8081${CL}" \ No newline at end of file +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8081${CL}" diff --git a/ct/itsm-ng.sh b/ct/itsm-ng.sh index 81195c67dbc..ced75c81e36 100644 --- a/ct/itsm-ng.sh +++ b/ct/itsm-ng.sh @@ -11,7 +11,7 @@ var_cpu="${var_cpu:-2}" var_ram="${var_ram:-2048}" var_disk="${var_disk:-10}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" @@ -29,11 +29,10 @@ function update_script() { exit 1 fi - msg_info "Updating ${APP} LXC" + msg_info "Updating LXC" $STD apt-get update $STD apt-get -y upgrade - msg_ok "Updated Successfully" - + msg_ok "Updated Successfully!" exit } diff --git a/ct/iventoy.sh b/ct/iventoy.sh index 97cb5e82a95..375e06a56ff 100644 --- a/ct/iventoy.sh +++ b/ct/iventoy.sh @@ -11,7 +11,7 @@ var_disk="${var_disk:-2}" var_cpu="${var_cpu:-1}" var_ram="${var_ram:-512}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-0}" header_info "$APP" @@ -38,4 +38,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}http://${IP}:26000${CL}" \ No newline at end of file +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:26000${CL}" diff --git a/ct/jackett.sh b/ct/jackett.sh index 2353724d7df..66fe4762392 100644 --- a/ct/jackett.sh +++ b/ct/jackett.sh @@ -28,24 +28,24 @@ function update_script() { exit fi - if [ ! -f /opt/.env ]; then - sed -i 's|^Environment="DisableRootWarning=true"$|EnvironmentFile="/opt/.env"|' /etc/systemd/system/jackett.service - cat </opt/.env + if check_for_gh_release "Jackett" "Jackett/Jackett"; then + if [ ! -f /opt/.env ]; then + sed -i 's|^Environment="DisableRootWarning=true"$|EnvironmentFile="/opt/.env"|' /etc/systemd/system/jackett.service + cat </opt/.env DisableRootWarning=true EOF - fi - if check_for_gh_release "Jackett" "Jackett/Jackett"; then + fi + msg_info "Stopping Service" systemctl stop jackett msg_ok "Stopped Service" - rm -rf /opt/Jackett - fetch_and_deploy_gh_release "jackett" "Jackett/Jackett" "prebuild" "latest" "/opt/Jackett" "Jackett.Binaries.LinuxAMDx64.tar.gz" + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "jackett" "Jackett/Jackett" "prebuild" "latest" "/opt/Jackett" "Jackett.Binaries.LinuxAMDx64.tar.gz" msg_info "Starting Service" systemctl start jackett msg_ok "Started Service" - msg_ok "Updated Successfully" + msg_ok "Updated Successfully!" fi exit } diff --git a/ct/jenkins.sh b/ct/jenkins.sh index 52000b1e7d2..75a41f9239a 100644 --- a/ct/jenkins.sh +++ b/ct/jenkins.sh @@ -11,7 +11,7 @@ var_cpu="${var_cpu:-2}" var_ram="${var_ram:-1024}" var_disk="${var_disk:-4}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" @@ -20,18 +20,22 @@ color catch_errors function update_script() { - header_info - check_container_storage - check_container_resources - if [[ ! -d /var/lib/jenkins ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi - msg_info "Updating $APP LXC" - $STD apt-get update - $STD apt-get -y upgrade - msg_ok "Updated $APP LXC" + header_info + check_container_storage + check_container_resources + if [[ ! -d /var/lib/jenkins ]]; then + msg_error "No ${APP} Installation Found!" exit + fi + + JAVA_VERSION="21" setup_java + + msg_info "Updating Jenkings" + $STD apt update + $STD apt -y upgrade + msg_ok "Updated Jenkins" + msg_ok "Update Successfully!" + exit } start @@ -41,4 +45,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}http://${IP}:8080${CL}" \ No newline at end of file +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080${CL}" diff --git a/ct/joplin-server.sh b/ct/joplin-server.sh index 7b1d8702713..388f9fb435a 100644 --- a/ct/joplin-server.sh +++ b/ct/joplin-server.sh @@ -11,7 +11,7 @@ var_cpu="${var_cpu:-2}" var_ram="${var_ram:-4096}" var_disk="${var_disk:-20}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" @@ -35,19 +35,18 @@ function update_script() { fetch_and_deploy_gh_release "joplin-server" "laurent22/joplin" "tarball" "latest" - msg_info "Updating ${APP}" + msg_info "Updating Joplin-Server" cd /opt/joplin-server sed -i "/onenote-converter/d" packages/lib/package.json $STD yarn config set --home enableTelemetry 0 export BUILD_SEQUENCIAL=1 $STD yarn install --inline-builds - msg_ok "Updated ${APP}" + msg_ok "Updated Joplin-Server" msg_info "Starting Services" systemctl start joplin-server msg_ok "Started Services" - - msg_ok "Updated Successfully" + msg_ok "Updated Successfully!" fi exit } diff --git a/ct/kapowarr.sh b/ct/kapowarr.sh index b77b9c7a26d..b922ec022ee 100644 --- a/ct/kapowarr.sh +++ b/ct/kapowarr.sh @@ -11,7 +11,7 @@ var_cpu="${var_cpu:-1}" var_ram="${var_ram:-256}" var_disk="${var_disk:-2}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" @@ -32,9 +32,9 @@ function update_script() { setup_uv if check_for_gh_release "kapowarr" "Casvt/Kapowarr"; then - msg_info "Stopping $APP" + msg_info "Stopping Service" systemctl stop kapowarr - msg_ok "Stopped $APP" + msg_ok "Stopped Service" msg_info "Creating Backup" mv /opt/kapowarr/db /opt/ @@ -42,14 +42,14 @@ function update_script() { fetch_and_deploy_gh_release "kapowarr" "Casvt/Kapowarr" - msg_info "Updating $APP" + msg_info "Updating Kapowarr" mv /opt/db /opt/kapowarr - msg_ok "Updated $APP" + msg_ok "Updated Kapowarr" - msg_info "Starting $APP" + msg_info "Starting Service" systemctl start kapowarr - msg_ok "Started $APP" - msg_ok "Update Successful" + msg_ok "Started Service" + msg_ok "Update Successfully!" fi exit } diff --git a/ct/karakeep.sh b/ct/karakeep.sh index 057568f2229..e849dd1237e 100644 --- a/ct/karakeep.sh +++ b/ct/karakeep.sh @@ -11,7 +11,7 @@ var_cpu="${var_cpu:-2}" var_ram="${var_ram:-4096}" var_disk="${var_disk:-10}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" @@ -38,14 +38,11 @@ function update_script() { msg_ok "Updated yt-dlp" msg_info "Prepare update" - if [[ -f /opt/${APP}_version.txt && "$(cat /opt/${APP}_version.txt)" < "0.23.0" ]]; then - $STD apt-get install -y graphicsmagick ghostscript - fi + $STD apt install -y graphicsmagick ghostscript if [[ -f /opt/karakeep/.env ]] && [[ ! -f /etc/karakeep/karakeep.env ]]; then mkdir -p /etc/karakeep mv /opt/karakeep/.env /etc/karakeep/karakeep.env fi - rm -rf /opt/karakeep msg_ok "Update prepared" if grep -q "start:prod" /etc/systemd/system/karakeep-workers.service; then @@ -65,7 +62,7 @@ function update_script() { MODULE_VERSION="$(jq -r '.packageManager | split("@")[1]' /opt/karakeep/package.json)" NODE_VERSION="22" NODE_MODULE="pnpm@${MODULE_VERSION}" setup_nodejs - msg_info "Updating ${APP}" + msg_info "Updating Karakeep" corepack enable export PUPPETEER_SKIP_DOWNLOAD="true" export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD="true" @@ -86,17 +83,18 @@ function update_script() { $STD pnpm migrate $STD pnpm store prune sed -i "s/^SERVER_VERSION=.*$/SERVER_VERSION=${CHECK_UPDATE_RELEASE}/" /etc/karakeep/karakeep.env - msg_ok "Updated ${APP}" + msg_ok "Updated Karakeep" msg_info "Starting Services" systemctl start karakeep-browser karakeep-workers karakeep-web msg_ok "Started Services" msg_info "Cleaning up" - $STD apt-get autoremove -y - $STD apt-get autoclean -y + $STD apt autoremove -y + $STD apt autoclean -y + $STD apt clean -y msg_ok "Cleaned" - msg_ok "Updated Successfully" + msg_ok "Updated Successfully!" fi exit } diff --git a/ct/kasm.sh b/ct/kasm.sh index 0d7666bdbc6..d40b5cfad8f 100644 --- a/ct/kasm.sh +++ b/ct/kasm.sh @@ -11,7 +11,7 @@ var_cpu="${var_cpu:-2}" var_ram="${var_ram:-8192}" var_disk="${var_disk:-30}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-0}" var_fuse="${var_fuse:-yes}" var_tun="${var_tun:-yes}" @@ -29,10 +29,10 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - msg_info "Updating $APP LXC" - $STD apt-get update - $STD apt-get -y upgrade - msg_ok "Updated $APP LXC" + msg_info "Updating LXC" + $STD apt update + $STD apt -y upgrade + msg_ok "Updated LXC" exit } diff --git a/ct/keycloak.sh b/ct/keycloak.sh index be634d4a77a..921b72060e6 100644 --- a/ct/keycloak.sh +++ b/ct/keycloak.sh @@ -11,7 +11,7 @@ var_cpu="${var_cpu:-2}" var_ram="${var_ram:-2048}" var_disk="${var_disk:-4}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" @@ -28,9 +28,9 @@ function update_script() { exit fi if check_for_gh_release "keycloak_app" "keycloak/keycloak"; then - msg_info "Stopping Keycloak" + msg_info "Stopping Service" systemctl stop keycloak - msg_ok "Stopped Keycloak" + msg_ok "Stopped Service" msg_info "Updating packages" $STD apt-get update @@ -44,16 +44,16 @@ function update_script() { fetch_and_deploy_gh_release "keycloak_app" "keycloak/keycloak" "prebuild" "latest" "/opt/keycloak" "keycloak-*.tar.gz" - msg_info "Updating ${APP}" + msg_info "Updating Keycloak" cd /opt cp -a keycloak.old/conf/. keycloak/conf/ cp -a keycloak.old/providers/. keycloak/providers/ 2>/dev/null || true cp -a keycloak.old/themes/. keycloak/themes/ 2>/dev/null || true - msg_ok "Updated ${APP} LXC" + msg_ok "Updated Keycloak" - msg_info "Restarting Keycloak" + msg_info "Restarting Service" systemctl restart keycloak - msg_ok "Restarted Keycloak" + msg_ok "Restarted Service" msg_info "Cleaning up" rm -rf keycloak.old diff --git a/ct/kimai.sh b/ct/kimai.sh index 60c3a8afed7..e0bdda57290 100644 --- a/ct/kimai.sh +++ b/ct/kimai.sh @@ -30,25 +30,13 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - CURRENT_PHP=$(php -v 2>/dev/null | awk '/^PHP/{print $2}' | cut -d. -f1,2) - if [[ "$CURRENT_PHP" != "8.4" ]]; then - msg_info "Migrating PHP $CURRENT_PHP to 8.4" - $STD curl -fsSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb - $STD dpkg -i /tmp/debsuryorg-archive-keyring.deb - $STD sh -c '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' - $STD apt-get update - $STD apt-get remove -y php"${CURRENT_PHP//./}"* - $STD apt-get install -y \ - php8.4 composer \ - php8.4-{gd,mysql,mbstring,bcmath,xml,curl,zip,intl,fpm} \ - libapache2-mod-php8.4 - msg_ok "Migrated PHP $CURRENT_PHP to 8.4" - fi - RELEASE=$(curl -fsSL https://api.github.com/repos/kimai/kimai/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') - BACKUP_DIR="/opt/kimai_backup" + PHP_VERSION="8.4" PHP_MODULE="mysql" PHP_APACHE="YES" setup_php + setup_composer + + if check_for_gh_release "koillection" "benjaminjonard/koillection"; then + BACKUP_DIR="/opt/kimai_backup" - if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then msg_info "Stopping Apache2" systemctl stop apache2 msg_ok "Stopped Apache2" @@ -60,15 +48,9 @@ function update_script() { [ -f /opt/kimai/config/packages/local.yaml ] && cp /opt/kimai/config/packages/local.yaml "$BACKUP_DIR/" msg_ok "Backup completed" - msg_info "Updating ${APP} to ${RELEASE}" - trap "echo Unable to download release file for version ${RELEASE}; try again later" ERR - set -e - curl -fsSL "https://github.com/kimai/kimai/archive/refs/tags/${RELEASE}.zip" -o $(basename "https://github.com/kimai/kimai/archive/refs/tags/${RELEASE}.zip") - $STD unzip "${RELEASE}".zip - set +e - trap - ERR - rm -rf /opt/kimai - mv kimai-"${RELEASE}" /opt/kimai + fetch_and_deploy_gh_release "kimai" "kimai/kimai" + + msg_info "Updating Kimai" [ -d "$BACKUP_DIR/var" ] && cp -r "$BACKUP_DIR/var" /opt/kimai/ [ -f "$BACKUP_DIR/.env" ] && cp "$BACKUP_DIR/.env" /opt/kimai/ [ -f "$BACKUP_DIR/local.yaml" ] && cp "$BACKUP_DIR/local.yaml" /opt/kimai/config/packages/ @@ -76,8 +58,7 @@ function update_script() { cd /opt/kimai $STD composer install --no-dev --optimize-autoloader $STD bin/console kimai:update - echo "${RELEASE}" >/opt/${APP}_version.txt - msg_ok "Updated ${APP} to ${RELEASE}" + msg_ok "Updated Kimai" msg_info "Starting Apache2" systemctl start apache2 @@ -92,12 +73,9 @@ function update_script() { msg_ok "Setup Permissions" msg_info "Cleaning Up" - rm -rf "${RELEASE}".zip rm -rf "$BACKUP_DIR" msg_ok "Cleaned" - msg_ok "Updated Successfully" - else - msg_ok "No update required. ${APP} is already at ${RELEASE}" + msg_ok "Updated Successfully!" fi exit } diff --git a/ct/koillection.sh b/ct/koillection.sh index b2e04e6a7a8..c7ceae2f576 100644 --- a/ct/koillection.sh +++ b/ct/koillection.sh @@ -11,7 +11,7 @@ var_cpu="${var_cpu:-2}" var_ram="${var_ram:-1024}" var_disk="${var_disk:-8}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" @@ -38,7 +38,7 @@ function update_script() { fetch_and_deploy_gh_release "koillection" "benjaminjonard/koillection" - msg_info "Updating ${APP}" + msg_info "Updating Koillection" cd /opt/koillection cp -r /opt/koillection-backup/.env.local /opt/koillection cp -r /opt/koillection-backup/public/uploads/. /opt/koillection/public/uploads/ @@ -50,7 +50,7 @@ function update_script() { $STD yarn install $STD yarn build chown -R www-data:www-data /opt/koillection/public/uploads - msg_ok "Updated $APP" + msg_ok "Updated Koillection" msg_info "Starting Service" systemctl start apache2 @@ -59,7 +59,7 @@ function update_script() { msg_info "Cleaning up" rm -r /opt/koillection-backup msg_ok "Cleaned" - msg_ok "Updated Successfully" + msg_ok "Updated Successfully!" fi exit } diff --git a/ct/kometa.sh b/ct/kometa.sh index acd37648440..13aaf24654f 100644 --- a/ct/kometa.sh +++ b/ct/kometa.sh @@ -37,7 +37,7 @@ function update_script() { cp /opt/kometa/config/config.yml /opt msg_ok "Backup completed" - PYTHON_VERSION="3.12" setup_uv + PYTHON_VERSION="3.13" setup_uv fetch_and_deploy_gh_release "kometa" "Kometa-Team/Kometa" msg_info "Updating Kometa" @@ -49,7 +49,7 @@ function update_script() { msg_info "Starting Service" systemctl start kometa msg_ok "Started Service" - msg_ok "Update Successful" + msg_ok "Update Successfully!" fi exit } diff --git a/ct/komga.sh b/ct/komga.sh index c6e3c1c6677..ba6a6028144 100644 --- a/ct/komga.sh +++ b/ct/komga.sh @@ -39,7 +39,7 @@ function update_script() { msg_info "Starting Service" systemctl start komga msg_ok "Started Service" - msg_ok "Updated Successfully" + msg_ok "Updated Successfully!" fi exit } diff --git a/ct/komodo.sh b/ct/komodo.sh index f70d974ac4f..d3c793f51fd 100644 --- a/ct/komodo.sh +++ b/ct/komodo.sh @@ -11,7 +11,7 @@ var_cpu="${var_cpu:-2}" var_ram="${var_ram:-2048}" var_disk="${var_disk:-10}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" @@ -29,7 +29,7 @@ function update_script() { exit 1 } - msg_info "Updating ${APP}" + msg_info "Updating Komodo" COMPOSE_FILE=$(find /opt/komodo -maxdepth 1 -type f -name '*.compose.yaml' ! -name 'compose.env' | head -n1) if [[ -z "$COMPOSE_FILE" ]]; then msg_error "No valid compose file found in /opt/komodo!" @@ -61,7 +61,7 @@ function update_script() { fi $STD docker compose -p komodo -f "$COMPOSE_FILE" --env-file /opt/komodo/compose.env pull $STD docker compose -p komodo -f "$COMPOSE_FILE" --env-file /opt/komodo/compose.env up -d - msg_ok "Updated ${APP}" + msg_ok "Updated Komodo" exit } diff --git a/ct/kubo.sh b/ct/kubo.sh index c4477d6b6dc..35a7b011436 100644 --- a/ct/kubo.sh +++ b/ct/kubo.sh @@ -11,7 +11,7 @@ var_cpu="${var_cpu:-2}" var_ram="${var_ram:-4096}" var_disk="${var_disk:-4}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" @@ -37,7 +37,7 @@ function update_script() { msg_info "Starting service" systemctl start ipfs msg_ok "Service started" - msg_ok "Updated successfully" + msg_ok "Updated successfully!" fi exit } diff --git a/install/kimai-install.sh b/install/kimai-install.sh index d4462f4c066..c9a69438b03 100644 --- a/install/kimai-install.sh +++ b/install/kimai-install.sh @@ -14,40 +14,25 @@ network_check update_os msg_info "Installing Dependencies" -$STD apt-get install -y \ +$STD apt install -y \ apt-transport-https \ apache2 \ git \ - expect \ - composer \ - lsb-release + expect msg_ok "Installed Dependencies" -setup_mysql - -msg_info "Adding PHP8.4 Repository" -$STD curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb -$STD dpkg -i /tmp/debsuryorg-archive-keyring.deb -$STD sh -c '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' -$STD apt-get update -msg_ok "Added PHP8.4 Repository" - -msg_info "Installing PHP" -$STD apt-get remove -y php8.2* -$STD apt-get install -y \ - php8.4 \ - php8.4-{gd,mysql,mbstring,bcmath,xml,curl,zip,intl} \ - libapache2-mod-php8.4 -msg_ok "Installed PHP" +setup_mariadb +PHP_VERSION="8.4" PHP_MODULE="mysql" PHP_APACHE="YES" setup_php +setup_composer msg_info "Setting up database" DB_NAME=kimai_db DB_USER=kimai DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) -MYSQL_VERSION=$(mysql --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') -$STD mysql -u root -e "CREATE DATABASE $DB_NAME;" -$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';" -$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;" +MYSQL_VERSION=$(mariadb --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') +$STD mariadb -e "CREATE DATABASE $DB_NAME;" +$STD mariadb -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';" +$STD mariadb -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;" { echo "Kimai-Credentials" echo "Kimai Database User: $DB_USER" @@ -56,11 +41,9 @@ $STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH } >>~/kimai.creds msg_ok "Set up database" -msg_info "Installing Kimai (Patience)" -RELEASE=$(curl -fsSL https://api.github.com/repos/kimai/kimai/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') -curl -fsSL "https://github.com/kimai/kimai/archive/refs/tags/${RELEASE}.zip" -o "${RELEASE}".zip -$STD unzip "${RELEASE}".zip -mv kimai-"${RELEASE}" /opt/kimai +fetch_and_deploy_gh_release "kimai" "kimai/kimai" + +msg_info "Setup Kimai" cd /opt/kimai echo "export COMPOSER_ALLOW_SUPERUSER=1" >>~/.bashrc source ~/.bashrc @@ -92,8 +75,6 @@ admin_lte: options: default_avatar: build/apple-touch-icon.png EOF - -echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" msg_ok "Installed Kimai" msg_info "Creating Service" @@ -131,6 +112,7 @@ customize msg_info "Cleaning up" rm -rf "${RELEASE}".zip -$STD apt-get -y autoremove -$STD apt-get -y autoclean +$STD apt -y autoremove +$STD apt -y autoclean +$STD apt -y clean msg_ok "Cleaned" diff --git a/misc/tools.func b/misc/tools.func index 05604d51de2..60bb6b4d48e 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -1141,7 +1141,7 @@ function fetch_and_deploy_gh_release() { rm -rf "${target:?}/"* fi - tar --no-same-owner -xzf "$tmpdir/$filename" -C "$tmpdir" || { + tar --no-same-owner -xzf "$tmpdir/$filename" -C "$tmpdir" || { msg_error "Failed to extract tarball" rm -rf "$tmpdir" return 1