This commit is contained in:
CanbiZ 2025-09-05 09:03:10 +02:00
parent 584ea1f11c
commit e5ef51e69d
3 changed files with 26 additions and 18 deletions

View File

@ -1,6 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG # Copyright (c) 2021-2025 community-scripts ORG
# Author: Stroopwafe1 # Author: Stroopwafe1
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
@ -25,16 +24,31 @@ function update_script() {
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -d /opt/${APP} ]]; then if [[ ! -d /opt/leantime ]]; then
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
msg_info "Creating Backup" if check_for_gh_release "leantime" "Leantime/leantime"; then
mariadb-dump leantime >"/opt/${APP}_db_backup_$(date +%F).sql" msg_info "Creating Backup"
tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" "/opt/${APP}" mariadb-dump leantime >"/opt/${APP}_db_backup_$(date +%F).sql"
msg_ok "Backup Created" tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" "/opt/${APP}"
fetch_and_deploy_gh_release "$APP" "Leantime/leantime" "prebuild" "latest" "/opt/${APP}" Leantime-v[0-9].[0-9].[0-9].tar.gz 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 exit
} }

View File

@ -36,7 +36,6 @@ fetch_and_deploy_gh_release "leantime" "Leantime/leantime" "prebuild" "latest" "
msg_info "Setup Leantime" msg_info "Setup Leantime"
chown -R www-data:www-data "/opt/leantime" chown -R www-data:www-data "/opt/leantime"
chmod -R 750 "/opt/leantime" chmod -R 750 "/opt/leantime"
cat <<EOF >/etc/apache2/sites-enabled/000-default.conf cat <<EOF >/etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80> <VirtualHost *:80>
ServerAdmin webmaster@localhost ServerAdmin webmaster@localhost
@ -58,19 +57,17 @@ cat <<EOF >/etc/apache2/sites-enabled/000-default.conf
CustomLog /var/log/apache2/access.log combined CustomLog /var/log/apache2/access.log combined
</VirtualHost> </VirtualHost>
EOF EOF
mv "/opt/leantime/config/sample.env" "/opt/leantime/config/.env" mv "/opt/leantime/config/sample.env" "/opt/leantime/config/.env"
sed -i -e "s|^LEAN_DB_DATABASE.*|LEAN_DB_DATABASE = '$DB_NAME'|" \ 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_USER.*|LEAN_DB_USER = '$DB_USER'|" \
-e "s|^LEAN_DB_PASSWORD.*|LEAN_DB_PASSWORD = '$DB_PASS'|" \ -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)'|" \ -e "s|^LEAN_SESSION_PASSWORD.*|LEAN_SESSION_PASSWORD = '$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)'|" \
"/opt/leantime/config/.env" "/opt/leantime/config/.env"
$STD a2enmod -q proxy_fcgi setenvif rewrite $STD a2enmod -q proxy_fcgi setenvif rewrite
$STD a2enconf -q "php8.4-fpm" $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" 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 systemctl restart apache2
msg_ok "Setup ${APPLICATION}" msg_ok "Setup leantime"
motd_ssh motd_ssh
customize customize

View File

@ -782,10 +782,9 @@ advanced_settings() {
fi fi
# --- SSH key provisioning (one dialog) --- # --- 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" : >"$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') IFS=$'\0' read -r -d '' -a _def_files < <(ssh_discover_default_files && printf '\0')
ssh_build_choices_from_files "${_def_files[@]}" ssh_build_choices_from_files "${_def_files[@]}"
DEF_KEYS_COUNT="$COUNT" DEF_KEYS_COUNT="$COUNT"
@ -806,9 +805,8 @@ advanced_settings() {
case "$SSH_KEY_MODE" in case "$SSH_KEY_MODE" in
found) found)
# Checkliste einzelner Keys
SEL=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "SELECT HOST 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 for tag in $SEL; do
tag="${tag%\"}" tag="${tag%\"}"
tag="${tag#\"}" tag="${tag#\"}"
@ -825,7 +823,6 @@ advanced_settings() {
GLOB_PATH="$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" \ 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)" --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 if [[ -n "$GLOB_PATH" ]]; then
# expandiere Globs
shopt -s nullglob shopt -s nullglob
read -r -a _scan_files <<<"$GLOB_PATH" read -r -a _scan_files <<<"$GLOB_PATH"
shopt -u nullglob shopt -u nullglob
@ -851,13 +848,13 @@ advanced_settings() {
none) : ;; none) : ;;
esac esac
# Dedupe + sauberer EOF # Dedupe + clean EOF
if [[ -s "$SSH_KEYS_FILE" ]]; then if [[ -s "$SSH_KEYS_FILE" ]]; then
sort -u -o "$SSH_KEYS_FILE" "$SSH_KEYS_FILE" sort -u -o "$SSH_KEYS_FILE" "$SSH_KEYS_FILE"
printf '\n' >>"$SSH_KEYS_FILE" printf '\n' >>"$SSH_KEYS_FILE"
fi fi
# SSH aktivieren, wenn Keys oder PW # SSH activate, if keys found or password set
if [[ -s "$SSH_KEYS_FILE" || "$PW" == -password* ]]; then 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 if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --defaultno --title "SSH ACCESS" --yesno "Enable root SSH access?" 10 58); then
SSH="yes" SSH="yes"