diff --git a/ct/leantime.sh b/ct/leantime.sh index f49c503a..6a029571 100644 --- a/ct/leantime.sh +++ b/ct/leantime.sh @@ -1,6 +1,5 @@ #!/usr/bin/env bash source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) - # Copyright (c) 2021-2025 community-scripts ORG # Author: Stroopwafe1 # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -25,16 +24,31 @@ function update_script() { check_container_storage check_container_resources - if [[ ! -d /opt/${APP} ]]; then + if [[ ! -d /opt/leantime ]]; then msg_error "No ${APP} Installation Found!" exit fi - msg_info "Creating Backup" - mariadb-dump leantime >"/opt/${APP}_db_backup_$(date +%F).sql" - tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" "/opt/${APP}" - msg_ok "Backup Created" - fetch_and_deploy_gh_release "$APP" "Leantime/leantime" "prebuild" "latest" "/opt/${APP}" Leantime-v[0-9].[0-9].[0-9].tar.gz + if check_for_gh_release "leantime" "Leantime/leantime"; then + msg_info "Creating Backup" + mariadb-dump leantime >"/opt/${APP}_db_backup_$(date +%F).sql" + tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" "/opt/${APP}" + mv /opt/leantime /opt/leantime_bak + msg_ok "Backup Created" + + fetch_and_deploy_gh_release "leantime" "Leantime/leantime" "prebuild" "latest" "/opt/leantime" Leantime*.tar.gz + + msg_info "Restoring Config & Permissions" + mv /opt/leantime_bak/config/.env /opt/leantime/config/.env + chown -R www-data:www-data "/opt/leantime" + chmod -R 750 "/opt/leantime" + msg_ok "Restored Config & Permissions" + + msg_info "Removing Backup" + rm -rf /opt/leantime_bak + msg_ok "Removed Backup" + msg_ok "Updated Successfully" + fi exit } diff --git a/install/leantime-install.sh b/install/leantime-install.sh index 8c72b30a..db67e925 100644 --- a/install/leantime-install.sh +++ b/install/leantime-install.sh @@ -36,7 +36,6 @@ fetch_and_deploy_gh_release "leantime" "Leantime/leantime" "prebuild" "latest" " msg_info "Setup Leantime" chown -R www-data:www-data "/opt/leantime" chmod -R 750 "/opt/leantime" - cat </etc/apache2/sites-enabled/000-default.conf ServerAdmin webmaster@localhost @@ -58,19 +57,17 @@ cat </etc/apache2/sites-enabled/000-default.conf CustomLog /var/log/apache2/access.log combined EOF - mv "/opt/leantime/config/sample.env" "/opt/leantime/config/.env" sed -i -e "s|^LEAN_DB_DATABASE.*|LEAN_DB_DATABASE = '$DB_NAME'|" \ -e "s|^LEAN_DB_USER.*|LEAN_DB_USER = '$DB_USER'|" \ -e "s|^LEAN_DB_PASSWORD.*|LEAN_DB_PASSWORD = '$DB_PASS'|" \ -e "s|^LEAN_SESSION_PASSWORD.*|LEAN_SESSION_PASSWORD = '$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)'|" \ "/opt/leantime/config/.env" - $STD a2enmod -q proxy_fcgi setenvif rewrite $STD a2enconf -q "php8.4-fpm" sed -i -e "s/^;extension.\(curl\|fileinfo\|gd\|intl\|ldap\|mbstring\|exif\|mysqli\|odbc\|openssl\|pdo_mysql\)/extension=\1/g" "/etc/php/8.4/apache2/php.ini" systemctl restart apache2 -msg_ok "Setup ${APPLICATION}" +msg_ok "Setup leantime" motd_ssh customize diff --git a/misc/build.func b/misc/build.func index 08ed7cc2..766aab33 100644 --- a/misc/build.func +++ b/misc/build.func @@ -782,10 +782,9 @@ advanced_settings() { fi # --- SSH key provisioning (one dialog) --- - SSH_KEYS_FILE="$(mktemp)" # ausgewählte Keys landen hier (eine Datei, mehrere Zeilen) + SSH_KEYS_FILE="$(mktemp)" : >"$SSH_KEYS_FILE" - # 2.1 Default-Files finden und ggf. Auswahl anbieten IFS=$'\0' read -r -d '' -a _def_files < <(ssh_discover_default_files && printf '\0') ssh_build_choices_from_files "${_def_files[@]}" DEF_KEYS_COUNT="$COUNT" @@ -806,9 +805,8 @@ advanced_settings() { case "$SSH_KEY_MODE" in found) - # Checkliste einzelner Keys SEL=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "SELECT HOST KEYS" \ - --checklist "Select one or more keys to import:" 20 78 10 "${CHOICES[@]}" 3>&1 1>&2 2>&3) || exit_script + --checklist "Select one or more keys to import:" 20 20 10 "${CHOICES[@]}" 3>&1 1>&2 2>&3) || exit_script for tag in $SEL; do tag="${tag%\"}" tag="${tag#\"}" @@ -825,7 +823,6 @@ advanced_settings() { GLOB_PATH="$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" \ --inputbox "Enter a folder or glob to scan (e.g. /root/.ssh/*.pub)" 10 72 --title "Scan Folder/Glob" 3>&1 1>&2 2>&3)" if [[ -n "$GLOB_PATH" ]]; then - # expandiere Globs shopt -s nullglob read -r -a _scan_files <<<"$GLOB_PATH" shopt -u nullglob @@ -851,13 +848,13 @@ advanced_settings() { none) : ;; esac - # Dedupe + sauberer EOF + # Dedupe + clean EOF if [[ -s "$SSH_KEYS_FILE" ]]; then sort -u -o "$SSH_KEYS_FILE" "$SSH_KEYS_FILE" printf '\n' >>"$SSH_KEYS_FILE" fi - # SSH aktivieren, wenn Keys oder PW + # SSH activate, if keys found or password set if [[ -s "$SSH_KEYS_FILE" || "$PW" == -password* ]]; then if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "SSH ACCESS" --yesno "Enable root SSH access?" 10 58); then SSH="yes"