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:
authornachoparker <nacho@ownyourbits.com>2021-07-24 22:54:31 +0300
committernachoparker <nacho@ownyourbits.com>2021-07-25 23:59:07 +0300
commit665ed28ae6e84f154bff10916e1636244fc88f9b (patch)
tree7e1cb75c38ebb87a4c8d8f211a612a442deb4ade
parenteffdd6cdb3057a60457d71c4bd3d4298d76f2d65 (diff)
build: trap and curl installer fixes
Signed-off-by: nachoparker <nacho@ownyourbits.com>
-rw-r--r--Vagrantfile8
-rwxr-xr-xbin/ncp-update4
-rw-r--r--install.sh19
-rw-r--r--ncp.sh2
-rw-r--r--post-inst.sh2
-rwxr-xr-xrun_update_history.sh5
6 files changed, 18 insertions, 22 deletions
diff --git a/Vagrantfile b/Vagrantfile
index 61b45126..e1a5134d 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -28,17 +28,11 @@ Vagrant.configure("2") do |config|
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git
- # indicate that this will be an image build
- touch /.ncp-image
-
# install
git clone -b "$BRANCH" https://github.com/nextcloud/nextcloudpi.git /tmp/nextcloudpi
cd /tmp/nextcloudpi
- # uncomment to install devel
- #sed -i 's|^BRANCH=master|BRANCH=devel|' install.sh ncp.sh
-
- bash install.sh
+ source install.sh
# cleanup
source etc/library.sh
diff --git a/bin/ncp-update b/bin/ncp-update
index 93c11408..4f07907d 100755
--- a/bin/ncp-update
+++ b/bin/ncp-update
@@ -9,7 +9,7 @@
[[ "$BRANCH" != "master" ]] && echo "INFO: updating to development branch '$BRANCH'"
TMPDIR="$( mktemp -d /tmp/ncp-update.XXXXXX || ( echo "Failed to create temp dir. Exiting" >&2; exit 1 ) )"
- trap "cd /; rm -rf \"${TMPDIR}\"; exit 0" 0 1 2 3 15
+ trap 'ret=$?; cd /; rm -rf "${TMPDIR}"; exit $ret' EXIT
echo -e "Downloading updates"
git clone --depth 20 -b "$BRANCH" -q https://github.com/nextcloud/nextcloudpi.git "$TMPDIR" || {
@@ -20,7 +20,7 @@
[[ -f /.ncp-image ]] || cd "$TMPDIR" # update locally during build
echo -e "Performing updates"
- ./update.sh || exit 1
+ ./update.sh || exit $?
cd "$TMPDIR"
VER=$( git describe --always --tags | grep -oP "v\d+\.\d+\.\d+" )
diff --git a/install.sh b/install.sh
index 12bd6311..f157cdba 100644
--- a/install.sh
+++ b/install.sh
@@ -9,7 +9,7 @@
#
# more details at https://ownyourbits.com
-BRANCH=master
+BRANCH="${BRANCH:-master}"
#DBG=x
set -e$DBG
@@ -30,13 +30,10 @@ type mysqld &>/dev/null && echo ">>> WARNING: existing mysqld configuration wil
# get install code
echo "Getting build code..."
apt-get update
-apt-get install --no-install-recommends -y wget ca-certificates sudo lsb-release
+apt-get install --no-install-recommends -y git ca-certificates sudo lsb-release
-pushd "$TMPDIR"
-wget -qO- --content-disposition https://github.com/nextcloud/nextcloudpi/archive/"$BRANCH"/latest.tar.gz \
- | tar -xz \
- || exit 1
-cd - && cd "$TMPDIR"/nextcloudpi-"$BRANCH"
+git clone -b "${BRANCH}" https://github.com/nextcloud/nextcloudpi.git "${TMPDIR}"/nextcloudpi
+cd "${TMPDIR}"/nextcloudpi
# install NCP
echo -e "\nInstalling NextCloudPi..."
@@ -49,6 +46,8 @@ check_distro etc/ncp.cfg || {
exit 1;
}
+# indicate that this will be an image build
+touch /.ncp-image
mkdir -p /usr/local/etc/ncp-config.d/
cp etc/ncp-config.d/nc-nextcloud.cfg /usr/local/etc/ncp-config.d/
@@ -62,8 +61,10 @@ systemctl restart mysqld # TODO this shouldn't be necessary, but somehow it's ne
install_app ncp.sh
run_app_unsafe bin/ncp/CONFIG/nc-init.sh
bash /usr/local/bin/ncp-provisioning.sh
+rm /.ncp-image
-popd
+cd -
+rm -rf "${TMPDIR}"
IFACE="$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )"
IP="$( ip a show dev "$IFACE" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1 )"
@@ -79,8 +80,6 @@ first load the activation and :4443 pages. You can run letsencrypt to get rid of
the warning if you have a (sub)domain available.
"
-exit 0
-
# License
#
# This script is free software; you can redistribute it and/or modify it
diff --git a/ncp.sh b/ncp.sh
index 78bf4318..b0f49104 100644
--- a/ncp.sh
+++ b/ncp.sh
@@ -217,7 +217,7 @@ EOF
chmod g+w /var/run/.ncp-latest-version
# Install all ncp-apps
- bin/ncp-update $BRANCH || exit 1
+ bin/ncp-update $BRANCH || exit $?
# LIMIT LOG SIZE
grep -q maxsize /etc/logrotate.d/apache2 || sed -i /weekly/amaxsize2M /etc/logrotate.d/apache2
diff --git a/post-inst.sh b/post-inst.sh
index 987008b5..4ede0120 100644
--- a/post-inst.sh
+++ b/post-inst.sh
@@ -28,7 +28,7 @@ configure()
find /var/log -type f -exec rm {} \;
# clean build flags
- rm /.ncp-image
+ rm -f /.ncp-image
}
# License
diff --git a/run_update_history.sh b/run_update_history.sh
index add3a29c..4faa5c2f 100755
--- a/run_update_history.sh
+++ b/run_update_history.sh
@@ -103,7 +103,10 @@ if is_more_recent_than "$latest_checkpoint_version" "$current_version" ; then
for(( i="$starting_checkpoint"; i<="$end_of_list"; i++)); do
update_file=${updates_list[$i]}
tag_update=$( basename "$update_file" .sh )
- bash "$updates_dir/$update_file" || exit 1
+ bash "$updates_dir/$update_file" || {
+ echo "Error while applying update $(basename "$update_file" .sh). Exiting..."
+ exit 1
+ }
echo "v$tag_update" > /usr/local/etc/ncp-version
[[ $i != $end_of_list ]] && echo -e "NextCloudPi updated to version v$tag_update" || true
done