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>2017-09-07 23:36:35 +0300
committernachoparker <nacho@ownyourbits.com>2017-09-07 23:38:44 +0300
commite7e07863ce98b3c98412c87fdfb73ffcc4edb698 (patch)
tree24a0e69bb35bd2933a5c18e3b04794d3eb3ca1f7
parent74c8d956096683b380f51a78a62bf917fb1f213b (diff)
refactor show_info(), make it only depend on variablesv0.26.18
-rw-r--r--changelog.md4
-rwxr-xr-xetc/library.sh8
-rw-r--r--etc/nextcloudpi-config.d/NFS.sh19
-rw-r--r--etc/nextcloudpi-config.d/dnsmasq.sh9
-rw-r--r--etc/nextcloudpi-config.d/letsencrypt.sh19
-rw-r--r--etc/nextcloudpi-config.d/modsecurity.sh14
-rw-r--r--etc/nextcloudpi-config.d/nc-automount.sh14
-rw-r--r--etc/nextcloudpi-config.d/nc-database.sh12
-rw-r--r--etc/nextcloudpi-config.d/nc-datadir.sh11
-rw-r--r--etc/nextcloudpi-config.d/nc-format-USB.sh15
-rw-r--r--etc/nextcloudpi-config.d/nc-forward-ports.sh12
-rw-r--r--etc/nextcloudpi-config.d/nc-init.sh12
-rw-r--r--etc/nextcloudpi-config.d/nc-nextcloud.sh13
-rw-r--r--etc/nextcloudpi-config.d/nc-ramlogs.sh12
-rw-r--r--etc/nextcloudpi-config.d/nc-restore.sh13
-rw-r--r--etc/nextcloudpi-config.d/nc-scan-auto.sh13
-rw-r--r--etc/nextcloudpi-config.d/nc-wifi.sh22
-rw-r--r--etc/nextcloudpi-config.d/no-ip.sh11
-rw-r--r--etc/nextcloudpi-config.d/samba.sh19
19 files changed, 74 insertions, 178 deletions
diff --git a/changelog.md b/changelog.md
index fdfe6204..4351ceb3 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,7 @@
-[v0.26.17](https://github.com/nextcloud/nextcloudpi/commit/a7bfd17) (2017-09-07) ncp-web: link to changelog
+[v0.26.18](https://github.com/nextcloud/nextcloudpi/commit/a4144dc) (2017-09-07) refactor show_info(), make it only depend on variables
+
+[v0.26.17](https://github.com/nextcloud/nextcloudpi/commit/0197f31) (2017-09-07) ncp-web: link to changelog
[v0.26.16](https://github.com/nextcloud/nextcloudpi/commit/e3d07fb) (2017-09-06) added sendmail and mail configuration
diff --git a/etc/library.sh b/etc/library.sh
index 58101d22..ad4f0072 100755
--- a/etc/library.sh
+++ b/etc/library.sh
@@ -220,15 +220,17 @@ function launch_script()
)
}
+# show an info box for a script if the INFO variable is set in the script
function info_script()
{
(
local SCRIPT=$1
cd /usr/local/etc/nextcloudpi-config.d/ || return 1
- unset show_info
+ unset show_info INFO INFOTITLE
source ./"$SCRIPT"
- [[ $( type -t show_info ) == function ]] || return 0
- [[ $( type -t show_info ) == function ]] && show_info
+ local INFOTITLE="${INFOTITLE:-Info}"
+ [[ "$INFO" == "" ]] && return 0
+ whiptail --yesno --backtitle "NextCloudPi configuration" --title "$INFOTITLE" "$INFO" 20 90
)
}
diff --git a/etc/nextcloudpi-config.d/NFS.sh b/etc/nextcloudpi-config.d/NFS.sh
index 415a13cf..e76c78c0 100644
--- a/etc/nextcloudpi-config.d/NFS.sh
+++ b/etc/nextcloudpi-config.d/NFS.sh
@@ -20,6 +20,13 @@ USER_=www-data
GROUP_=www-data
DESCRIPTION="NFS network file system server (for Linux LAN)"
+INFOTITLE="Instructions for external synchronization"
+INFO="If we intend to modify the data folder through NFS,
+then we have to synchronize NextCloud to make it aware of the changes.
+
+This can be done manually or automatically using 'nc-scan' and 'nc-scan-auto'
+from 'nextcloudpi-config'"
+
install()
{
apt-get update
@@ -61,18 +68,6 @@ Alias=portmap
EOF
}
-show_info()
-{
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "Instructions for external synchronization" \
-"If we intend to modify the data folder through NFS,
-then we have to synchronize NextCloud to make it aware of the changes. \n
-This can be done manually or automatically using 'nc-scan' and 'nc-scan-auto'
-from 'nextcloudpi-config'" \
- 20 90
-}
-
configure()
{
[[ $ACTIVE_ != "yes" ]] && {
diff --git a/etc/nextcloudpi-config.d/dnsmasq.sh b/etc/nextcloudpi-config.d/dnsmasq.sh
index 3ae99301..1528e4a6 100644
--- a/etc/nextcloudpi-config.d/dnsmasq.sh
+++ b/etc/nextcloudpi-config.d/dnsmasq.sh
@@ -19,14 +19,7 @@ DNSSERVER_=8.8.8.8
CACHESIZE_=150
DESCRIPTION="DNS server with cache"
-show_info()
-{
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "Info" \
-"Remember to point your PC and devices DNS to your Raspberry Pi IP" \
- 20 90
-}
+INFO="Remember to point your PC and devices DNS to your Raspberry Pi IP"
install()
{
diff --git a/etc/nextcloudpi-config.d/letsencrypt.sh b/etc/nextcloudpi-config.d/letsencrypt.sh
index 3c853ee1..1491f54e 100644
--- a/etc/nextcloudpi-config.d/letsencrypt.sh
+++ b/etc/nextcloudpi-config.d/letsencrypt.sh
@@ -22,6 +22,12 @@ VHOSTCFG=/etc/apache2/sites-available/nextcloud.conf
VHOSTCFG2=/etc/apache2/sites-available/ncp.conf
DESCRIPTION="Automatic signed SSL certificates"
+INFOTITLE="Warning"
+INFO="Internet access is required for this configuration to complete
+Both ports 80 and 443 need to be accessible from the internet
+
+Your certificate will be automatically renewed every month"
+
install()
{
cd /etc || return 1
@@ -29,19 +35,6 @@ install()
/etc/letsencrypt/letsencrypt-auto --help # do not actually run certbot, only install packages
}
-show_info()
-{
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "Warning" \
-"Internet access is required for this configuration to complete
-Both ports 80 and 443 need to be accessible from the internet
-
-Your certificate will be automatically renewed every month
-" \
- 20 90
-}
-
# tested with git version v0.11.0-71-g018a304
configure()
{
diff --git a/etc/nextcloudpi-config.d/modsecurity.sh b/etc/nextcloudpi-config.d/modsecurity.sh
index 1610bf18..81a9bd03 100644
--- a/etc/nextcloudpi-config.d/modsecurity.sh
+++ b/etc/nextcloudpi-config.d/modsecurity.sh
@@ -19,6 +19,10 @@ NCDIR=/var/www/nextcloud/
NCPWB=/var/www/ncp-web/
DESCRIPTION="Web Application Firewall for extra security (experimental)"
+INFOTITLE="Experimental feature warning"
+INFO="This feature is highly experimental and has only been tested with
+a basic NextCloud installation. If a new App does not work disable it"
+
install()
{
apt-get update
@@ -44,16 +48,6 @@ EOF
EOF
}
-show_info()
-{
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "Experimental feature warning" \
-"This feature is highly experimental and has only been tested with
-a basic NextCloud installation. If a new App does not work disable it" \
- 20 90
-}
-
configure()
{
cat > /etc/modsecurity/modsecurity_crs_99_whitelist.conf <<EOF
diff --git a/etc/nextcloudpi-config.d/nc-automount.sh b/etc/nextcloudpi-config.d/nc-automount.sh
index d7fbf496..661e5991 100644
--- a/etc/nextcloudpi-config.d/nc-automount.sh
+++ b/etc/nextcloudpi-config.d/nc-automount.sh
@@ -17,22 +17,14 @@
ACTIVE_=no
DESCRIPTION="Automount USB drives by plugging them in"
-show_info()
-{
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "Automount notes" \
-"Plugged in USB drives will be automounted under /media
+INFOTITLE="Automount notes"
+INFO="Plugged in USB drives will be automounted under /media
on boot or at the moment of insertion.
Format your drive as ext4 in order to move NC datafolder or database
VFAT or NTFS is not recommended for this task, as it does not suport permissions
-Drives with multiple partitions are not supported
-
-IMPORTANT: halt or umount the drive before extracting" \
- 20 90
-}
+IMPORTANT: halt or umount the drive before extracting"
install()
{
diff --git a/etc/nextcloudpi-config.d/nc-database.sh b/etc/nextcloudpi-config.d/nc-database.sh
index b1651f13..43472b4f 100644
--- a/etc/nextcloudpi-config.d/nc-database.sh
+++ b/etc/nextcloudpi-config.d/nc-database.sh
@@ -17,21 +17,13 @@
DBDIR_=/media/USBdrive/ncdatabase
DESCRIPTION="Move your database to a new location, like a USB drive"
-show_info()
-{
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "Info" \
-"Note that non Unix filesystems such as NTFS are not supported
+INFO="Note that non Unix filesystems such as NTFS are not supported
because they do not provide a compatible user/permissions system
You need to use a USB drive that is permanently on and is responsive
or the database will fail.
-** If it ever fails with a white page, move the database back to the SD **
-" \
- 20 90
-}
+** If it ever fails with a white page, move the database back to the SD **"
configure()
{
diff --git a/etc/nextcloudpi-config.d/nc-datadir.sh b/etc/nextcloudpi-config.d/nc-datadir.sh
index 111698df..9fc5c5f0 100644
--- a/etc/nextcloudpi-config.d/nc-datadir.sh
+++ b/etc/nextcloudpi-config.d/nc-datadir.sh
@@ -17,15 +17,8 @@
DATADIR_=/media/USBdrive/ncdata
DESCRIPTION="Change your data dir to a new location, like a USB drive"
-show_info()
-{
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "Info" \
-"Note that non Unix filesystems such as NTFS are not supported
-because they do not provide a compatible user/permissions system" \
- 20 90
-}
+INFO="Note that non Unix filesystems such as NTFS are not supported
+because they do not provide a compatible user/permissions system"
configure()
{
diff --git a/etc/nextcloudpi-config.d/nc-format-USB.sh b/etc/nextcloudpi-config.d/nc-format-USB.sh
index 8b952d69..7643a6b2 100644
--- a/etc/nextcloudpi-config.d/nc-format-USB.sh
+++ b/etc/nextcloudpi-config.d/nc-format-USB.sh
@@ -16,18 +16,11 @@
LABEL_=myCloudDrive
DESCRIPTION="Format an external USB drive as a ext4 partition (dangerous)"
-show_info()
-{
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "Instructions for USB drive formatting" \
-"Make sure that ONLY the USB drive that you want to format is plugged in.
-
-Be careful, this will destroy any data in the USB drive
+INFOTITLE="Instructions for USB drive formatting"
+INFO="Make sure that ONLY the USB drive that you want to format is plugged in.
+careful, this will destroy any data in the USB drive
-** YOU WILL LOSE ALL YOUR USB DATA ** " \
- 20 90
-}
+** YOU WILL LOSE ALL YOUR USB DATA **"
configure()
{
diff --git a/etc/nextcloudpi-config.d/nc-forward-ports.sh b/etc/nextcloudpi-config.d/nc-forward-ports.sh
index 85c6a171..480fc652 100644
--- a/etc/nextcloudpi-config.d/nc-forward-ports.sh
+++ b/etc/nextcloudpi-config.d/nc-forward-ports.sh
@@ -17,19 +17,13 @@ HTTPSPORT_=443
HTTPPORT_=80
DESCRIPTION="Set port forwarding to access from outside (UPnP)"
-show_info()
-{
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "Instructions for UPnP Port Forwarding" \
-"For NextCloudPi to be able to setup your ports, UPnP must be activated
+INFOTITLE="Instructions for UPnP Port Forwarding"
+INFO="For NextCloudPi to be able to setup your ports, UPnP must be activated
in your router. Activate it now on your router admin webpage.
** UPnP is considered a security risk **
-Don't forget to disable it afterwards" \
- 20 90
-}
+Don't forget to disable it afterwards"
install()
{
diff --git a/etc/nextcloudpi-config.d/nc-init.sh b/etc/nextcloudpi-config.d/nc-init.sh
index e641a24a..69afe009 100644
--- a/etc/nextcloudpi-config.d/nc-init.sh
+++ b/etc/nextcloudpi-config.d/nc-init.sh
@@ -19,18 +19,12 @@ ADMINPASS_=ownyourbits
DBADMIN=ncadmin
DESCRIPTION="(Re)initiate Nextcloud to a clean configuration"
-show_info()
-{
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "Clean NextCloud configuration" \
-"This action will configure NextCloud to NextCloudPi defaults.
+INFOTITLE="Clean NextCloud configuration"
+INFO="This action will configure NextCloud to NextCloudPi defaults.
** YOUR CONFIGURATION WILL BE LOST **
-" \
- 20 90
-}
+"
configure()
{
diff --git a/etc/nextcloudpi-config.d/nc-nextcloud.sh b/etc/nextcloudpi-config.d/nc-nextcloud.sh
index a31f57da..7c245cea 100644
--- a/etc/nextcloudpi-config.d/nc-nextcloud.sh
+++ b/etc/nextcloudpi-config.d/nc-nextcloud.sh
@@ -23,21 +23,16 @@ DESCRIPTION="Install any NextCloud version"
export DEBIAN_FRONTEND=noninteractive
-show_info()
-{
- [ -d /var/www/nextcloud ] && \
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "NextCloud installation" \
-"This new installation will cleanup current
+[ -d /var/www/nextcloud ] && { # don't show this during image build
+INFOTITLE="NextCloud installation"
+INFO="This new installation will cleanup current
NextCloud instance, including files and database.
You can later use nc-init to configure to NextCloudPi defaults
** perform backup before proceding **
-You can use nc-backup " \
- 20 90
+You can use nc-backup "
}
install() { :; }
diff --git a/etc/nextcloudpi-config.d/nc-ramlogs.sh b/etc/nextcloudpi-config.d/nc-ramlogs.sh
index a9690bc2..0138897b 100644
--- a/etc/nextcloudpi-config.d/nc-ramlogs.sh
+++ b/etc/nextcloudpi-config.d/nc-ramlogs.sh
@@ -17,15 +17,9 @@
ACTIVE_=no
DESCRIPTION="mount logs in RAM to prevent SD degradation (faster, consumes more RAM)"
-show_info()
-{
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "Warning" \
-"If you are installing software other than NextCloud
-that creates folders under '/var/log/' disable this feature" \
- 20 90
-}
+INFOTITLE="Warning"
+INFO="If you are installing software other than NextCloud
+that creates folders under '/var/log/' disable this feature"
configure()
{
diff --git a/etc/nextcloudpi-config.d/nc-restore.sh b/etc/nextcloudpi-config.d/nc-restore.sh
index faadf429..6d4c221f 100644
--- a/etc/nextcloudpi-config.d/nc-restore.sh
+++ b/etc/nextcloudpi-config.d/nc-restore.sh
@@ -21,20 +21,13 @@ BASEDIR=/var/www
DBADMIN=ncadmin
DESCRIPTION="Restore a previously backuped NC instance"
-show_info()
-{
- [ -d /var/www/nextcloud ] && \
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "Restore NextCloud backup" \
-"This new installation will cleanup current
+INFOTITLE="Restore NextCloud backup"
+INFO="This new installation will cleanup current
NextCloud instance, including files and database.
** perform backup before proceding **
-You can use nc-backup " \
- 20 90
-}
+You can use nc-backup"
configure()
{
diff --git a/etc/nextcloudpi-config.d/nc-scan-auto.sh b/etc/nextcloudpi-config.d/nc-scan-auto.sh
index 183904c8..a1210085 100644
--- a/etc/nextcloudpi-config.d/nc-scan-auto.sh
+++ b/etc/nextcloudpi-config.d/nc-scan-auto.sh
@@ -17,15 +17,10 @@ ACTIVE_=no
SCANINTERVAL_=60
DESCRIPTION="Periodically scan NC for externally modified files"
-show_info()
-{
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "Instructions for auto synchronization" \
-"Set the time in minutes in SCANINTERVAL. \n
->>> If there are too many files this can greatly affect performance. <<<" \
- 20 90
-}
+INFOTITLE="Instructions for auto synchronization"
+INFO="Set the time in minutes in SCANINTERVAL.
+
+>>> If there are too many files this can greatly affect performance. <<<"
install()
{
diff --git a/etc/nextcloudpi-config.d/nc-wifi.sh b/etc/nextcloudpi-config.d/nc-wifi.sh
index ae99a6c3..cd6e0380 100644
--- a/etc/nextcloudpi-config.d/nc-wifi.sh
+++ b/etc/nextcloudpi-config.d/nc-wifi.sh
@@ -17,6 +17,14 @@
ACTIVE_=no
DESCRIPTION="Configure your Wi-Fi connection"
+INFOTITLE="Instructions to configure Wi-Fi"
+INFO="1) Select a Wi-Fi network
+2) Press right arrow ->
+3) Enter the passphrase for your Wi-Fi
+4) Make sure to select 'connect automatically'
+5) F10 to save
+6) C to connect"
+
install()
{
apt-get update
@@ -24,20 +32,6 @@ install()
systemctl disable wicd
}
-show_info()
-{
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "Instructions to configure Wi-Fi" \
-"1) Select a Wi-Fi network
-2) Press right arrow ->
-3) Enter the passphrase for your Wi-Fi
-4) Make sure to select 'connect automatically'
-5) F10 to save
-6) C to connect" \
- 20 90
-}
-
configure()
{
[[ $ACTIVE_ != "yes" ]] && {
diff --git a/etc/nextcloudpi-config.d/no-ip.sh b/etc/nextcloudpi-config.d/no-ip.sh
index 0e90ebc2..c263621f 100644
--- a/etc/nextcloudpi-config.d/no-ip.sh
+++ b/etc/nextcloudpi-config.d/no-ip.sh
@@ -21,15 +21,8 @@ DOMAIN_=mycloud.ownyourbits.com
TIME_=30
DESCRIPTION="DDNS no-ip free provider (need account)"
-show_info()
-{
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "Info" \
-"For this step to succeed, you need to register a noip account first.
-Internet access is required for this configuration to complete." \
- 20 90
-}
+INFO="For this step to succeed, you need to register a noip account first.
+Internet access is required for this configuration to complete."
install()
{
diff --git a/etc/nextcloudpi-config.d/samba.sh b/etc/nextcloudpi-config.d/samba.sh
index 1493ee04..4e4c4e84 100644
--- a/etc/nextcloudpi-config.d/samba.sh
+++ b/etc/nextcloudpi-config.d/samba.sh
@@ -19,6 +19,13 @@ USER_=pi
PWD_=raspberry
DESCRIPTION="SMB/CIFS file server (for Mac/Linux/Windows)"
+INFOTITLE="Instructions for external synchronization"
+INFO="If we intend to modify the data folder through SAMBA,
+then we have to synchronize NextCloud to make it aware of the changes.
+
+This can be done manually or automatically using 'nc-scan' and 'nc-scan-auto'
+from 'nextcloudpi-config'"
+
install()
{
apt-get update
@@ -32,18 +39,6 @@ install()
grep -q SMB3 /etc/samba/smb.conf || sed -i '/\[global\]/aprotocol = SMB3' /etc/samba/smb.conf
}
-show_info()
-{
- whiptail --yesno \
- --backtitle "NextCloudPi configuration" \
- --title "Instructions for external synchronization" \
-"If we intend to modify the data folder through SAMBA,
-then we have to synchronize NextCloud to make it aware of the changes. \n
-This can be done manually or automatically using 'nc-scan' and 'nc-scan-auto'
-from 'nextcloudpi-config'" \
- 20 90
-}
-
configure()
{
[[ $ACTIVE_ != "yes" ]] && { service smbd stop; update-rc.d smbd disable; echo "SMB disabled"; return; }