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:
-rw-r--r--bin/ncp/CONFIG/nc-nextcloud.sh2
-rwxr-xr-xbuild-SD-rpi.sh8
-rw-r--r--etc/library.sh2
-rw-r--r--install.sh2
-rwxr-xr-xupdate.sh27
5 files changed, 34 insertions, 7 deletions
diff --git a/bin/ncp/CONFIG/nc-nextcloud.sh b/bin/ncp/CONFIG/nc-nextcloud.sh
index 2fd49e60..5604333e 100644
--- a/bin/ncp/CONFIG/nc-nextcloud.sh
+++ b/bin/ncp/CONFIG/nc-nextcloud.sh
@@ -24,7 +24,7 @@ install()
# Optional packets for Nextcloud and Apps
apt-get update
- $APTINSTALL lbzip2 iputils-ping
+ $APTINSTALL lbzip2 iputils-ping jq
$APTINSTALL -t $RELEASE php-smbclient # for external storage
$APTINSTALL -t $RELEASE imagemagick php${PHPVER}-imagick php${PHPVER}-exif # for gallery
diff --git a/build-SD-rpi.sh b/build-SD-rpi.sh
index c3b274f0..03d0d0ce 100755
--- a/build-SD-rpi.sh
+++ b/build-SD-rpi.sh
@@ -70,9 +70,11 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
sed -i 's|^#PermitRootLogin .*|PermitRootLogin no|' /etc/ssh/sshd_config
# default user 'pi' for SSH
- sed -i 's|^USER_=.*|USER_=pi|' /usr/local/etc/ncp-config.d/SSH.sh
- sed -i 's|^PASS_=.*|PASS_=raspberry|' /usr/local/etc/ncp-config.d/SSH.sh
- sed -i 's|^CONFIRM_=.*|CONFIRM_=raspberry|' /usr/local/etc/ncp-config.d/SSH.sh
+ cfg="$(jq '.' etc/ncp-config.d/SSH.cfg)"
+ cfg="$(jq '.params[1].value = "pi"' <<<"$cfg")"
+ cfg="$(jq '.params[2].value = "raspberry"' <<<"$cfg")"
+ cfg="$(jq '.params[3].value = "raspberry"' <<<"$cfg")"
+ echo "$cfg" > etc/ncp-config.d/SSH.cfg
rm -rf /tmp/ncp-build
EOFCHROOT
diff --git a/etc/library.sh b/etc/library.sh
index 02450bba..e8ab7305 100644
--- a/etc/library.sh
+++ b/etc/library.sh
@@ -122,7 +122,7 @@ function run_app_unsafe()
# read cfg parameters
[[ -f "$cfg_file" ]] && {
local cfg="$( cat "$cfg_file" )"
- local len="$(jq '.params | length' <<<"$cfg")"
+ local len="$(jq '.params | length' <<<"$cfg")"
for (( i = 0 ; i < len ; i++ )); do
local var="$(jq -r ".params[$i].id" <<<"$cfg")"
local val="$(jq -r ".params[$i].value" <<<"$cfg")"
diff --git a/install.sh b/install.sh
index c8c0771d..f6a66058 100644
--- a/install.sh
+++ b/install.sh
@@ -34,7 +34,7 @@ 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 jq
+apt-get install --no-install-recommends -y wget ca-certificates sudo
pushd "$TMPDIR"
wget -O- --content-disposition https://github.com/nextcloud/nextcloudpi/archive/"$BRANCH"/latest.tar.gz \
diff --git a/update.sh b/update.sh
index ba577c67..b8169aa3 100755
--- a/update.sh
+++ b/update.sh
@@ -88,6 +88,18 @@ type jq &>/dev/null || {
echo "$cfg" > "$CONFDIR/$app.cfg"
rm $file
done
+
+ ## NCP LAUNCHER
+ mkdir -p /home/www
+ chown www-data:www-data /home/www
+ chmod 700 /home/www
+
+ cat > /home/www/ncp-launcher.sh <<'EOF'
+#!/bin/bash
+source /usr/local/etc/library.sh
+run_app $1
+EOF
+ chmod 700 /home/www/ncp-launcher.sh
}
## TODO migration - end -
@@ -111,7 +123,9 @@ find etc -maxdepth 1 -type f -exec cp '{}' /usr/local/etc \;
# install new entries of ncp-config and update others
for file in etc/ncp-config.d/*; do
[ -f "$file" ] || continue; # skip dirs
- [ -f /usr/local/"$file" ] || { # new entry
+
+ # install new ncp_apps
+ [ -f /usr/local/"$file" ] || {
install_app "$(basename "$file" .cfg)"
# configure if active by default
@@ -119,7 +133,18 @@ for file in etc/ncp-config.d/*; do
[[ "$(jq -r ".params[0].value" "$file")" == "yes" ]] && \
run_app_unsafe "$file"
}
+
+ # keep saved cfg values
+ [ -f /usr/local/"$file" ] && {
+ len="$(jq '.params | length' /usr/local/"$file")"
+ for (( i = 0 ; i < len ; i++ )); do
+ val="$(jq -r ".params[$i].value" /usr/local/"$file")"
+ cfg="$(jq ".params[$i].value = \"$val\"" "$file")"
+ echo "$cfg" > "$file"
+ done
+ }
cp "$file" /usr/local/"$file"
+
done
# install localization files