simplify parameters

This commit is contained in:
nachoparker 2017-07-31 14:48:10 +02:00
parent c4210c5a69
commit d819bbb625
3 changed files with 14 additions and 13 deletions

View File

@ -16,7 +16,8 @@
DOMAIN_=mycloud.ownyourbits.com
EMAIL_=mycloud@ownyourbits.com
NCDIR_=/var/www/nextcloud
NCDIR=/var/www/nextcloud
VHOSTCFG=/etc/apache2/sites-available/nextcloud.conf
VHOSTCFG2=/etc/apache2/sites-available/ncp.conf
DESCRIPTION="Automatic signed SSL certificates"
@ -53,7 +54,7 @@ configure()
sed -i "s|SSLCertificateFile.*|SSLCertificateFile /etc/letsencrypt/live/$DOMAIN_/fullchain.pem|" $VHOSTCFG2
sed -i "s|SSLCertificateKeyFile.*|SSLCertificateKeyFile /etc/letsencrypt/live/$DOMAIN_/privkey.pem|" $VHOSTCFG2
/etc/letsencrypt/letsencrypt-auto certonly -n --no-self-upgrade --webroot -w $NCDIR_ --hsts --agree-tos -m $EMAIL_ -d $DOMAIN_ || return 1
/etc/letsencrypt/letsencrypt-auto certonly -n --no-self-upgrade --webroot -w $NCDIR --hsts --agree-tos -m $EMAIL_ -d $DOMAIN_ || return 1
echo "* 1 * * 1 root /etc/letsencrypt/certbot-auto renew --quiet" > /etc/cron.d/letsencrypt-ncp
cd /var/www/nextcloud

View File

@ -16,7 +16,7 @@
#
ACTIVE_=no
NCDIR_=/var/www/nextcloud/
NCDIR=/var/www/nextcloud/
DESCRIPTION="Web Application Firewall for extra security (experimental)"
install()
@ -77,7 +77,7 @@ a basic NextCloud installation. If a new App does not work disable it" \
configure()
{
cat > /etc/modsecurity/modsecurity_crs_99_whitelist.conf <<EOF
<Directory $NCDIR_>
<Directory $NCDIR>
# VIDEOS
SecRuleRemoveById 958291 # Range Header Checks
SecRuleRemoveById 981203 # Correlated Attack Attempt

View File

@ -18,7 +18,7 @@
BACKUPFILE_=/media/USBdrive/nextcloud-bkp_xxxxxxxx.tar
BASEDIR_=/var/www
BASEDIR=/var/www
DBADMIN=ncadmin
DESCRIPTION="Restore a previously backuped NC instance"
@ -39,9 +39,9 @@ You can use nc-backup " \
configure()
{
[ -f $BACKUPFILE_ ] || { echo -e "$BACKUPFILE_ not found"; return 1; }
[ -d $BASEDIR_ ] || { echo -e "$BASEDIR_ not found"; return 1; }
[ -d $BASEDIR_/nextcloud ] && { echo -e "WARNING: overwriting old instance"; }
[ -f $BACKUPFILE_ ] || { echo -e "$BACKUPFILE_ not found"; return 1; }
[ -d $BASEDIR ] || { echo -e "$BASEDIR not found"; return 1; }
[ -d $BASEDIR/nextcloud ] && { echo -e "WARNING: overwriting old instance"; }
local TMPDIR="$( dirname $BACKUPFILE_ )/$( basename ${BACKUPFILE_}-tmp )"
rm -rf "$TMPDIR" && mkdir -p "$TMPDIR"
@ -50,8 +50,8 @@ configure()
## RESTORE FILES
echo -e "restore files..."
rm -rf $BASEDIR_/nextcloud
mv "$TMPDIR"/nextcloud $BASEDIR_
rm -rf $BASEDIR/nextcloud
mv "$TMPDIR"/nextcloud $BASEDIR
## RE-CREATE DATABASE TABLE
@ -72,12 +72,12 @@ EOF
## RESTORE DATADIR
cd $BASEDIR_/nextcloud
cd $BASEDIR/nextcloud
# INCLUDEDATA=yes situation
if [[ $( ls "$TMPDIR" | wc -l ) == 2 ]]; then
local DATADIR=$( grep datadirectory $BASEDIR_/nextcloud/config/config.php | awk '{ print $3 }' | grep -oP "[^']*[^']" | head -1 )
local DATADIR=$( grep datadirectory $BASEDIR/nextcloud/config/config.php | awk '{ print $3 }' | grep -oP "[^']*[^']" | head -1 )
[[ "$DATADIR" == "" ]] && { echo -e "Error reading data directory"; return 1; }
echo -e "restore datadir to $DATADIR..."
rm -rf "$DATADIR"
@ -107,7 +107,7 @@ EOF
rm -r "$TMPDIR"
# Just in case we moved the opcache dir
sed -i "s|^opcache.file_cache=.*|opcache.file_cache=$BASEDIR_/nextcloud/data/.opcache|" /etc/php/7.0/mods-available/opcache.ini
sed -i "s|^opcache.file_cache=.*|opcache.file_cache=$BASEDIR/nextcloud/data/.opcache|" /etc/php/7.0/mods-available/opcache.ini
}
install() { :; }