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:
authorThomas Kaiser <github@kaiser-edv.de>2018-05-09 14:09:28 +0300
committernachoparker <nacho@ownyourbits.com>2018-05-09 14:09:28 +0300
commit2dcc66c254fb361bb5f67b7e89855d8ae9876f1e (patch)
tree5579ad267326dd8d63cbf27ab77757bbf86918ec /install.sh
parent272fe72fbfe53775cdb57f88d77accf415611939 (diff)
Improve tempdir handling (#499)
Diffstat (limited to 'install.sh')
-rw-r--r--install.sh9
1 files changed, 4 insertions, 5 deletions
diff --git a/install.sh b/install.sh
index b8e8b8dd..42d4bc49 100644
--- a/install.sh
+++ b/install.sh
@@ -14,7 +14,8 @@ BRANCH=master
set -e$DBG
-TMPDIR=/tmp/nextcloudplus
+TMPDIR="$(mktemp -d /tmp/nextcloudplus.XXXXXX || (echo "Failed to create temp dir. Exiting" >&2 ; exit 1) )"
+trap "rm -rf \"${TMPDIR}\" ; exit 0" 0 1 2 3 15
[[ ${EUID} -ne 0 ]] && {
printf "Must be run as root. Try 'sudo $0'\n"
@@ -36,7 +37,7 @@ echo "Getting build code..."
apt-get update
apt-get install --no-install-recommends -y wget ca-certificates sudo
-rm -rf "$TMPDIR" && mkdir "$TMPDIR" && cd "$TMPDIR"
+pushd "$TMPDIR"
wget -O- --content-disposition https://github.com/nextcloud/nextcloudpi/archive/"$BRANCH"/latest.tar.gz \
| tar -xz \
|| exit 1
@@ -56,9 +57,7 @@ activate_script etc/ncp-config.d/nc-init.sh
[[ "$APACHE_EXISTS" != "" ]] && \
a2enmod status reqtimeout env autoindex access_compat auth_basic authn_file authn_core alias access_compat
-cd -
-rm -rf $TMPDIR
-
+popd
echo "Done.
Type 'sudo ncp-config' to configure NCP, or access ncp-web on https://<this_ip>:4443