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-10-13 03:29:37 +0300
committernachoparker <nacho@ownyourbits.com>2021-10-14 20:08:07 +0300
commit85cb1f01ccddafae286bbe66faad2c546c046ce6 (patch)
treeac6956d0cbbe847541339705f608c86135046729
parent35a3a54845fd2d80cb2b0843f711b85e0690cbe0 (diff)
nc-import-ncp: run activated apps upon importv1.40.10
Signed-off-by: nachoparker <nacho@ownyourbits.com>
-rwxr-xr-xbin/ncp-update2
-rw-r--r--bin/ncp/BACKUPS/nc-export-ncp.sh5
-rw-r--r--bin/ncp/BACKUPS/nc-import-ncp.sh23
-rw-r--r--bin/ncp/SECURITY/modsecurity.sh9
4 files changed, 19 insertions, 20 deletions
diff --git a/bin/ncp-update b/bin/ncp-update
index 63ed2c31..15752f6b 100755
--- a/bin/ncp-update
+++ b/bin/ncp-update
@@ -23,7 +23,7 @@
./update.sh || exit $?
cd "$TMPDIR"
- git describe --always --tags --abbrev=0 2>/dev/null | grep -oP "v\d+\.\d+\.\d+" || git fetch --unshallow --tags
+ git describe --always --tags --abbrev=0 2>/dev/null | grep -qoP "v\d+\.\d+\.\d+" || git fetch --unshallow --tags
VER=$( git describe --always --tags --abbrev=0 | grep -oP "v\d+\.\d+\.\d+" )
# check format
diff --git a/bin/ncp/BACKUPS/nc-export-ncp.sh b/bin/ncp/BACKUPS/nc-export-ncp.sh
index ce2e9308..9e0660b4 100644
--- a/bin/ncp/BACKUPS/nc-export-ncp.sh
+++ b/bin/ncp/BACKUPS/nc-export-ncp.sh
@@ -13,13 +13,12 @@ configure()
{
[[ -d "$DIR" ]] || { echo "directory $DIR does not exist"; return 1; }
- local destfile="$DIR"/ncp-config_$( date +"%Y%m%d" ).tar
+ local destfile
+ destfile="$DIR"/ncp-config_$(date +"%Y%m%d").tar
tar -cf "$destfile" -C /usr/local/etc/ncp-config.d .
chmod 600 "$destfile"
- cd $OLDPWD
- rm -rf /tmp/ncp-export
echo -e "configuration exported to $destfile"
}
diff --git a/bin/ncp/BACKUPS/nc-import-ncp.sh b/bin/ncp/BACKUPS/nc-import-ncp.sh
index 823e2703..1368829e 100644
--- a/bin/ncp/BACKUPS/nc-import-ncp.sh
+++ b/bin/ncp/BACKUPS/nc-import-ncp.sh
@@ -9,32 +9,33 @@
-CFGDIR="/usr/local/etc/ncp-config.d"
configure()
{
[[ -f "$FILE" ]] || { echo "export file $FILE does not exist"; return 1; }
- source /usr/local/etc/library.sh || return 1
cd "$CFGDIR" || return 1
# extract export
tar -xf "$FILE" -C "$CFGDIR"
- # UGLY workaround to prevent apache from restarting upon activating some extras
- # which leads to the operation appearing to fail in ncp-web
- #echo "invalid_op" >> /etc/apache2/sites-available/000-default.conf
+ # activate ncp-apps
+ find "${CFGDIR}/" -name '*.cfg' | while read -r cfg; do
+ app="$(basename "${cfg}" .cfg)"
+ if [[ "${app}" == "letsencrypt" ]] || [[ "${app}" == "dnsmasq" ]]; then
+ continue
+ fi
+ is_active_app "${app}" && run_app "${app}"
+ done
- # activate
- # TODO
-
- # Fix invalid configuration
- #sed -i "/^invalid_op/d" /etc/apache2/sites-available/000-default.conf
+ # order is important for these
+ is_active_app "dnsmasq" && run_app "dnsmasq"
+ is_active_app "letsencrypt" && run_app "letsencrypt"
echo -e "\nconfiguration restored"
# delayed in bg so it does not kill the connection, and we get AJAX response
- bash -c "sleep 2 && service apache2 reload" &>/dev/null &
+ apachectl -k graceful
}
install() { :; }
diff --git a/bin/ncp/SECURITY/modsecurity.sh b/bin/ncp/SECURITY/modsecurity.sh
index 94d8c5e8..44f5b251 100644
--- a/bin/ncp/SECURITY/modsecurity.sh
+++ b/bin/ncp/SECURITY/modsecurity.sh
@@ -8,9 +8,6 @@
# More at ownyourbits.com
#
-NCDIR=/var/www/nextcloud/
-NCPWB=/var/www/ncp-web/
-
install()
{
apt-get update
@@ -42,6 +39,9 @@ EOF
configure()
{
+ local NCDIR=/var/www/nextcloud/
+ local NCPWB=/var/www/ncp-web/
+
cat > /etc/modsecurity/modsecurity_crs_99_whitelist.conf <<EOF
<Directory $NCDIR>
# VIDEOS
@@ -92,8 +92,7 @@ EOF
[[ $ACTIVE == "yes" ]] && echo "Enabling module security2" || echo "Disabling module security2"
[[ $ACTIVE == "yes" ]] && a2enmod security2 &>/dev/null || a2dismod security2 &>/dev/null
- # delayed in bg so it does not kill the connection, and we get AJAX response
- bash -c "sleep 2 && service apache2 reload" &>/dev/null &
+ apachectl -k graceful
}
# License