diff options
author | nachoparker <nacho@ownyourbits.com> | 2019-07-08 14:07:25 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2019-07-08 14:18:05 +0300 |
commit | e74290d45ef2f19b4ff3eaec665eefd6dbb8d9e9 (patch) | |
tree | f4e49e2c25d7165dbb5d9155a8e4390274e45c49 | |
parent | 95a658f3fbe06ad9a95db66f7213607e228e5a8b (diff) |
update: add distro migration step
Signed-off-by: nachoparker <nacho@ownyourbits.com>
-rw-r--r-- | bin/ncp/UPDATES/unattended-upgrades.sh | 20 | ||||
-rwxr-xr-x | update.sh | 17 |
2 files changed, 28 insertions, 9 deletions
diff --git a/bin/ncp/UPDATES/unattended-upgrades.sh b/bin/ncp/UPDATES/unattended-upgrades.sh index 05ad218c..2466f203 100644 --- a/bin/ncp/UPDATES/unattended-upgrades.sh +++ b/bin/ncp/UPDATES/unattended-upgrades.sh @@ -1,37 +1,39 @@ #!/bin/bash -# Unattended upgrades installation on Raspbian +# Unattended upgrades installation on NextCloudPi # # Copyleft 2017 by Ignacio Nunez Hernanz <nacho _a_t_ ownyourbits _d_o_t_ com> # GPL licensed (see end of file) * Use at your own risk! # -# More at: ownyourbits.com +# More at: ownyourbits.com # install() { apt-get update - apt install -y --no-install-recommends unattended-upgrades + apt install -y --no-install-recommends unattended-upgrades rm -f /etc/apt/apt.conf.d/20auto-upgrades /etc/apt/apt.conf.d/02-armbian-periodic } -configure() -{ +configure() +{ + source etc/library.sh # sets RELEASE + [[ $ACTIVE == "yes" ]] && local AUTOUPGRADE=1 || local AUTOUPGRADE=0 [[ $AUTOREBOOT == "yes" ]] && local AUTOREBOOT=true || local AUTOREBOOT=false cat > /etc/apt/apt.conf.d/20ncp-upgrades <<EOF APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Unattended-Upgrade "$AUTOUPGRADE"; -APT::Periodic::MaxAge "14"; +APT::Periodic::MaxAge "14"; APT::Periodic::AutocleanInterval "7"; Unattended-Upgrade::Automatic-Reboot "$AUTOREBOOT"; Unattended-Upgrade::Automatic-Reboot-Time "04:00"; Unattended-Upgrade::Origins-Pattern { -o=Debian,n=stretch; -o=deb.sury.org,n=stretch; -o="Raspberry Pi Foundation",n=stretch; +o=Debian,n=$RELEASE; +o=deb.sury.org,n=$RELEASE; +o="Raspberry Pi Foundation",n=$RELEASE; } Dpkg::Options { "--force-confdef"; @@ -146,6 +146,23 @@ chown -R www-data: /var/www/nextcloud/apps/nextcloudpi # update to the latest NC version is_active_app nc-autoupdate-nc && run_app nc-autoupdate-nc +# check dist-upgrade +check_distro "$NCPCFG" || check_distro etc/ncp.cfg && { + php_ver_new=$(jq '.php_version' < etc/ncp.cfg) + release_new=$(jq '.release' < etc/ncp.cfg) + issue_new=$( jq '.release_issue' < etc/ncp.cfg) + + echo "Migrating to distro $release_new" + + cfg="$(jq '.' "$NCPCFG")" + cfg="$(jq '.php_version = "'$php_ver_new'"' <<<"$cfg")" + cfg="$(jq '.release = "'$release_new'"' <<<"$cfg")" + cfg="$(jq '.release_issue = '"$issue_new" <<<"$cfg")" + echo "$cfg" > "$NCPCFG" + + is_active_app unattended-upgrades && run_app unattended-upgrades +} + exit 0 # License |