Skip to content

Commit

Permalink
added show_info() to nextcloudpi-config
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Apr 27, 2017
1 parent fb994ad commit 64bf42f
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 21 deletions.
1 change: 1 addition & 0 deletions bin/nextcloudpi-config
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function nextcloud-config()
[[ $? -ne $DIALOG_OK ]] || [[ "$script" == "" ]] && return 0

# launch selected script
info_script $script.sh || return 1;
configure_script $script.sh
}

Expand Down
12 changes: 12 additions & 0 deletions etc/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,18 @@ function install_script()
)
}

function info_script()
{
(
local SCRIPT=$1
cd /usr/local/etc/nextcloudpi-config.d/
unset show_info
source ./$SCRIPT
[[ $( type -t show_info ) == function ]] || return 0
[[ $( type -t show_info ) == function ]] && show_info
)
}

function configure_script()
{
(
Expand Down
9 changes: 5 additions & 4 deletions etc/nextcloudpi-config.d/NFS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,20 @@ install()
systemctl disable nfs-kernel-server
}

configure()
show_info()
{
# INFO
################################
whiptail --msgbox \
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()
{
# CHECKS
################################
[ -d "$DIR_" ] || { echo -e "INFO: directory $DIR_ does not exist. Creating"; mkdir -p "$DIR_"; }
Expand Down
9 changes: 9 additions & 0 deletions etc/nextcloudpi-config.d/letsencrypt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ 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" \
20 90
}

# tested with git version v0.11.0-71-g018a304
configure()
{
Expand Down
10 changes: 10 additions & 0 deletions etc/nextcloudpi-config.d/modsecurity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ 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()
{
[[ $ACTIVE_ == "yes" ]] && local STATE=On || local STATE=Off
Expand Down
10 changes: 10 additions & 0 deletions etc/nextcloudpi-config.d/nc-ramlogs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
ACTIVE_=no
DESCRIPTION="mount logs in RAM to prevent SD card 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
}

configure()
{
[[ $ACTIVE_ != "yes" ]] && {
Expand Down
7 changes: 5 additions & 2 deletions etc/nextcloudpi-config.d/nc-scan-auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@
SCANINTERVAL_=60
DESCRIPTION="Periodically scan NC for externally modified files"

configure()
show_info()
{
whiptail --msgbox \
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. <<< \n
SCANINTERVAL=0 will disable periodic synchronization." \
20 90
}

configure()
{
[[ $SCANINTERVAL_ == 0 ]] && {
systemctl stop nc-scan.timer
systemctl disable nc-scan.timer
Expand Down
25 changes: 14 additions & 11 deletions etc/nextcloudpi-config.d/nc-wifi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ 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()
{
# Installation in QEMU (without a wireless interface) produces
Expand All @@ -41,17 +55,6 @@ configure()
systemctl enable wicd
systemctl start wicd

whiptail --msgbox \
--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

wicd-curses
}

Expand Down
9 changes: 9 additions & 0 deletions etc/nextcloudpi-config.d/no-ip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ EOF
rm -r /tmp/noip
}

show_info()
{
whiptail --yesno \
--backtitle "NextCloudPi configuration" \
--title "Warning" \
"Internet access is required for this configuration to complete" \
20 90
}

configure()
{
[[ $ACTIVE_ == "no" ]] && { service noip2 stop; update-rc.d noip2 disable; return; }
Expand Down
9 changes: 5 additions & 4 deletions etc/nextcloudpi-config.d/samba.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,20 @@ install()
grep -q mkdir /etc/init.d/smbd || sed -i "/\<start)/amkdir -p /var/log/samba" /etc/init.d/smbd
}

configure()
show_info()
{
# INFO
################################
whiptail --msgbox \
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()
{
# CHECKS
################################
[ -d "$DIR_" ] || { echo -e "INFO: directory $DIR_ does not exist. Creating"; mkdir -p "$DIR_"; }
Expand Down

0 comments on commit 64bf42f

Please sign in to comment.