mirror of
https://github.com/nextcloud/nextcloudpi.git
synced 2026-01-09 14:42:01 -03:30
11.0.2 update. nextcloudpi-config integration. configure datadir and limits. offline copy. batch builds. fixes
This commit is contained in:
parent
531c5d664d
commit
2a49453204
22
README.md
22
README.md
@ -7,10 +7,12 @@ Use QEMU to automatically generate Raspbian Images with Nextcloud
|
||||
## Features
|
||||
|
||||
* Raspbian 8 Jessie
|
||||
* Nextcloud 11.0.1
|
||||
* Nextcloud 11.0.2
|
||||
* Apache 2.4.25, with HTTP2 enabled
|
||||
* PHP 7.0
|
||||
* PHP 7.0 (double the speed of PHP5!)
|
||||
* MariaDB 10
|
||||
* 4.9.13 Linux Kernel ( NEW 03-13-2017 ) [[ LINK ]]
|
||||
* nextcloudpi-config for easy setup
|
||||
* Automatic redirection to HTTPS
|
||||
* ACPU PHP cache
|
||||
* PHP Zend OPcache enabled with file cache
|
||||
@ -29,14 +31,22 @@ cd nextcloud-raspbian-generator
|
||||
./install-nextcloud.sh 192.168.0.145 # change to your QEMU raspbian IP
|
||||
```
|
||||
|
||||
If we also want fail2ban in our image
|
||||
If we also want extras in our image
|
||||
|
||||
```
|
||||
./install-fail2ban.sh 192.168.0.145 NextCloudPi_02-18-17.img # change to your QEMU raspbian IP
|
||||
./installer.sh extrascript.sh 192.168.0.145 NextCloudPi_03-13-17.img # change to your QEMU raspbian IP
|
||||
```
|
||||
|
||||
Adjust for the image name generated in the first step. Same thing for the other extras.
|
||||
Adjust for the image name generated in the first step.
|
||||
|
||||
Get the image or find details and instructions at
|
||||
Extras can be activated and configured using
|
||||
|
||||
```
|
||||
sudo nextcloudpi-config
|
||||
```
|
||||
|
||||

|
||||
|
||||
Get the image, find details and more instructions at
|
||||
|
||||
https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/
|
||||
|
||||
18
batch.sh
18
batch.sh
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Batch creation of NextCloudPi image
|
||||
# Tested with 2017-01-11-raspbian-jessie.img (and lite)
|
||||
# Tested with 2017-03-02-raspbian-jessie-lite.img
|
||||
#
|
||||
# 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!
|
||||
@ -9,13 +9,17 @@
|
||||
# Usage:
|
||||
#
|
||||
|
||||
INSTALL_SCRIPT=$1 # First argument is the script to be run inside Raspbian
|
||||
IMGFILE=$2 # Second argument is the image file to start from ( empty for online installation )
|
||||
|
||||
./install-nextcloud.sh $IP
|
||||
NO_CONFIG=1 ./installer.sh fail2ban.sh $IP $IMG
|
||||
NO_CONFIG=1 NO_CFG_STEP=1 ./installer.sh no-ip.sh $IP $IMG
|
||||
NO_CONFIG=1 NO_CFG_STEP=1 ./installer.sh dnsmasq.sh $IP $IMG
|
||||
IP=$1 # First argument is the QEMU Raspbian IP address
|
||||
IMG=$2 # TODO
|
||||
|
||||
IMG=NextCloudPi_03-13-17.img
|
||||
|
||||
NO_CONFIG=1 NO_HALT_STEP=1 ./install-nextcloud.sh $IP
|
||||
NO_CONFIG=1 NO_CFG_STEP=1 ./installer.sh fail2ban.sh $IP $( ls -1t *.img | head -1 )
|
||||
NO_CONFIG=1 NO_CFG_STEP=1 ./installer.sh no-ip.sh $IP $( ls -1t *.img | head -1 )
|
||||
NO_CONFIG=1 NO_CFG_STEP=1 ./installer.sh dnsmasq.sh $IP $( ls -1t *.img | head -1 )
|
||||
#TODO rename to FULL
|
||||
|
||||
# License
|
||||
#
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# dnsmasq DNS server with cache installation on Raspbian
|
||||
# Tested with 2017-01-11-raspbian-jessie.img (and lite)
|
||||
# Tested with 2017-03-02-raspbian-jessie-lite.img
|
||||
#
|
||||
# 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!
|
||||
@ -46,7 +46,7 @@ EOF
|
||||
IGNORE_RESOLVCONF=yes
|
||||
EOF
|
||||
update-rc.d dnsmasq defaults
|
||||
service dnsmasq start
|
||||
service dnsmasq restart
|
||||
cd /var/www/nextcloud
|
||||
sudo -u www-data php occ config:system:set trusted_domains 2 --value=$DOMAIN_
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Fail2ban installation script for Raspbian
|
||||
# Tested with 2017-01-11-raspbian-jessie.img (and lite)
|
||||
# Tested with 2017-03-02-raspbian-jessie-lite.img
|
||||
#
|
||||
# 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!
|
||||
@ -31,7 +31,7 @@ install()
|
||||
{
|
||||
apt-get update
|
||||
apt-get install fail2ban -y
|
||||
#update-rc.d fail2ban disable
|
||||
update-rc.d fail2ban disable
|
||||
}
|
||||
|
||||
configure()
|
||||
@ -107,8 +107,8 @@ filter = nextcloud
|
||||
logpath = $NCLOG_
|
||||
maxretry = $MAXRETRY_
|
||||
EOF
|
||||
#update-rc.d fail2ban defaults
|
||||
#service fail2ban start
|
||||
update-rc.d fail2ban defaults
|
||||
service fail2ban restart
|
||||
}
|
||||
|
||||
cleanup()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Nextcloud installation on QEMU emulated Raspbian image
|
||||
# Tested with 2017-01-11-raspbian-jessie.img (and lite)
|
||||
# Tested with 2017-03-02-raspbian-jessie-lite.img
|
||||
#
|
||||
# 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!
|
||||
@ -13,12 +13,11 @@
|
||||
# Set DOWNLOAD=0 if you have already downloaded an image. Rename it to nextcloudpi.img
|
||||
|
||||
IP=$1 # First argument is the QEMU Raspbian IP address
|
||||
DOWNLOAD=1 # Download the latest image
|
||||
DOWNLOAD=0 # Download the latest image
|
||||
EXTRACT=1 # Extract the image from zip, so start from 0
|
||||
#IMG=raspbian_latest
|
||||
IMG=raspbian_lite_latest
|
||||
INSTALL_SCRIPT=nextcloud.sh
|
||||
IMGFILE="NextCloudPi_$( date "+%m-%d-%y" ).img-stage0"
|
||||
IMGFILE="NextCloudPi_$( date "+%m-%d-%y" ).img"
|
||||
|
||||
source library.sh # initializes $IMGOUT
|
||||
|
||||
@ -31,7 +30,14 @@ source library.sh # initializes $IMGOUT
|
||||
|
||||
IMGOUT="NextCloudPi_$( date "+%m-%d-%y" ).img"
|
||||
|
||||
launch_install_qemu $INSTALL_SCRIPT $IMGFILE $IP || exit
|
||||
config $INSTALL_SCRIPT || exit 1
|
||||
launch_install_qemu "$IMGFILE" $IP || exit 1
|
||||
|
||||
CONFDIR=/usr/local/etc/nextcloudpi-config.d/
|
||||
copy_to_image $( ls -1t $IMGFILE-stage* | head -1 ) $CONFDIR nc-limits.sh nc-datadir.sh
|
||||
copy_to_image $( ls -1t $IMGFILE-stage* | head -1 ) $CONFDIR/library library.sh
|
||||
copy_to_image $( ls -1t $IMGFILE-stage* | head -1 ) /usr/local/bin/ nextcloudpi-config
|
||||
|
||||
pack_image $IMGFILE $IMGOUT
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Generic software installer for Raspbian. Online on a running RPi, or offline with QEMU.
|
||||
# Tested with 2017-01-11-raspbian-jessie.img (and lite)
|
||||
# Tested with 2017-03-02-raspbian-jessie-lite.img
|
||||
#
|
||||
# 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!
|
||||
@ -33,6 +33,7 @@
|
||||
INSTALL_SCRIPT=$1 # First argument is the script to be run inside Raspbian
|
||||
IP=$2 # Second argument is the QEMU Raspbian IP address
|
||||
IMGFILE=$3 # Third argument is the image file to start from ( empty for online installation )
|
||||
CONFDIR=/usr/local/etc/nextcloudpi-config.d/
|
||||
|
||||
source library.sh # initializes $IMGOUT
|
||||
|
||||
@ -40,6 +41,7 @@ config $INSTALL_SCRIPT || exit 1
|
||||
|
||||
if [[ "$IMGFILE" != "" ]]; then
|
||||
launch_install_qemu "$IMGFILE" $IP || exit 1
|
||||
copy_to_image $( ls -1t $IMGFILE-stage* | head -1 ) $CONFDIR $INSTALL_SCRIPT || exit 1
|
||||
pack_image "$IMGFILE" "$IMGOUT"
|
||||
else
|
||||
launch_installation_online $IP
|
||||
|
||||
33
library.sh
33
library.sh
@ -17,20 +17,22 @@ function launch_install_qemu()
|
||||
[[ "$IP" == "" ]] && { echo "usage: launch_install_qemu <script> <img> <IP>"; return 1; }
|
||||
test -f $IMG || { echo "input file $IMG not found"; return 1; }
|
||||
|
||||
# take a copy of the input image for processing ( append "-stage1" )
|
||||
local BASE=$( sed 's=-stage[[:digit:]]==' <<< $IMG )
|
||||
local NUM=$( sed 's=.*-stage\([[:digit:]]\)=\1=' <<< $IMG )
|
||||
[[ "$BASE" == "$IMG" ]] && NUM=0
|
||||
local IMGFILE="$BASE-stage$(( NUM+1 ))"
|
||||
cp -v $IMG $IMGFILE || return 1
|
||||
|
||||
local NUM_REBOOTS=$( grep -c reboot $INSTALL_SCRIPT )
|
||||
while [[ $NUM_REBOOTS != -1 ]]; do
|
||||
NUM=$(( NUM+1 ))
|
||||
local IMGFILE="$BASE-stage$NUM"
|
||||
cp -v $IMG $IMGFILE || return 1 # take a copy of the input image for processing ( append "-stage1" )
|
||||
|
||||
launch_qemu $IMGFILE &
|
||||
sleep 10
|
||||
wait_SSH $IP
|
||||
launch_installation_qemu $IP || return 1
|
||||
wait
|
||||
IMG="$IMGFILE"
|
||||
NUM_REBOOTS=$(( NUM_REBOOTS-1 ))
|
||||
done
|
||||
echo "$IMGFILE generated successfully"
|
||||
@ -97,12 +99,14 @@ set -e$DBG
|
||||
function launch_installation_qemu()
|
||||
{
|
||||
local IP=$1
|
||||
[[ "$NO_CFG_STEP" != "1" ]] && local CFG_STEP=configure
|
||||
[[ "$NO_CFG_STEP" != "1" ]] && local CFG_STEP=configure
|
||||
[[ "$NO_CLEANUP" != "1" ]] && local CLEANUP_STEP=cleanup
|
||||
[[ "$NO_HALT_STEP" != "1" ]] && local HALT_STEP="nohup halt &>/dev/null &"
|
||||
local INSTALLATION_STEPS="
|
||||
install
|
||||
$CFG_STEP
|
||||
cleanup
|
||||
nohup halt &>/dev/null &
|
||||
$CLEANUP_STEP
|
||||
$HALT_STEP
|
||||
"
|
||||
launch_installation $IP
|
||||
}
|
||||
@ -146,7 +150,7 @@ function config()
|
||||
local value
|
||||
value=$( dialog --ok-label "Start" \
|
||||
--backtitle "$BACKTITLE" \
|
||||
--form "$( basename "$INSTALL_SCRIPT" .sh ) Enter the desired configuration" \
|
||||
--form "Enter the desired configuration for $( basename "$INSTALL_SCRIPT" .sh )" \
|
||||
20 70 0 $PARAM \
|
||||
3>&1 1>&2 2>&3 )
|
||||
RET=$?
|
||||
@ -205,6 +209,21 @@ function config()
|
||||
[[ "$CFGOUT" != "" ]] && echo -e "$CONFIG" > "$CFGOUT"
|
||||
}
|
||||
|
||||
function copy_to_image()
|
||||
{
|
||||
local IMG=$1
|
||||
local DST=$2
|
||||
local SRC=${@: 3 }
|
||||
local SECTOR=$( fdisk -l $IMG | grep Linux | awk '{ print $2 }' )
|
||||
local OFFSET=$(( SECTOR * 512 ))
|
||||
|
||||
mkdir -p tmpmnt
|
||||
sudo mount $IMG -o offset=$OFFSET tmpmnt || return 1
|
||||
sudo cp $SRC tmpmnt/$DST || return 1
|
||||
sudo umount -l tmpmnt
|
||||
rmdir tmpmnt &>/dev/null
|
||||
}
|
||||
|
||||
function pack_image()
|
||||
{
|
||||
local IMGFILE="$1"
|
||||
|
||||
57
nc-datadir.sh
Executable file
57
nc-datadir.sh
Executable file
@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Data dir configuration script for NextCloudPi
|
||||
# Tested with 2017-03-02-raspbian-jessie-lite.img
|
||||
#
|
||||
# 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!
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# ./installer.sh nc-datadir.sh <IP> (<img>)
|
||||
#
|
||||
# See installer.sh instructions for details
|
||||
#
|
||||
|
||||
DATADIR_=/media/USBdrive/ncdata
|
||||
DESCRIPTION="Change your data dir location"
|
||||
|
||||
configure()
|
||||
{
|
||||
[ -d $DATADIR_ ] && { echo "$DATADIR_ already exists" && return 1; }
|
||||
|
||||
service apache2 stop
|
||||
|
||||
local BASEDIR=$( dirname "$DATADIR_" )
|
||||
mkdir -p "$BASEDIR"
|
||||
|
||||
[[ $( stat -fc%d / ) == $( stat -fc%d $BASEDIR ) ]] && \
|
||||
echo -e "INFO: moving data dir to another place in the same SD card\nIf you want to use an external mount, make sure it is properly set up"
|
||||
|
||||
cp -ra /var/www/nextcloud/data/ "$DATADIR_" || return 1
|
||||
|
||||
cd /var/www/nextcloud
|
||||
sudo -u www-data php occ config:system:set datadirectory --value=$DATADIR_
|
||||
service apache2 start
|
||||
}
|
||||
|
||||
install() { :; }
|
||||
cleanup() { :; }
|
||||
|
||||
# License
|
||||
#
|
||||
# This script is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This script is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this script; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
@ -1,43 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# nextcloudpi-config installation on Raspbian
|
||||
# Tested with 2017-01-11-raspbian-jessie.img (and lite)
|
||||
# System limit configurator for NextCloudPi
|
||||
# Tested with 2017-03-02-raspbian-jessie-lite.img
|
||||
#
|
||||
# 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!
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# ./installer.sh nextcloudpi-config.sh <IP> (<img>)
|
||||
# ./installer.sh nc-limits.sh <IP> (<img>)
|
||||
#
|
||||
# See installer.sh instructions for details
|
||||
#
|
||||
|
||||
CONFDIR=/usr/local/etc/nextcloudpi-config.d/
|
||||
|
||||
install()
|
||||
{
|
||||
apt-get update
|
||||
apt-get install -y dialog
|
||||
mkdir -p $CONFDIR
|
||||
chown pi $CONFDIR # TODO
|
||||
# scp dnsmasq.sh no-ip.sh pi@192.168.0.130:/usr/local/etc/nextcloudpi-config.d
|
||||
# scp library nextcloudpi-config pi@192.168.0.130:/usr/local/bin/
|
||||
}
|
||||
DESCRIPTION="Configure system limits for NextCloudPi"
|
||||
MAXFILESIZE_=768M
|
||||
|
||||
configure()
|
||||
{
|
||||
echo nothin
|
||||
sed -i "s/post_max_size=.*/post_max_size=$MAXFILESIZE_/" /var/www/nextcloud/.user.ini
|
||||
sed -i "s/upload_max_filesize=.*/upload_max_filesize=$MAXFILESIZE_/" /var/www/nextcloud/.user.ini
|
||||
sed -i "s/memory_limit=.*/memory_limit=$MAXFILESIZE_/" /var/www/nextcloud/.user.ini
|
||||
}
|
||||
|
||||
cleanup()
|
||||
{
|
||||
apt-get autoremove -y
|
||||
apt-get clean
|
||||
rm /var/lib/apt/lists/* -r
|
||||
rm -f /home/pi/.bash_history
|
||||
systemctl disable ssh
|
||||
}
|
||||
install() { :; }
|
||||
cleanup() { :; }
|
||||
|
||||
# License
|
||||
#
|
||||
86
nextcloud.sh
86
nextcloud.sh
@ -1,36 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Nextcloud installation on Raspbian through SSH
|
||||
# Tested with 2017-01-11-raspbian-jessie.img (and lite)
|
||||
# Nextcloud installation on Raspbian
|
||||
# Tested with 2017-03-02-raspbian-jessie-lite.img
|
||||
#
|
||||
# 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!
|
||||
#
|
||||
# Usage:
|
||||
# cat nextcloud.sh | sshpass -praspberry ssh pi@$IP
|
||||
#
|
||||
# ./installer.sh no-ip.sh <IP> (<img>)
|
||||
#
|
||||
# , or scp this file to a Raspberry Pi and run it from Raspbian
|
||||
#
|
||||
# ./nextcloud.sh
|
||||
# See installer.sh instructions for details
|
||||
#
|
||||
# Notes:
|
||||
# Upon each necessary restart, the system will cut the SSH session, therefore
|
||||
# it is required to save the state of the installation. See variable $STATE_FILE
|
||||
# It will be necessary to invoke this a number of times for a complete installation
|
||||
|
||||
set -xe
|
||||
|
||||
sudo su
|
||||
|
||||
VER=11.0.1
|
||||
ADMINUSER_=admin
|
||||
DBADMIN_=ncadmin
|
||||
DBPASSWD_=ownyourbits
|
||||
MAX_FILESIZE_=1G
|
||||
MAXFILESIZE_=768M
|
||||
MAXTRANSFERTIME_=3600
|
||||
OPCACHEDIR=/var/www/nextcloud/data/.opcache
|
||||
CONFDIR=/usr/local/etc/nextcloudpi-config.d/
|
||||
STATE_FILE=/home/pi/.installation_state
|
||||
|
||||
set -xe
|
||||
|
||||
install()
|
||||
{
|
||||
test -f $STATE_FILE && STATE=$( cat $STATE_FILE 2>/dev/null )
|
||||
if [ "$STATE" == "" ]; then
|
||||
|
||||
@ -41,7 +40,7 @@ if [ "$STATE" == "" ]; then
|
||||
echo -e "d\n2\nn\np\n2\n$SECTOR\n\nw\n" | fdisk /dev/sda || true
|
||||
|
||||
echo 0 > $STATE_FILE
|
||||
reboot
|
||||
nohup reboot &>/dev/null &
|
||||
elif [ "$STATE" == "0" ]; then
|
||||
|
||||
# UPDATE EVERYTHING
|
||||
@ -55,7 +54,7 @@ elif [ "$STATE" == "0" ]; then
|
||||
echo -e "y\n" | rpi-update
|
||||
|
||||
echo 1 > $STATE_FILE
|
||||
reboot
|
||||
nohup reboot &>/dev/null &
|
||||
elif [ "$STATE" == "1" ]; then
|
||||
|
||||
# GET STRETCH SOURCES FOR HTTP2 AND PHP7
|
||||
@ -118,7 +117,7 @@ EOF
|
||||
|
||||
cat > /etc/php/7.0/mods-available/opcache.ini <<EOF
|
||||
zend_extension=opcache.so
|
||||
opcache.file_cache=/var/www/nextcloud/.opcache;
|
||||
opcache.file_cache=$OPCACHEDIR;
|
||||
opcache.fast_shutdown=1
|
||||
EOF
|
||||
|
||||
@ -133,6 +132,10 @@ EOF
|
||||
a2enmod mime
|
||||
a2enmod ssl
|
||||
|
||||
echo 2 > $STATE_FILE
|
||||
nohup reboot &>/dev/null &
|
||||
|
||||
elif [ "$STATE" == "2" ]; then
|
||||
# INSTALL NEXTCLOUD
|
||||
##########################################
|
||||
|
||||
@ -140,7 +143,6 @@ EOF
|
||||
wget https://download.nextcloud.com/server/releases/nextcloud-$VER.tar.bz2 -O nextcloud.tar.bz2
|
||||
tar -xvf nextcloud.tar.bz2
|
||||
rm nextcloud.tar.bz2
|
||||
mkdir /var/www/nextcloud/.opcache
|
||||
|
||||
ocpath='/var/www/nextcloud'
|
||||
htuser='www-data'
|
||||
@ -150,30 +152,34 @@ EOF
|
||||
printf "Creating possible missing Directories\n"
|
||||
mkdir -p $ocpath/data
|
||||
mkdir -p $ocpath/updater
|
||||
mkdir -p $OPCACHEDIR
|
||||
|
||||
printf "chmod Files and Directories\n"
|
||||
find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640
|
||||
find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750
|
||||
|
||||
printf "chown Directories\n"
|
||||
chown -R ${rootuser}:${htgroup} ${ocpath}/
|
||||
# recommended defaults do not play well with updater app
|
||||
# re-check this with every new version
|
||||
#chown -R ${rootuser}:${htgroup} ${ocpath}/
|
||||
chown -R ${htuser}:${htgroup} ${ocpath}/
|
||||
chown -R ${htuser}:${htgroup} ${ocpath}/apps/
|
||||
chown -R ${htuser}:${htgroup} ${ocpath}/config/
|
||||
chown -R ${htuser}:${htgroup} ${ocpath}/data/
|
||||
chown -R ${htuser}:${htgroup} ${ocpath}/themes/
|
||||
chown -R ${htuser}:${htgroup} ${ocpath}/updater/
|
||||
chown -R ${htuser}:${htgroup} ${ocpath}/.opcache/
|
||||
chown -R ${htuser}:${htgroup} $OPCACHEDIR
|
||||
|
||||
chmod +x ${ocpath}/occ
|
||||
|
||||
printf "chmod/chown .htaccess\n"
|
||||
if [ -f ${ocpath}/.htaccess ]
|
||||
then
|
||||
chmod 0644 ${ocpath}/.htaccess
|
||||
if [ -f ${ocpath}/.htaccess ]; then
|
||||
# breaks updater, see above
|
||||
#chmod 0644 ${ocpath}/.htaccess
|
||||
chmod 0664 ${ocpath}/.htaccess
|
||||
chown ${rootuser}:${htgroup} ${ocpath}/.htaccess
|
||||
fi
|
||||
if [ -f ${ocpath}/data/.htaccess ]
|
||||
then
|
||||
if [ -f ${ocpath}/data/.htaccess ]; then
|
||||
chmod 0644 ${ocpath}/data/.htaccess
|
||||
chown ${rootuser}:${htgroup} ${ocpath}/data/.htaccess
|
||||
fi
|
||||
@ -217,8 +223,15 @@ GRANT ALL PRIVILEGES ON nextcloud.* TO $DBADMIN_@localhost;
|
||||
EXIT
|
||||
EOF
|
||||
|
||||
# CONFIGURE NEXTCLOUD
|
||||
##########################################
|
||||
# NEXTCLOUDPI-CONFIG
|
||||
apt-get install -y dialog
|
||||
mkdir -p $CONFDIR
|
||||
fi
|
||||
}
|
||||
|
||||
configure()
|
||||
{
|
||||
[ "$STATE" != "2" ] && return
|
||||
cd /var/www/nextcloud/
|
||||
|
||||
sudo -u www-data php occ maintenance:install --database \
|
||||
@ -227,12 +240,14 @@ EOF
|
||||
|
||||
sudo -u www-data php occ background:cron
|
||||
|
||||
sed -i '$s=^.*$= '\''memcache.local'\'' \=> '\''\\OC\\Memcache\\APCu'\'',\n);=' /var/www/nextcloud/config/config.php
|
||||
sed -i '$s|^.*$| '\''memcache.local'\'' => '\''\\\\OC\\\\Memcache\\\\APCu'\'',\\n);|' /var/www/nextcloud/config/config.php
|
||||
|
||||
sed -i "s/post_max_size=.*/post_max_size=$MAX_FILESIZE_/" /var/www/nextcloud/.user.ini
|
||||
sed -i "s/post_max_size=.*/upload_max_filesize=$MAX_FILESIZE_/" /var/www/nextcloud/.user.ini
|
||||
sed -i "s/post_max_size=.*/post_max_size=$MAX_FILESIZE_/" /var/www/nextcloud/.htaccess
|
||||
sed -i "s/post_max_size=.*/upload_max_filesize=$MAX_FILESIZE_/" /var/www/nextcloud/.htaccess
|
||||
sed -i "s/post_max_size=.*/post_max_size=$MAXFILESIZE_/" /var/www/nextcloud/.user.ini
|
||||
sed -i "s/upload_max_filesize=.*/upload_max_filesize=$MAXFILESIZE_/" /var/www/nextcloud/.user.ini
|
||||
sed -i "s/memory_limit=.*/memory_limit=$MAXFILESIZE_/" /var/www/nextcloud/.user.ini
|
||||
|
||||
# slow transfers will be killed after this time
|
||||
cat >> /var/www/nextcloud/.user.ini <<< "max_execution_time=$MAXTRANSFERTIME_"
|
||||
|
||||
echo "*/15 * * * * php -f /var/www/nextcloud/cron.php" > /tmp/crontab_http
|
||||
crontab -u www-data /tmp/crontab_http
|
||||
@ -260,10 +275,11 @@ ExecStart=/bin/bash /usr/local/bin/nextcloud-domain.sh
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable nextcloud-domain
|
||||
}
|
||||
|
||||
# CLEANUP
|
||||
##########################################
|
||||
|
||||
cleanup()
|
||||
{
|
||||
[ "$STATE" != "2" ] && return
|
||||
apt-get autoremove -y
|
||||
apt-get clean
|
||||
rm /var/lib/apt/lists/* -r
|
||||
@ -271,8 +287,8 @@ EOF
|
||||
|
||||
systemctl disable ssh
|
||||
rm $STATE_FILE
|
||||
halt
|
||||
fi
|
||||
nohup halt &>/dev/null &
|
||||
}
|
||||
|
||||
# License
|
||||
#
|
||||
|
||||
@ -20,11 +20,11 @@ function nextcloud-config()
|
||||
local LIST=()
|
||||
for item in $CONFDIR/*.sh; do
|
||||
local DESC="$( grep "DESCRIPTION=" $item | sed 's|^DESCRIPTION=||' )"
|
||||
LIST+=( $( basename $item .sh ) "$DESC" off )
|
||||
LIST+=( $( basename $item .sh ) "$DESC" )
|
||||
done
|
||||
local script
|
||||
script=$( dialog --backtitle "NextCloudPi configuration" \
|
||||
--radiolist "Select program to configure and activate:" 20 80 10 \
|
||||
--menu "Select program to configure and activate:" 20 80 10 \
|
||||
"${LIST[@]}" \
|
||||
3>&1 1>&2 2>&3 )
|
||||
|
||||
|
||||
4
no-ip.sh
4
no-ip.sh
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# no-ip.org installation on Raspbian
|
||||
# Tested with 2017-01-11-raspbian-jessie.img (and lite)
|
||||
# Tested with 2017-03-02-raspbian-jessie-lite.img
|
||||
#
|
||||
# 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!
|
||||
@ -52,7 +52,7 @@ configure()
|
||||
{
|
||||
/usr/local/bin/noip2 -C -c /usr/local/etc/no-ip2.conf -U $TIME_ -u $USER_ -p $PASS_
|
||||
update-rc.d noip2 defaults
|
||||
service noip2 start
|
||||
service noip2 restart
|
||||
}
|
||||
|
||||
cleanup()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user