Skip to content

Commit

Permalink
return to menu in nextcloudpi-config
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Apr 27, 2017
1 parent 8200602 commit 2877a28
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
24 changes: 13 additions & 11 deletions bin/nextcloudpi-config
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,21 @@ function nextcloud-config()
local DESC=$( grep "DESCRIPTION=" $item | sed 's|^DESCRIPTION="||;s|"$||' )
LIST+=( $( basename $item .sh ) "$DESC" )
done
local script
script=$( whiptail --backtitle "$BACKTITLE $( cat /usr/local/etc/ncp-version )" \
--title "NextCloudPi Software Configuration Tool (nextcloudpi-config)" \
--cancel-button Finish --ok-button Select \
--menu "Select program to configure and activate:" 20 100 10 \
"${LIST[@]}" \
3>&1 1>&2 2>&3 )
while true; do
local script
script=$( whiptail --backtitle "$BACKTITLE $( cat /usr/local/etc/ncp-version )" \
--title "NextCloudPi Software Configuration Tool (nextcloudpi-config)" \
--cancel-button Finish --ok-button Select \
--menu "Select program to configure and activate:" 20 100 10 \
"${LIST[@]}" \
3>&1 1>&2 2>&3 )

[[ $? -ne $DIALOG_OK ]] || [[ "$script" == "" ]] && return 0
[[ $? -ne $DIALOG_OK ]] || [[ "$script" == "" ]] && return 0

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

if [ $(id -u) -ne 0 ]; then
Expand Down
3 changes: 1 addition & 2 deletions etc/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ function config()

case $RET in
$DIALOG_CANCEL)
echo "Aborted"
return 1
;;
$DIALOG_OK)
Expand Down Expand Up @@ -220,7 +219,7 @@ function configure_script()
(
local SCRIPT=$1
cd /usr/local/etc/nextcloudpi-config.d/
config $SCRIPT || return 1 # writes "$INSTALLATION_CODE"
config $SCRIPT || return 0 # writes "$INSTALLATION_CODE"
echo -e "$INSTALLATION_CODE" > $SCRIPT # save configuration
source ./$SCRIPT # load configuration
echo -e "Configuring \e[1m$( basename $SCRIPT .sh )\e[0m"
Expand Down

0 comments on commit 2877a28

Please sign in to comment.