Skip to content

Commit 52051bb

Browse files
author
nacho
committed
simplify parameters
1 parent ce90dea commit 52051bb

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

etc/nextcloudpi-config.d/letsencrypt.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
DOMAIN_=mycloud.ownyourbits.com
1818
EMAIL_=mycloud@ownyourbits.com
19-
NCDIR_=/var/www/nextcloud
19+
20+
NCDIR=/var/www/nextcloud
2021
VHOSTCFG=/etc/apache2/sites-available/nextcloud.conf
2122
VHOSTCFG2=/etc/apache2/sites-available/ncp.conf
2223
DESCRIPTION="Automatic signed SSL certificates"
@@ -53,7 +54,7 @@ configure()
5354
sed -i "s|SSLCertificateFile.*|SSLCertificateFile /etc/letsencrypt/live/$DOMAIN_/fullchain.pem|" $VHOSTCFG2
5455
sed -i "s|SSLCertificateKeyFile.*|SSLCertificateKeyFile /etc/letsencrypt/live/$DOMAIN_/privkey.pem|" $VHOSTCFG2
5556

56-
/etc/letsencrypt/letsencrypt-auto certonly -n --no-self-upgrade --webroot -w $NCDIR_ --hsts --agree-tos -m $EMAIL_ -d $DOMAIN_ || return 1
57+
/etc/letsencrypt/letsencrypt-auto certonly -n --no-self-upgrade --webroot -w $NCDIR --hsts --agree-tos -m $EMAIL_ -d $DOMAIN_ || return 1
5758
echo "* 1 * * 1 root /etc/letsencrypt/certbot-auto renew --quiet" > /etc/cron.d/letsencrypt-ncp
5859

5960
cd /var/www/nextcloud

etc/nextcloudpi-config.d/modsecurity.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#
1717

1818
ACTIVE_=no
19-
NCDIR_=/var/www/nextcloud/
19+
NCDIR=/var/www/nextcloud/
2020
DESCRIPTION="Web Application Firewall for extra security (experimental)"
2121

2222
install()
@@ -77,7 +77,7 @@ a basic NextCloud installation. If a new App does not work disable it" \
7777
configure()
7878
{
7979
cat > /etc/modsecurity/modsecurity_crs_99_whitelist.conf <<EOF
80-
<Directory $NCDIR_>
80+
<Directory $NCDIR>
8181
# VIDEOS
8282
SecRuleRemoveById 958291 # Range Header Checks
8383
SecRuleRemoveById 981203 # Correlated Attack Attempt

etc/nextcloudpi-config.d/nc-restore.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919

2020
BACKUPFILE_=/media/USBdrive/nextcloud-bkp_xxxxxxxx.tar
21-
BASEDIR_=/var/www
21+
BASEDIR=/var/www
2222
DBADMIN=ncadmin
2323
DESCRIPTION="Restore a previously backuped NC instance"
2424

@@ -39,9 +39,9 @@ You can use nc-backup " \
3939

4040
configure()
4141
{
42-
[ -f $BACKUPFILE_ ] || { echo -e "$BACKUPFILE_ not found"; return 1; }
43-
[ -d $BASEDIR_ ] || { echo -e "$BASEDIR_ not found"; return 1; }
44-
[ -d $BASEDIR_/nextcloud ] && { echo -e "WARNING: overwriting old instance"; }
42+
[ -f $BACKUPFILE_ ] || { echo -e "$BACKUPFILE_ not found"; return 1; }
43+
[ -d $BASEDIR ] || { echo -e "$BASEDIR not found"; return 1; }
44+
[ -d $BASEDIR/nextcloud ] && { echo -e "WARNING: overwriting old instance"; }
4545

4646
local TMPDIR="$( dirname $BACKUPFILE_ )/$( basename ${BACKUPFILE_}-tmp )"
4747
rm -rf "$TMPDIR" && mkdir -p "$TMPDIR"
@@ -50,8 +50,8 @@ configure()
5050
## RESTORE FILES
5151

5252
echo -e "restore files..."
53-
rm -rf $BASEDIR_/nextcloud
54-
mv "$TMPDIR"/nextcloud $BASEDIR_
53+
rm -rf $BASEDIR/nextcloud
54+
mv "$TMPDIR"/nextcloud $BASEDIR
5555

5656
## RE-CREATE DATABASE TABLE
5757

@@ -72,12 +72,12 @@ EOF
7272

7373
## RESTORE DATADIR
7474

75-
cd $BASEDIR_/nextcloud
75+
cd $BASEDIR/nextcloud
7676

7777
# INCLUDEDATA=yes situation
7878

7979
if [[ $( ls "$TMPDIR" | wc -l ) == 2 ]]; then
80-
local DATADIR=$( grep datadirectory $BASEDIR_/nextcloud/config/config.php | awk '{ print $3 }' | grep -oP "[^']*[^']" | head -1 )
80+
local DATADIR=$( grep datadirectory $BASEDIR/nextcloud/config/config.php | awk '{ print $3 }' | grep -oP "[^']*[^']" | head -1 )
8181
[[ "$DATADIR" == "" ]] && { echo -e "Error reading data directory"; return 1; }
8282
echo -e "restore datadir to $DATADIR..."
8383
rm -rf "$DATADIR"
@@ -107,7 +107,7 @@ EOF
107107
rm -r "$TMPDIR"
108108

109109
# Just in case we moved the opcache dir
110-
sed -i "s|^opcache.file_cache=.*|opcache.file_cache=$BASEDIR_/nextcloud/data/.opcache|" /etc/php/7.0/mods-available/opcache.ini
110+
sed -i "s|^opcache.file_cache=.*|opcache.file_cache=$BASEDIR/nextcloud/data/.opcache|" /etc/php/7.0/mods-available/opcache.ini
111111
}
112112

113113
install() { :; }

0 commit comments

Comments
 (0)