diff options
author | Tobias K <6317548+theCalcaholic@users.noreply.github.com> | 2022-09-25 13:25:29 +0300 |
---|---|---|
committer | thecalcaholic <6317548+theCalcaholic@users.noreply.github.com> | 2022-09-27 21:20:48 +0300 |
commit | 0c3a817421bb8c0ac0c41b62c2b495e6d033daef (patch) | |
tree | 3284e3ff8b146a0bfe734e6dab444160bb49bc70 /bin | |
parent | 780d02a6bd053c30a5c2fce2f8a25ca1a90d8736 (diff) |
ncp-update: Prevent running update script inside docker without explicit confirmation
Signed-off-by: Tobias K <6317548+theCalcaholic@users.noreply.github.com>
Signed-off-by: thecalcaholic <6317548+theCalcaholic@users.noreply.github.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ncp-update | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/ncp-update b/bin/ncp-update index ca564c53..b6f7a333 100755 --- a/bin/ncp-update +++ b/bin/ncp-update @@ -4,6 +4,15 @@ [[ -z "$DBG" ]] || set -$DBG +if [[ -f /.dockerenv ]] || [[ -f /.docker-image ]] || [[ "$DOCKERBUILD" == 1 ]] +then + echo "WARNING: Docker images should be updated by replacing the container from the latest docker image" \ + "(refer to the documentation for instructions: https://docs.nextcloudpi.com)." \ + "If you are sure that you know what you are doing, you can still execute the update script by running it like this:" + echo "> ALLOW_UPDATE_SCRIPT=1 ncp-update" + [[ "$ALLOW_UPDATE_SCRIPT" == "1" ]] || exit 1 +fi + { [ "$(id -u)" -ne 0 ] && { printf "Must be run as root. Try 'sudo $0'\n"; exit 1; } |