diff options
author | nachoparker <nacho@ownyourbits.com> | 2019-07-02 04:15:46 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2019-07-06 06:43:54 +0300 |
commit | 35526ab9fcfc538b68a10bbf449d6b1fe5ea7d6d (patch) | |
tree | bf5f7762937f0fd38bb7463041e25726cc74bd16 /bin/ncp | |
parent | 88da901eddff125b3e71d9706fbe02edffc659b3 (diff) |
build: use a system wide config file. Remove sury sources
Signed-off-by: nachoparker <nacho@ownyourbits.com>
Diffstat (limited to 'bin/ncp')
-rw-r--r-- | bin/ncp/BACKUPS/nc-restore.sh | 9 | ||||
-rw-r--r-- | bin/ncp/CONFIG/nc-datadir.sh | 5 | ||||
-rw-r--r-- | bin/ncp/CONFIG/nc-init.sh | 3 | ||||
-rw-r--r-- | bin/ncp/CONFIG/nc-limits.sh | 5 | ||||
-rw-r--r-- | bin/ncp/CONFIG/nc-nextcloud.sh | 9 | ||||
-rw-r--r-- | bin/ncp/NETWORKING/no-ip.sh | 9 | ||||
-rw-r--r-- | bin/ncp/UPDATES/nc-autoupdate-nc.sh | 11 | ||||
-rw-r--r-- | bin/ncp/UPDATES/nc-update-nextcloud.sh | 3 |
8 files changed, 25 insertions, 29 deletions
diff --git a/bin/ncp/BACKUPS/nc-restore.sh b/bin/ncp/BACKUPS/nc-restore.sh index f94d6478..278a6ade 100644 --- a/bin/ncp/BACKUPS/nc-restore.sh +++ b/bin/ncp/BACKUPS/nc-restore.sh @@ -10,7 +10,7 @@ # install() -{ +{ cat > /usr/local/bin/ncp-restore <<'EOF' #!/bin/bash set -eE @@ -19,7 +19,8 @@ BACKUPFILE="$1" DBADMIN=ncadmin DBPASSWD="$( grep password /root/.my.cnf | sed 's|password=||' )" -PHPVER=7.2 + +source /usr/local/etc/library.sh # sets PHPVER DIR="$( cd "$( dirname "$BACKUPFILE" )" &>/dev/null && pwd )" #abspath @@ -123,7 +124,7 @@ if [[ $( ls "$TMPDIR" | wc -l ) -eq $NUMFILES ]]; then ### INCLUDEDATA=no situation -else +else echo "no datadir found in backup" DATADIR="$NCDIR"/data @@ -138,7 +139,7 @@ fi sed -i "s|^opcache.file_cache=.*|opcache.file_cache=$DATADIR/.opcache|" /etc/php/${PHPVER}/mods-available/opcache.ini # tmp upload dir -mkdir -p "$DATADIR/tmp" +mkdir -p "$DATADIR/tmp" chown www-data:www-data "$DATADIR/tmp" sed -i "s|^;\?upload_tmp_dir =.*$|upload_tmp_dir = $DATADIR/tmp|" /etc/php/${PHPVER}/cli/php.ini sed -i "s|^;\?upload_tmp_dir =.*$|upload_tmp_dir = $DATADIR/tmp|" /etc/php/${PHPVER}/fpm/php.ini diff --git a/bin/ncp/CONFIG/nc-datadir.sh b/bin/ncp/CONFIG/nc-datadir.sh index 6731399a..8f087c54 100644 --- a/bin/ncp/CONFIG/nc-datadir.sh +++ b/bin/ncp/CONFIG/nc-datadir.sh @@ -8,9 +8,6 @@ # More at https://ownyourbits.com/2017/03/13/nextcloudpi-gets-nextcloudpi-config/ # - -PHPVER=7.2 - is_active() { local SRCDIR @@ -26,6 +23,8 @@ install() configure() { + source /usr/local/etc/library.sh # sets PHPVER + ## CHECKS local SRCDIR SRCDIR=$( cd /var/www/nextcloud; sudo -u www-data php occ config:system:get datadirectory ) || { diff --git a/bin/ncp/CONFIG/nc-init.sh b/bin/ncp/CONFIG/nc-init.sh index 2f940477..486c7dea 100644 --- a/bin/ncp/CONFIG/nc-init.sh +++ b/bin/ncp/CONFIG/nc-init.sh @@ -9,10 +9,11 @@ # DBADMIN=ncadmin -PHPVER=7.2 configure() { + source /usr/local/etc/library.sh # sets PHPVER + echo "Setting up a clean Nextcloud instance... wait until message 'NC init done'" # checks diff --git a/bin/ncp/CONFIG/nc-limits.sh b/bin/ncp/CONFIG/nc-limits.sh index b16bd06d..8c527401 100644 --- a/bin/ncp/CONFIG/nc-limits.sh +++ b/bin/ncp/CONFIG/nc-limits.sh @@ -8,11 +8,10 @@ # More at https://ownyourbits.com/2017/03/13/nextcloudpi-gets-nextcloudpi-config/ # -PHPVER=7.2 - - configure() { + source /usr/local/etc/library.sh # sets PHPVER + # Set auto memory limit to 75% of the total memory local TOTAL_MEM="$( free -b | sed -n 2p | awk '{ print $2 }' )" AUTOMEM=$(( TOTAL_MEM * 75 / 100 )) diff --git a/bin/ncp/CONFIG/nc-nextcloud.sh b/bin/ncp/CONFIG/nc-nextcloud.sh index 007cf478..fdbb5f32 100644 --- a/bin/ncp/CONFIG/nc-nextcloud.sh +++ b/bin/ncp/CONFIG/nc-nextcloud.sh @@ -10,7 +10,6 @@ DBADMIN=ncadmin REDIS_MEM=3gb -PHPVER=7.2 APTINSTALL="apt-get install -y --no-install-recommends" export DEBIAN_FRONTEND=noninteractive @@ -20,7 +19,7 @@ install() # During build, this step is run before ncp.sh. Avoid executing twice [[ -f /usr/lib/systemd/system/nc-provisioning.service ]] && return 0 - local RELEASE=stretch + source /usr/local/etc/library.sh # sets PHPVER RELEASE # Optional packets for Nextcloud and Apps apt-get update @@ -39,7 +38,7 @@ install() rm /usr/bin/newaliases mv /newaliases /usr/bin/newaliases } - + $APTINSTALL redis-server $APTINSTALL -t $RELEASE php${PHPVER}-redis @@ -59,7 +58,7 @@ install() service redis-server restart update-rc.d redis-server enable service php${PHPVER}-fpm restart - + # service to randomize passwords on first boot mkdir -p /usr/lib/systemd/system cat > /usr/lib/systemd/system/nc-provisioning.service <<'EOF' @@ -235,7 +234,7 @@ EOF echo "*/15 * * * * php -f /var/www/nextcloud/cron.php" > /tmp/crontab_http crontab -u www-data /tmp/crontab_http rm /tmp/crontab_http - + echo "Don't forget to run nc-init" } diff --git a/bin/ncp/NETWORKING/no-ip.sh b/bin/ncp/NETWORKING/no-ip.sh index 0948b3b1..6e1c910d 100644 --- a/bin/ncp/NETWORKING/no-ip.sh +++ b/bin/ncp/NETWORKING/no-ip.sh @@ -1,6 +1,6 @@ #!/bin/bash -# no-ip.org installation on Raspbian +# no-ip.org installation on NextCloudPi # # Copyleft 2017 by Ignacio Nunez Hernanz <nacho _a_t_ ownyourbits _d_o_t_ com> # GPL licensed (see end of file) * Use at your own risk! @@ -72,7 +72,7 @@ EOF return 0 } -configure() +configure() { service noip2 stop [[ $ACTIVE != "yes" ]] && { update-rc.d noip2 disable; return 0; } @@ -94,10 +94,7 @@ configure() cleanup() { - # this uninstalls udiskie, commented out - # udiskie with these dependencies fixed in Buster - # apt-get purge -y make gcc libc-dev - : + apt-get purge -y make gcc libc-dev } # License diff --git a/bin/ncp/UPDATES/nc-autoupdate-nc.sh b/bin/ncp/UPDATES/nc-autoupdate-nc.sh index 148324d1..ee2a5669 100644 --- a/bin/ncp/UPDATES/nc-autoupdate-nc.sh +++ b/bin/ncp/UPDATES/nc-autoupdate-nc.sh @@ -8,13 +8,12 @@ # More at: https://ownyourbits.com # +# just change NCVER and re-activate in update.sh to upgrade users +source /usr/local/etc/library.sh # sets NCVER -# just change this value and re-activate in update.sh to upgrade users -VERSION=15.0.8 - -configure() +configure() { - [[ "$ACTIVE" != "yes" ]] && { + [[ "$ACTIVE" != "yes" ]] && { rm -f /etc/cron.daily/ncp-autoupdate-nc echo "automatic Nextcloud updates disabled" return 0 @@ -24,7 +23,7 @@ configure() #!/bin/bash echo -e "[ncp-update-nc]" >> /var/log/ncp.log -/usr/local/bin/ncp-update-nc "$VERSION" 2>&1 | tee -a /var/log/ncp.log +/usr/local/bin/ncp-update-nc "$NCVER" 2>&1 | tee -a /var/log/ncp.log if [[ \${PIPESTATUS[0]} -eq 0 ]]; then diff --git a/bin/ncp/UPDATES/nc-update-nextcloud.sh b/bin/ncp/UPDATES/nc-update-nextcloud.sh index ec1dd127..3f53fdaa 100644 --- a/bin/ncp/UPDATES/nc-update-nextcloud.sh +++ b/bin/ncp/UPDATES/nc-update-nextcloud.sh @@ -8,7 +8,8 @@ # More at https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/ # -LATEST=15.0.8 +source /usr/local/etc/library.sh # sets NCVER +LATEST="$NCVER" configure() { |