Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'update.sh')
-rwxr-xr-xupdate.sh45
1 files changed, 34 insertions, 11 deletions
diff --git a/update.sh b/update.sh
index bb2d0a5d..7ebe90ef 100755
--- a/update.sh
+++ b/update.sh
@@ -62,6 +62,19 @@ mkdir -p "$CONFDIR"
# copy all files in bin and etc
cp -r bin/* /usr/local/bin/
find etc -maxdepth 1 -type f ! -path etc/ncp.cfg -exec cp '{}' /usr/local/etc \;
+
+# set initial config # TODO remove me after next NCP release
+[[ -f "${NCPCFG}" ]] || cat > /usr/local/etc/ncp.cfg <<EOF
+{
+ "nextcloud_version": "16.0.2",
+ "php_version": "7.2",
+ "release": "stretch",
+ "release_issue": [
+ "Debian GNU/Linux 9",
+ "Raspbian GNU/Linux 9"
+ ]
+}
+EOF
cp -n etc/ncp.cfg /usr/local/etc
# update NCVER in ncp.cfg and nc-nextcloud.cfg (for nc-autoupdate-nc and nc-update-nextcloud)
@@ -140,28 +153,39 @@ chown -R www-data: /var/www/nextcloud/apps/nextcloudpi
cp docker/{lamp/010lamp,nextcloud/020nextcloud,nextcloudpi/000ncp} /etc/services-enabled.d
}
-# update old images
-./run_update_history.sh "$UPDATESDIR"
+# update old images, only live updates
+[[ ! -f /.ncp-image ]] && ./run_update_history.sh "$UPDATESDIR"
# 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"
+ php_ver_new=$(jq -r '.php_version' < etc/ncp.cfg)
+ release_new=$(jq -r '.release' < etc/ncp.cfg)
+ issue_new=$( jq -r '.release_issue' < etc/ncp.cfg)
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"
+ echo "$cfg" > /usr/local/etc/ncp-recommended.cfg
+
+ [[ -f /.dockerenv ]] && \
+ msg="Update to $release_new available. Get the latest container to upgrade" || \
+ msg="Update to $release_new available. Type 'sudo ncp-dist-upgrade' to upgrade"
+ echo "${msg}"
+ ncc notification:generate "ncp" "New distribution available" -l "${msg}"
+ wall "${msg}"
+ cat > /etc/update-motd.d/30ncp-dist-upgrade <<EOF
+#!/bin/bash
+new_cfg=/usr/local/etc/ncp-recommended.cfg
+[[ -f "\${new_cfg}" ]] || exit 0
+echo -e "${msg}"
+EOF
+chmod +x /etc/update-motd.d/30ncp-dist-upgrade
+}
- is_active_app unattended-upgrades && run_app unattended-upgrades
-}
exit 0
@@ -181,4 +205,3 @@ exit 0
# along with this script; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA
-