core: Add config file handling options | Fix Vikunja update with interactive overwrite (#11317)

This commit is contained in:
CanbiZ (MickLesk)
2026-01-29 12:43:54 +01:00
committed by GitHub
parent e1f02bfa77
commit 8e7dc349ac
2 changed files with 19 additions and 1 deletions

View File

@@ -46,6 +46,20 @@ function update_script() {
fi
if check_for_gh_release "vikunja" "go-vikunja/vikunja"; then
echo
msg_warn "The package update may include config file changes."
echo -e "${TAB}${YW}How do you want to handle /etc/vikunja/config.yml?${CL}"
echo -e "${TAB} 1) Keep your current config"
echo -e "${TAB} 2) Install the new package maintainer's config"
read -rp " Choose [1/2] (default: 1): " -t 60 CONFIG_CHOICE || CONFIG_CHOICE="1"
[[ -z "$CONFIG_CHOICE" ]] && CONFIG_CHOICE="1"
if [[ "$CONFIG_CHOICE" == "2" ]]; then
export DPKG_FORCE_CONFNEW="1"
else
export DPKG_FORCE_CONFOLD="1"
fi
msg_info "Stopping Service"
systemctl stop vikunja
msg_ok "Stopped Service"

View File

@@ -1846,7 +1846,11 @@ function fetch_and_deploy_gh_release() {
chmod 644 "$tmpdir/$filename"
# SYSTEMD_OFFLINE=1 prevents systemd-tmpfiles failures in unprivileged LXC (Debian 13+/systemd 257+)
SYSTEMD_OFFLINE=1 $STD apt install -y "$tmpdir/$filename" || {
# Support DPKG_CONFOLD/DPKG_CONFNEW env vars for config file handling during .deb upgrades
local dpkg_opts=""
[[ "${DPKG_FORCE_CONFOLD:-}" == "1" ]] && dpkg_opts="-o Dpkg::Options::=--force-confold"
[[ "${DPKG_FORCE_CONFNEW:-}" == "1" ]] && dpkg_opts="-o Dpkg::Options::=--force-confnew"
DEBIAN_FRONTEND=noninteractive SYSTEMD_OFFLINE=1 $STD apt install -y $dpkg_opts "$tmpdir/$filename" || {
SYSTEMD_OFFLINE=1 $STD dpkg -i "$tmpdir/$filename" || {
msg_error "Both apt and dpkg installation failed"
rm -rf "$tmpdir"