diff options
author | nachoparker <nacho@ownyourbits.com> | 2017-03-29 19:33:55 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2017-03-31 18:42:32 +0300 |
commit | 75b42680feb34185107c6ebeae6162ec26f07f48 (patch) | |
tree | db1b1dd3d200ecbfd74df60827f268685cfe218e | |
parent | 7aa9c1c0910901b4f93b5307a3c42e1e340f2aef (diff) |
ncp updates and motd. structure directoriesv0.1.0
-rw-r--r-- | .gitignore | 2 | ||||
-rwxr-xr-x | batch.sh | 2 | ||||
-rwxr-xr-x | bin/nextcloudpi-config (renamed from nextcloudpi-config) | 11 | ||||
-rwxr-xr-x | etc/library.sh (renamed from library.sh) | 29 | ||||
-rw-r--r-- | etc/ncp-ascii.txt | 30 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/dnsmasq.sh (renamed from dnsmasq.sh) | 0 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/fail2ban.sh (renamed from fail2ban.sh) | 0 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/letsencrypt.sh (renamed from letsencrypt.sh) | 0 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/modsecurity.sh (renamed from modsecurity.sh) | 0 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/nc-datadir.sh (renamed from nc-datadir.sh) | 0 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/nc-httpsonly.sh (renamed from nc-httpsonly.sh) | 0 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/nc-limits.sh (renamed from nc-limits.sh) | 0 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/nc-update.sh | 44 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/no-ip.sh (renamed from no-ip.sh) | 0 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/unattended-upgrades.sh (renamed from unattended-upgrades.sh) | 0 | ||||
-rwxr-xr-x | install-nextcloud.sh | 11 | ||||
-rwxr-xr-x | installer.sh | 6 | ||||
-rwxr-xr-x | nextcloud.sh | 103 | ||||
-rwxr-xr-x | update.sh | 46 |
19 files changed, 260 insertions, 24 deletions
@@ -1 +1,3 @@ .*.swp +*.img +*.bz2 @@ -9,7 +9,7 @@ # Usage: # -source library.sh # initializes $IMGNAME +source etc/library.sh # initializes $IMGNAME IP=$1 # First argument is the QEMU Raspbian IP address diff --git a/nextcloudpi-config b/bin/nextcloudpi-config index 453b7de8..f4cb7a70 100755 --- a/nextcloudpi-config +++ b/bin/nextcloudpi-config @@ -14,7 +14,7 @@ CONFDIR=/usr/local/etc/nextcloudpi-config.d/ -source $CONFDIR/library +source /usr/local/etc/library.sh function nextcloud-config() { @@ -34,14 +34,7 @@ function nextcloud-config() [[ $? -ne $DIALOG_OK ]] || [[ "$script" == "" ]] && return 0 - ( - cd $CONFDIR - config $script.sh || return 1 # writes "$INSTALLATION_CODE" - echo -e "$INSTALLATION_CODE" > $script.sh # save configuration - source ./$script.sh # load configuration - set +x - configure - ) + configure_script $script.sh } if [ $(id -u) -ne 0 ]; then diff --git a/library.sh b/etc/library.sh index 34e6201a..a9a4bc94 100755 --- a/library.sh +++ b/etc/library.sh @@ -202,6 +202,33 @@ function config() [[ "$CFGOUT" != "" ]] && echo -e "$CONFIG" > "$CFGOUT" } + +function install_script() +{ + ( + local SCRIPT=$1 + source ./$SCRIPT + echo -e "Installing \e[1m$( basename $SCRIPT .sh )\e[0m" + set +x + install + cleanup + ) +} + +function configure_script() +{ + ( + local SCRIPT=$1 + cd /usr/local/etc/nextcloudpi-config.d/ + config $SCRIPT || return 1 # writes "$INSTALLATION_CODE" + echo -e "$INSTALLATION_CODE" > $SCRIPT # save configuration + source ./$SCRIPT # load configuration + echo -e "Configuring \e[1m$( basename $SCRIPT .sh )\e[0m" + set +x + configure + ) +} + function copy_to_image() { local IMG=$1 @@ -223,7 +250,7 @@ function pack_image() local IMGOUT="$1" local IMGNAME="$2" local TARNAME=$( basename $IMGNAME .img ).tar.bz2 - echo "copying $IMGNAME → $TARNAME" + echo "copying $IMGOUT → $IMGNAME" cp "$IMGOUT" "$IMGNAME" || return 1 echo "packing $IMGNAME → $TARNAME" tar -I pbzip2 -cvf $TARNAME "$IMGNAME" &>/dev/null && \ diff --git a/etc/ncp-ascii.txt b/etc/ncp-ascii.txt new file mode 100644 index 00000000..9e48f50b --- /dev/null +++ b/etc/ncp-ascii.txt @@ -0,0 +1,30 @@ +[48;5;16;38;5;16m▄▄▄[38;5;235m▄[48;5;232;38;5;31m▄[48;5;23;38;5;32m▄[48;5;24m▄[48;5;31m▄[48;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[48;5;31m▄[48;5;24m▄[48;5;23m▄[48;5;232;38;5;25m▄[48;5;16;38;5;233m▄[38;5;16m▄▄▄[0m +[48;5;16;38;5;16m▄[38;5;235m▄[48;5;23;38;5;32m▄[48;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[48;5;31m▄[48;5;233;38;5;31m▄[48;5;16;38;5;233m▄[38;5;16m▄[0m +[48;5;232;38;5;23m▄[48;5;31;38;5;32m▄[48;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[48;5;25m▄[48;5;16;38;5;23m▄[0m +[48;5;24;38;5;31m▄[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[48;5;24;38;5;31m▄[0m +[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[0m +[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[38;5;31m▄[38;5;24m▄[38;5;23m▄[38;5;235m▄[38;5;234m▄[38;5;233m▄[38;5;234m▄[38;5;236m▄[38;5;23m▄[38;5;31m▄[38;5;32m▄▄▄▄[38;5;31m▄[38;5;23m▄[38;5;235m▄[38;5;234m▄[38;5;233m▄[38;5;234m▄[38;5;235m▄[38;5;23m▄[38;5;24m▄[38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[0m +[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[48;5;23;38;5;237m▄[48;5;232;38;5;58m▄[48;5;234;38;5;70m▄[48;5;58;38;5;106m▄[48;5;64m▄▄▄▄[48;5;58m▄[48;5;235;38;5;70m▄[48;5;232;38;5;64m▄[48;5;24;38;5;233m▄[48;5;32;38;5;31m▄[38;5;23m▄[48;5;236;38;5;234m▄[48;5;232;38;5;64m▄[48;5;235;38;5;106m▄[48;5;64m▄▄▄▄[48;5;58m▄▄[48;5;233;38;5;70m▄[38;5;235m▄[48;5;25;38;5;24m▄[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[0m +[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[48;5;236;38;5;23m▄[48;5;58;38;5;234m▄[48;5;106;38;5;106m▄▄[48;5;70m▄[48;5;64;38;5;70m▄[48;5;70;38;5;58m▄[48;5;106m▄[38;5;70m▄[38;5;106m▄▄[48;5;64;38;5;70m▄[48;5;236;38;5;232m▄[48;5;232;38;5;235m▄[48;5;64;38;5;106m▄[48;5;106m▄▄[38;5;64m▄[38;5;58m▄[48;5;70m▄[48;5;64;38;5;70m▄[48;5;70;38;5;106m▄[48;5;106m▄[38;5;70m▄[48;5;234;38;5;233m▄[48;5;24;38;5;31m▄[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[0m +[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[48;5;31m▄[48;5;232;38;5;236m▄[48;5;64;38;5;58m▄[48;5;106;38;5;106m▄▄▄▄[48;5;64m▄[48;5;235;38;5;70m▄[48;5;64;38;5;235m▄[48;5;106;38;5;58m▄[48;5;70m▄[48;5;232;38;5;16m▄[48;5;235m▄[48;5;106;38;5;58m▄[38;5;236m▄[48;5;58;38;5;58m▄[48;5;236;38;5;106m▄[48;5;64m▄[48;5;106m▄▄▄[38;5;70m▄[48;5;64;38;5;234m▄[48;5;235;38;5;23m▄[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[0m +[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[48;5;24m▄[48;5;233;38;5;24m▄[48;5;58;38;5;233m▄[48;5;106;38;5;236m▄[38;5;70m▄[38;5;106m▄▄▄[48;5;70;38;5;58m▄[48;5;233;38;5;16m▄[48;5;16m▄▄▄▄[48;5;235;38;5;232m▄[48;5;106;38;5;64m▄[38;5;106m▄▄▄[38;5;70m▄[48;5;70;38;5;234m▄[48;5;236m▄[48;5;235;38;5;31m▄[48;5;31;38;5;32m▄[48;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[0m +[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[48;5;25;38;5;25m▄[48;5;234;38;5;234m▄[48;5;233;38;5;232m▄[48;5;58;38;5;52m▄▄[48;5;235;38;5;233m▄[48;5;16;38;5;16m▄[38;5;52m▄[38;5;125m▄[48;5;233m▄[48;5;232m▄[48;5;16;38;5;89m▄[38;5;234m▄[48;5;232;38;5;232m▄[48;5;236;38;5;52m▄[48;5;58m▄[38;5;233m▄[48;5;232;38;5;16m▄[48;5;236;38;5;237m▄[48;5;31;38;5;31m▄[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[0m +[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄[38;5;74m▄▄[38;5;32m▄▄▄▄▄▄▄[38;5;31m▄[48;5;24;38;5;233m▄[48;5;233;38;5;88m▄[48;5;52;38;5;125m▄[48;5;125m▄▄[38;5;232m▄[48;5;232;38;5;16m▄[48;5;52;38;5;52m▄[48;5;125;38;5;125m▄▄▄▄▄▄[48;5;52;38;5;52m▄[48;5;89;38;5;232m▄[48;5;125;38;5;89m▄[38;5;125m▄[48;5;88m▄[48;5;232;38;5;89m▄[48;5;234;38;5;16m▄[48;5;31;38;5;236m▄[48;5;32;38;5;32m▄▄▄▄▄▄▄▄[38;5;74m▄▄[38;5;32m▄▄▄▄▄▄▄▄▄[0m +[48;5;32;38;5;32m▄▄▄▄▄[38;5;189m▄[48;5;74;38;5;231m▄[48;5;189m▄[48;5;231m▄▄▄▄[48;5;195m▄[48;5;110m▄[48;5;32;38;5;189m▄[38;5;32m▄▄▄[48;5;24;38;5;24m▄[48;5;232;38;5;234m▄[48;5;125;38;5;125m▄[38;5;88m▄[48;5;89;38;5;232m▄[48;5;232;38;5;16m▄[48;5;16;38;5;52m▄▄▄[48;5;52;38;5;232m▄[48;5;125;38;5;16m▄[38;5;232m▄[38;5;16m▄▄[48;5;52;38;5;52m▄[48;5;16;38;5;89m▄[38;5;88m▄[38;5;52m▄[48;5;88;38;5;16m▄[48;5;125;38;5;52m▄[38;5;125m▄[48;5;234;38;5;52m▄[48;5;232;38;5;16m▄[48;5;32;38;5;31m▄[38;5;32m▄▄[38;5;74m▄[38;5;231m▄[48;5;116m▄[48;5;231m▄▄▄▄▄[48;5;153m▄[48;5;74m▄[48;5;32;38;5;152m▄[38;5;32m▄▄▄▄▄[0m +[48;5;32;38;5;32m▄▄▄[38;5;189m▄[48;5;195;38;5;231m▄[48;5;231m▄▄▄▄▄▄▄▄▄▄[48;5;195m▄[48;5;74;38;5;195m▄[48;5;32;38;5;60m▄[48;5;23;38;5;232m▄[48;5;232;38;5;234m▄[48;5;234;38;5;16m▄[48;5;16m▄[48;5;233;38;5;89m▄[48;5;89;38;5;125m▄[48;5;125m▄▄▄▄[48;5;234m▄[48;5;16;38;5;16m▄[38;5;234m▄[48;5;88;38;5;125m▄[48;5;125m▄▄▄▄[48;5;89m▄[48;5;232;38;5;88m▄[48;5;233;38;5;16m▄[48;5;234;38;5;233m▄[48;5;16;38;5;234m▄[48;5;24;38;5;232m▄[48;5;32;38;5;67m▄[48;5;74;38;5;231m▄[48;5;231m▄▄▄▄▄▄▄▄▄▄▄[48;5;189m▄[48;5;32;38;5;152m▄[38;5;32m▄▄▄[0m +[48;5;32;38;5;32m▄▄[48;5;74;38;5;189m▄[48;5;231;38;5;231m▄▄▄▄[38;5;153m▄[38;5;32m▄[48;5;153m▄▄[48;5;231m▄[38;5;152m▄[38;5;231m▄▄▄[48;5;250;38;5;237m▄[48;5;232;38;5;52m▄[48;5;89;38;5;125m▄[48;5;125m▄[48;5;16;38;5;232m▄[48;5;233;38;5;52m▄[48;5;125;38;5;125m▄▄▄▄▄▄▄[48;5;232;38;5;232m▄[48;5;52;38;5;234m▄[48;5;125;38;5;125m▄▄▄▄▄▄▄[48;5;232;38;5;233m▄[48;5;88;38;5;89m▄[48;5;125;38;5;125m▄[48;5;52m▄[48;5;235;38;5;16m▄[48;5;231;38;5;245m▄[38;5;231m▄▄▄[38;5;74m▄[48;5;195;38;5;32m▄[48;5;153m▄[48;5;189m▄[48;5;231m▄[38;5;189m▄[38;5;231m▄▄▄▄[48;5;32;38;5;116m▄[38;5;32m▄▄[0m +[48;5;32;38;5;32m▄[38;5;74m▄[48;5;231;38;5;231m▄▄▄▄[38;5;189m▄[48;5;32;38;5;32m▄▄▄▄▄▄[48;5;189;38;5;110m▄[48;5;231;38;5;231m▄[48;5;254;38;5;254m▄[48;5;232;38;5;16m▄[48;5;125;38;5;125m▄▄▄[48;5;232;38;5;16m▄[48;5;52;38;5;233m▄[48;5;125;38;5;125m▄▄▄▄▄▄[48;5;88;38;5;233m▄[48;5;16;38;5;16m▄▄[48;5;125;38;5;234m▄[38;5;125m▄▄▄▄▄[38;5;89m▄[48;5;232;38;5;16m▄[48;5;89;38;5;52m▄[48;5;125;38;5;125m▄▄[48;5;233;38;5;233m▄[48;5;238;38;5;236m▄[48;5;231;38;5;231m▄▄[48;5;116;38;5;74m▄[48;5;32;38;5;32m▄▄▄▄▄[48;5;74m▄[48;5;231;38;5;231m▄▄▄▄[48;5;189m▄[48;5;32;38;5;32m▄▄[0m +[48;5;32;38;5;32m▄[48;5;74m▄[48;5;231;38;5;231m▄▄▄▄[48;5;153m▄[48;5;32;38;5;32m▄▄▄▄▄▄[48;5;110;38;5;189m▄[48;5;231;38;5;231m▄▄[48;5;232;38;5;241m▄[48;5;89;38;5;234m▄[48;5;125;38;5;125m▄[48;5;88;38;5;234m▄[48;5;16;38;5;16m▄▄[48;5;52m▄[48;5;125;38;5;233m▄[38;5;52m▄▄[38;5;232m▄[48;5;233;38;5;52m▄[48;5;232;38;5;125m▄[48;5;233m▄▄[48;5;16m▄[48;5;234;38;5;52m▄[48;5;125;38;5;232m▄[38;5;233m▄▄[38;5;16m▄[48;5;233m▄[48;5;16m▄[48;5;52;38;5;232m▄[48;5;125;38;5;125m▄[38;5;52m▄[48;5;232;38;5;16m▄[48;5;239;38;5;249m▄[48;5;231;38;5;231m▄▄[48;5;74;38;5;116m▄[48;5;32;38;5;32m▄▄▄▄▄[38;5;74m▄[48;5;231;38;5;231m▄▄▄▄[38;5;195m▄[48;5;32;38;5;32m▄▄[0m +[48;5;32;38;5;32m▄▄[48;5;189;38;5;74m▄[48;5;231;38;5;231m▄▄▄▄[48;5;153m▄[48;5;32;38;5;195m▄[38;5;116m▄[38;5;110m▄[38;5;189m▄[48;5;152;38;5;231m▄[48;5;231m▄▄▄[48;5;254m▄[48;5;235;38;5;244m▄[48;5;233;38;5;16m▄[48;5;232;38;5;88m▄[48;5;52;38;5;125m▄[48;5;234m▄[48;5;16;38;5;88m▄[38;5;16m▄▄▄[48;5;52;38;5;125m▄[48;5;125m▄▄▄▄▄▄[48;5;52;38;5;89m▄[48;5;16;38;5;16m▄▄[38;5;52m▄[48;5;52;38;5;125m▄[48;5;125m▄[48;5;89m▄[48;5;232;38;5;52m▄[48;5;16;38;5;16m▄[48;5;241;38;5;252m▄[48;5;231;38;5;231m▄▄▄▄[48;5;74m▄[48;5;32;38;5;153m▄[38;5;110m▄[38;5;152m▄[38;5;231m▄[48;5;189m▄[48;5;231m▄▄▄▄[48;5;116;38;5;68m▄[48;5;32;38;5;32m▄▄[0m +[48;5;32;38;5;32m▄▄▄[48;5;195;38;5;74m▄[48;5;231;38;5;231m▄▄▄▄▄▄▄▄▄▄▄▄[38;5;74m▄[48;5;67;38;5;32m▄[48;5;16;38;5;234m▄[48;5;125;38;5;89m▄[38;5;125m▄▄▄[48;5;88m▄[48;5;16;38;5;52m▄[38;5;16m▄[48;5;125;38;5;89m▄[38;5;125m▄▄▄▄▄▄[38;5;88m▄[48;5;16;38;5;233m▄[48;5;52;38;5;125m▄[48;5;125m▄▄▄▄[48;5;52;38;5;52m▄[48;5;234;38;5;23m▄[48;5;74;38;5;32m▄[48;5;231;38;5;110m▄[38;5;231m▄▄▄▄▄▄▄▄▄▄▄[38;5;195m▄[48;5;153;38;5;32m▄[48;5;32m▄▄▄[0m +[48;5;32;38;5;32m▄▄▄▄[48;5;74m▄[48;5;195m▄[48;5;231;38;5;116m▄[38;5;231m▄▄▄▄▄▄[38;5;153m▄[48;5;195;38;5;32m▄[48;5;74m▄[48;5;32m▄▄[48;5;23;38;5;25m▄[48;5;52;38;5;232m▄[48;5;125;38;5;89m▄[38;5;125m▄▄▄▄[48;5;232;38;5;233m▄[48;5;52;38;5;16m▄[48;5;125;38;5;52m▄[38;5;125m▄▄▄[38;5;89m▄[38;5;234m▄[48;5;233;38;5;16m▄[48;5;52;38;5;89m▄[48;5;125;38;5;125m▄▄▄▄[38;5;52m▄[48;5;232;38;5;233m▄[48;5;24;38;5;31m▄[48;5;32;38;5;32m▄▄[48;5;110m▄[48;5;231;38;5;74m▄[38;5;189m▄[38;5;231m▄▄▄▄▄[38;5;195m▄[38;5;74m▄[48;5;189;38;5;32m▄[48;5;32m▄▄▄▄▄[0m +[48;5;32;38;5;32m▄▄▄▄▄▄▄▄[48;5;74m▄▄▄▄[48;5;32m▄▄▄▄▄▄▄[48;5;23m▄[48;5;232;38;5;24m▄[48;5;88;38;5;233m▄[48;5;125m▄[38;5;52m▄[38;5;233m▄[48;5;232;38;5;16m▄[48;5;16;38;5;232m▄[38;5;52m▄▄[48;5;232;38;5;88m▄▄[48;5;16m▄[38;5;52m▄[38;5;232m▄[48;5;89m▄[48;5;125;38;5;52m▄▄[38;5;233m▄[48;5;52;38;5;235m▄[48;5;232;38;5;25m▄[48;5;24;38;5;32m▄[48;5;32m▄▄▄▄▄▄▄[48;5;74m▄[48;5;110m▄[48;5;74m▄▄[48;5;32m▄▄▄▄▄▄▄▄[0m +[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[48;5;23m▄[48;5;16;38;5;24m▄[38;5;235m▄[38;5;16m▄[48;5;125;38;5;52m▄[38;5;125m▄▄▄▄▄▄[48;5;88;38;5;233m▄[48;5;16;38;5;232m▄[38;5;237m▄[48;5;232;38;5;31m▄[48;5;24;38;5;32m▄[48;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[0m +[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[48;5;25m▄[48;5;234;38;5;31m▄[48;5;52;38;5;23m▄[48;5;88;38;5;234m▄[48;5;125;38;5;232m▄[48;5;89;38;5;234m▄[48;5;52;38;5;23m▄[48;5;233;38;5;31m▄[48;5;236;38;5;32m▄[48;5;31m▄[48;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[0m +[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[48;5;31m▄[48;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[0m +[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[0m +[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[0m +[48;5;31;38;5;24m▄[48;5;32;38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[48;5;31;38;5;24m▄[0m +[48;5;23;38;5;232m▄[48;5;32;38;5;25m▄[38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[38;5;24m▄[48;5;234;38;5;16m▄[0m +[48;5;16;38;5;16m▄[48;5;233m▄[48;5;31;38;5;233m▄[48;5;32;38;5;31m▄[38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[38;5;31m▄[48;5;25;38;5;232m▄[48;5;232;38;5;16m▄[48;5;16m▄[0m +[48;5;16;38;5;16m▄▄▄[48;5;233m▄[48;5;25m▄[48;5;32;38;5;235m▄[38;5;24m▄[38;5;31m▄[38;5;32m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄[38;5;31m▄[38;5;24m▄[38;5;233m▄[48;5;24;38;5;16m▄[48;5;232m▄[48;5;16m▄▄▄[0m diff --git a/dnsmasq.sh b/etc/nextcloudpi-config.d/dnsmasq.sh index 657c51cf..657c51cf 100755 --- a/dnsmasq.sh +++ b/etc/nextcloudpi-config.d/dnsmasq.sh diff --git a/fail2ban.sh b/etc/nextcloudpi-config.d/fail2ban.sh index 758c78c0..758c78c0 100755 --- a/fail2ban.sh +++ b/etc/nextcloudpi-config.d/fail2ban.sh diff --git a/letsencrypt.sh b/etc/nextcloudpi-config.d/letsencrypt.sh index 29047843..29047843 100755 --- a/letsencrypt.sh +++ b/etc/nextcloudpi-config.d/letsencrypt.sh diff --git a/modsecurity.sh b/etc/nextcloudpi-config.d/modsecurity.sh index 43639815..43639815 100755 --- a/modsecurity.sh +++ b/etc/nextcloudpi-config.d/modsecurity.sh diff --git a/nc-datadir.sh b/etc/nextcloudpi-config.d/nc-datadir.sh index dd17901f..dd17901f 100755 --- a/nc-datadir.sh +++ b/etc/nextcloudpi-config.d/nc-datadir.sh diff --git a/nc-httpsonly.sh b/etc/nextcloudpi-config.d/nc-httpsonly.sh index 1ee9e7f0..1ee9e7f0 100755 --- a/nc-httpsonly.sh +++ b/etc/nextcloudpi-config.d/nc-httpsonly.sh diff --git a/nc-limits.sh b/etc/nextcloudpi-config.d/nc-limits.sh index 1c176d15..1c176d15 100755 --- a/nc-limits.sh +++ b/etc/nextcloudpi-config.d/nc-limits.sh diff --git a/etc/nextcloudpi-config.d/nc-update.sh b/etc/nextcloudpi-config.d/nc-update.sh new file mode 100755 index 00000000..3a0d5f2e --- /dev/null +++ b/etc/nextcloudpi-config.d/nc-update.sh @@ -0,0 +1,44 @@ +#!/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-update.sh <IP> (<img>) +# +# See installer.sh instructions for details +# +# More at https://ownyourbits.com/ +# + +DESCRIPTION="Update NextCloudPi" + +configure() +{ + /usr/local/bin/ncp-update +} + +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 + diff --git a/no-ip.sh b/etc/nextcloudpi-config.d/no-ip.sh index 0cffbd2a..0cffbd2a 100755 --- a/no-ip.sh +++ b/etc/nextcloudpi-config.d/no-ip.sh diff --git a/unattended-upgrades.sh b/etc/nextcloudpi-config.d/unattended-upgrades.sh index 30f0c861..30f0c861 100755 --- a/unattended-upgrades.sh +++ b/etc/nextcloudpi-config.d/unattended-upgrades.sh diff --git a/install-nextcloud.sh b/install-nextcloud.sh index 0281938f..f4a77509 100755 --- a/install-nextcloud.sh +++ b/install-nextcloud.sh @@ -22,7 +22,7 @@ EXTRACT=1 # Extract the image from zip, so start from 0 IMG=raspbian_lite_latest INSTALL_SCRIPT=nextcloud.sh -source library.sh # initializes $IMGOUT +source etc/library.sh # initializes $IMGNAME [[ "$DOWNLOAD" == "1" ]] && { wget https://downloads.raspberrypi.org/$IMG -O $IMG.zip || exit; } [[ "$DOWNLOAD" == "1" ]] || [[ "$EXTRACT" == "1" ]] && { @@ -33,13 +33,8 @@ source library.sh # initializes $IMGOUT IMGOUT="NextCloudPi_$( date "+%m-%d-%y" ).img" -config $INSTALL_SCRIPT || exit 1 -launch_install_qemu "$IMGFILE" $IP || exit 1 - -CONFDIR=/usr/local/etc/nextcloudpi-config.d/ -copy_to_image "$IMGOUT" $CONFDIR nc-limits.sh nc-datadir.sh nc-httpsonly.sh -copy_to_image "$IMGOUT" $CONFDIR/library library.sh -copy_to_image "$IMGOUT" /usr/local/bin/ nextcloudpi-config +config $INSTALL_SCRIPT || exit 1 +launch_install_qemu "$IMGFILE" $IP || exit 1 # initializes $IMGOUT pack_image $IMGFILE $IMGOUT diff --git a/installer.sh b/installer.sh index af1f04e2..ac538aff 100755 --- a/installer.sh +++ b/installer.sh @@ -35,15 +35,13 @@ 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 $IMGNAME +source etc/library.sh # initializes $IMGNAME config $INSTALL_SCRIPT || exit 1 if [[ "$IMGFILE" != "" ]]; then - launch_install_qemu "$IMGFILE" $IP || exit 1 # initializes $IMGOUT - copy_to_image "$IMGOUT" $CONFDIR $INSTALL_SCRIPT || exit 1 + launch_install_qemu "$IMGFILE" $IP || exit 1 # initializes $IMGOUT pack_image "$IMGOUT" "$IMGNAME" else launch_installation_online $IP diff --git a/nextcloud.sh b/nextcloud.sh index 196d3e6b..72137e38 100755 --- a/nextcloud.sh +++ b/nextcloud.sh @@ -228,10 +228,111 @@ EXIT EOF # NEXTCLOUDPI-CONFIG + ########################################## + $APTINSTALL dialog mkdir -p $CONFDIR sed -i '/Change User Password/i"0 NextCloudPi Configuration" "Configuration of NextCloudPi" \\\\' /usr/bin/raspi-config - sed -i '/1\\\\ \*) do_change_pass ;;/i0\\\\ *) nextcloudpi-config ;;' /usr/bin/raspi-config + sed -i '/1\\\\ \*) do_change_pass ;;/i0\\\\ *) nextcloudpi-config ;;' /usr/bin/raspi-config + + # NEXTCLOUDPI MOTD + ########################################## + mkdir /etc/update-motd.d + rm /etc/motd + ln -s /var/run/motd /etc/motd + + cat > /etc/update-motd.d/10logo <<EOF +#!/bin/sh +echo +cat /usr/local/etc/ncp-ascii.txt +EOF + + cat > /etc/update-motd.d/20updates <<'EOF' +#!/bin/bash +/usr/local/bin/ncp-check-updates +EOF + chmod a+x /etc/update-motd.d/* + + # NEXTCLOUDPI UPDATES + ########################################## + $APTINSTALL git + + cat > /usr/local/bin/ncp-check-updates <<'EOF' +#!/bin/bash + +NEED_UPDATE=false +VERFILE=/var/run/.ncp-latest-version + +if test -f $VERFILE && grep -qP "v\d+\.\d+\.\d+" $VERFILE; then + + MAJOR=$( grep -oP "\d+\.\d+\.\d+" $VERFILE | cut -d. -f1 ) + MINOR=$( grep -oP "\d+\.\d+\.\d+" $VERFILE | cut -d. -f2 ) + PATCH=$( grep -oP "\d+\.\d+\.\d+" $VERFILE | cut -d. -f3 ) + + MAJ=$( grep -oP "\d+\.\d+\.\d+" /usr/local/etc/ncp-version | cut -d. -f1 ) + MIN=$( grep -oP "\d+\.\d+\.\d+" /usr/local/etc/ncp-version | cut -d. -f2 ) + PAT=$( grep -oP "\d+\.\d+\.\d+" /usr/local/etc/ncp-version | cut -d. -f3 ) + + if [[ $MAJOR > $MAJ ]]; then + NEED_UPDATE=true + elif [[ $MAJOR == $MAJ ]] && [[ $MINOR > $MIN ]]; then + NEED_UPDATE=true + elif [[ $MAJOR == $MAJ ]] && [[ $MINOR == $MIN ]] && [[ $PATCH > $PAT ]]; then + NEED_UPDATE=true + fi +fi + +if $NEED_UPDATE; then + echo -e "\nNextCloudPi \e[1m$( cat $VERFILE )\e[0m available!!" + echo -e "update through 'nextcloudpi-config' or type 'sudo ncp-update'" +else + echo -e "\nNextCloudPi \e[1m$( cat /usr/local/etc/ncp-version )\e[0m is up to date" +fi +EOF + chmod a+x /usr/local/bin/ncp-check-updates + + + cat > /etc/cron.daily/ncp-check-version <<EOF +#!/bin/sh +/usr/local/bin/ncp-check-version +EOF + chmod a+x /etc/cron.daily/ncp-check-version + + + cat > /usr/local/bin/ncp-check-version <<'EOF' +#!/bin/bash +[ $(id -u) -ne 0 ] && exit 1 +git clone -q --depth 1 https://github.com/nachoparker/nextcloud-raspbian-generator.git /tmp/ncp-check-tmp +cd /tmp/ncp-check-tmp +git describe --always --tags > /var/run/.ncp-latest-version +cd / +rm -rf /tmp/ncp-check-tmp +EOF + chmod a+x /usr/local/bin/ncp-check-version + + + cat > /usr/local/bin/ncp-update <<'EOF' +#!/bin/bash +echo -e "Downloading updates" +rm -rf /tmp/ncp-update-tmp +git clone -q --depth 1 https://github.com/nachoparker/nextcloud-raspbian-generator.git /tmp/ncp-update-tmp +cd /tmp/ncp-update-tmp + +echo -e "Performing updates" +./update.sh + +VER=$( git describe --always --tags ) +echo $VER > /usr/local/etc/ncp-version +echo $VER > /var/run/.ncp-latest-version + +cd / +rm -rf /tmp/ncp-update-tmp + +echo -e "NextCloudPi updated to version \e[1m$VER\e[0m" +EOF + chmod a+x /usr/local/bin/ncp-update + + /usr/local/bin/ncp-update fi } diff --git a/update.sh b/update.sh new file mode 100755 index 00000000..891126cb --- /dev/null +++ b/update.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# Updaterfor 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! +# +# More at https://ownyourbits.com/ +# + + +cp etc/library.sh /usr/local/etc/ + +source /usr/local/etc/library.sh + +# copy all files in bin and etc +for file in bin/* etc/*; do + [ -f $file ] || continue; + cp $file /usr/local/$file +done + +# install new entries of nextcloudpi-config and update others +for file in etc/nextcloudpi-config.d/*; do + [ -f $file ] || continue; + [ -f /usr/local/$file ] || install_script $file + cp $file /usr/local/$file +done + +# 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 + |