Loop until something happens

This commit is contained in:
Bob Mottram 2015-01-18 14:18:50 +00:00
parent 442fc05c88
commit 189f85aa71
1 changed files with 144 additions and 156 deletions

View File

@ -666,53 +666,40 @@ function interactive_configuration {
255) exit 0;; 255) exit 0;;
esac esac
if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then
data=$(tempfile 2>/dev/null) while [ ! $WIKI_DOMAIN_NAME ]
trap "rm -f $data" 0 1 2 5 15 do
dialog --backtitle "Freedombone Configuration" \
--inputbox "Wiki Title" 10 30 2> $data
sel=$?
case $sel in
0) WIKI_TITLE=$(cat $data);;
1) exit 0;;
255) exit 0;;
esac
if [ ! $WIKI_TITLE ]; then
exit 5638
fi
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Configuration" \
--inputbox "Wiki domain name" 10 30 2> $data
sel=$?
case $sel in
0) WIKI_DOMAIN_NAME=$(cat $data);;
1) exit 0;;
255) exit 0;;
esac
if [ ! $WIKI_DOMAIN_NAME ]; then
exit 9236
fi
if [ ! $DOMAIN_NAME ]; then
DOMAIN_NAME=$WIKI_DOMAIN_NAME
fi
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
data=$(tempfile 2>/dev/null) data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15 trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Configuration" \ if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
--inputbox "Wiki FreeDNS subdomain code" 10 30 2> $data dialog --backtitle "Freedombone Configuration" \
--title "Wiki Configuration" \
--form "\nPlease enter your wiki details:" 11 55 4 \
"Title:" 1 1 "My Wiki" 1 16 16 15 \
"Domain:" 2 1 "" 2 16 16 15 \
"FreeDNS code:" 3 1 "" 3 16 16 15 \
2> $data
else
dialog --backtitle "Freedombone Configuration" \
--title "Wiki Configuration" \
--form "\nPlease enter your wiki details:" 11 55 3 \
"Title:" 1 1 "My Wiki" 1 16 16 15 \
"Domain:" 2 1 "" 2 16 16 15 \
2> $data
fi
sel=$? sel=$?
case $sel in case $sel in
0) WIKI_FREEDNS_SUBDOMAIN_CODE=$(cat $data);;
1) exit 0;; 1) exit 0;;
255) exit 0;; 255) exit 0;;
esac esac
if [ ! $WIKI_FREEDNS_SUBDOMAIN_CODE ]; then WIKI_TITLE=$(cat $data | sed -n 1p)
exit 5277 WIKI_DOMAIN_NAME=$(cat $data | sed -n 2p)
fi done
if [ ! $DOMAIN_NAME ]; then
DOMAIN_NAME=$WIKI_DOMAIN_NAME
fi
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
WIKI_FREEDNS_SUBDOMAIN_CODE=$(cat $data | sed -n 3p)
if [[ $DOMAIN_NAME == "$WIKI_DOMAIN_NAME" ]]; then if [[ $DOMAIN_NAME == "$WIKI_DOMAIN_NAME" ]]; then
FREEDNS_SUBDOMAIN_CODE=$WIKI_FREEDNS_SUBDOMAIN_CODE FREEDNS_SUBDOMAIN_CODE=$WIKI_FREEDNS_SUBDOMAIN_CODE
fi fi
@ -720,151 +707,152 @@ function interactive_configuration {
fi fi
if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then
data=$(tempfile 2>/dev/null) while [ ! $FULLBLOG_DOMAIN_NAME ]
trap "rm -f $data" 0 1 2 5 15 do
dialog --backtitle "Freedombone Configuration" \
--inputbox "Blog Title" 10 30 2> $data
sel=$?
case $sel in
0) MY_BLOG_TITLE=$(cat $data);;
1) exit 0;;
255) exit 0;;
esac
if [ $MY_BLOG_TITLE ]; then
data=$(tempfile 2>/dev/null) data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15 trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Configuration" \ if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
--inputbox "Blog domain name" 10 30 2> $data dialog --backtitle "Freedombone Configuration" \
--title "Blog Configuration" \
--form "\nPlease enter your blog details:" 11 55 4 \
"Title:" 1 1 "My Blog" 1 16 16 15 \
"Domain:" 2 1 "" 2 16 16 15 \
"FreeDNS code:" 3 1 "" 3 16 16 15 \
2> $data
else
dialog --backtitle "Freedombone Configuration" \
--title "Blog Configuration" \
--form "\nPlease enter your blog details:" 11 55 3 \
"Title:" 1 1 "My Blog" 1 16 16 15 \
"Domain:" 2 1 "" 2 16 16 15 \
2> $data
fi
sel=$? sel=$?
case $sel in case $sel in
0) FULLBLOG_DOMAIN_NAME=$(cat $data);;
1) exit 0;; 1) exit 0;;
255) exit 0;; 255) exit 0;;
esac esac
if [ ! $FULLBLOG_DOMAIN_NAME ]; then MY_BLOG_TITLE=$(cat $data | sed -n 1p)
exit 7648 FULLBLOG_DOMAIN_NAME=$(cat $data | sed -n 2p)
fi done
if [ ! $DOMAIN_NAME ]; then
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then DOMAIN_NAME=$FULLBLOG_DOMAIN_NAME
data=$(tempfile 2>/dev/null) fi
trap "rm -f $data" 0 1 2 5 15 if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
dialog --backtitle "Freedombone Configuration" \ FULLBLOG_FREEDNS_SUBDOMAIN_CODE=$(cat $data | sed -n 3p)
--inputbox "Blog FreeDNS subdomain code" 10 30 2> $data if [[ $DOMAIN_NAME == "$FULLBLOG_DOMAIN_NAME" ]]; then
sel=$? FREEDNS_SUBDOMAIN_CODE=$FULLBLOG_FREEDNS_SUBDOMAIN_CODE
case $sel in
0) FULLBLOG_FREEDNS_SUBDOMAIN_CODE=$(cat $data);;
1) exit 0;;
255) exit 0;;
esac
if [ ! $FULLBLOG_FREEDNS_SUBDOMAIN_CODE ]; then
exit 9875
fi
fi fi
fi fi
fi fi
if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then
data=$(tempfile 2>/dev/null) while [ ! $OWNCLOUD_DOMAIN_NAME ]
trap "rm -f $data" 0 1 2 5 15 do
dialog --backtitle "Freedombone Configuration" \ data=$(tempfile 2>/dev/null)
--inputbox "Owncloud domain name" 10 30 2> $data trap "rm -f $data" 0 1 2 5 15
sel=$?
case $sel in
0) OWNCLOUD_DOMAIN_NAME=$(cat $data);;
1) exit 0;;
255) exit 0;;
esac
if [ $OWNCLOUD_DOMAIN_NAME ]; then
if [ ! $DOMAIN_NAME ]; then
DOMAIN_NAME=$OWNCLOUD_DOMAIN_NAME
fi
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Configuration" \ dialog --backtitle "Freedombone Configuration" \
--inputbox "Owncloud FreeDNS subdomain code" 10 30 2> $data --title "Owncloud Configuration" \
sel=$? --form "\nPlease enter your Owncloud details:" 11 55 3 \
case $sel in "Domain:" 1 1 "" 1 16 16 15 \
0) OWNCLOUD_FREEDNS_SUBDOMAIN_CODE=$(cat $data);; "FreeDNS code:" 2 1 "" 2 16 16 15 \
1) exit 0;; 2> $data
255) exit 0;; else
esac dialog --backtitle "Freedombone Configuration" \
if [ ! $OWNCLOUD_FREEDNS_SUBDOMAIN_CODE ]; then --title "Owncloud Configuration" \
exit 2583 --form "\nPlease enter your Owncloud details:" 11 55 3 \
fi "Domain:" 1 1 "" 1 16 16 15 \
if [[ $DOMAIN_NAME == "$OWNCLOUD_DOMAIN_NAME" ]]; then 2> $data
FREEDNS_SUBDOMAIN_CODE=$OWNCLOUD_FREEDNS_SUBDOMAIN_CODE fi
fi sel=$?
case $sel in
1) exit 0;;
255) exit 0;;
esac
OWNCLOUD_DOMAIN_NAME=$(cat $data | sed -n 1p)
done
if [ ! $DOMAIN_NAME ]; then
DOMAIN_NAME=$OWNCLOUD_DOMAIN_NAME
fi
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
OWNCLOUD_FREEDNS_SUBDOMAIN_CODE=$(cat $data | sed -n 2p)
if [[ $DOMAIN_NAME == "$OWNCLOUD_DOMAIN_NAME" ]]; then
FREEDNS_SUBDOMAIN_CODE=$OWNCLOUD_FREEDNS_SUBDOMAIN_CODE
fi fi
fi fi
fi fi
if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then
data=$(tempfile 2>/dev/null) while [ ! $REDMATRIX_DOMAIN_NAME ]
trap "rm -f $data" 0 1 2 5 15 do
dialog --backtitle "Freedombone Configuration" \ data=$(tempfile 2>/dev/null)
--inputbox "RedMatrix domain name" 10 30 2> $data trap "rm -f $data" 0 1 2 5 15
sel=$?
case $sel in
0) REDMATRIX_DOMAIN_NAME=$(cat $data);;
1) exit 0;;
255) exit 0;;
esac
if [ $REDMATRIX_DOMAIN_NAME ]; then
if [ ! $DOMAIN_NAME ]; then
DOMAIN_NAME=$REDMATRIX_DOMAIN_NAME
fi
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Configuration" \ dialog --backtitle "Freedombone Configuration" \
--inputbox "RedMatrix FreeDNS subdomain code" 10 30 2> $data --title "RedMatrix Configuration" \
sel=$? --form "\nPlease enter your RedMatrix details:" 11 55 3 \
case $sel in "Domain:" 1 1 "" 1 16 16 15 \
0) REDMATRIX_FREEDNS_SUBDOMAIN_CODE=$(cat $data);; "FreeDNS code:" 2 1 "" 2 16 16 15 \
1) exit 0;; 2> $data
255) exit 0;; else
esac dialog --backtitle "Freedombone Configuration" \
if [ ! $REDMATRIX_FREEDNS_SUBDOMAIN_CODE ]; then --title "RedMatrix Configuration" \
exit 9654 --form "\nPlease enter your RedMatrix details:" 11 55 3 \
fi "Domain:" 1 1 "" 1 16 16 15 \
if [[ $DOMAIN_NAME == "$REDMATRIX_DOMAIN_NAME" ]]; then 2> $data
FREEDNS_SUBDOMAIN_CODE=$REDMATRIX_FREEDNS_SUBDOMAIN_CODE fi
fi sel=$?
case $sel in
1) exit 0;;
255) exit 0;;
esac
REDMATRIX_DOMAIN_NAME=$(cat $data | sed -n 1p)
done
if [ ! $DOMAIN_NAME ]; then
DOMAIN_NAME=$REDMATRIX_DOMAIN_NAME
fi
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
REDMATRIX_FREEDNS_SUBDOMAIN_CODE=$(cat $data | sed -n 2p)
if [[ $DOMAIN_NAME == "$REDMATRIX_DOMAIN_NAME" ]]; then
FREEDNS_SUBDOMAIN_CODE=$REDMATRIX_FREEDNS_SUBDOMAIN_CODE
fi fi
fi fi
fi fi
if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then
data=$(tempfile 2>/dev/null) while [ ! $MICROBLOG_DOMAIN_NAME ]
trap "rm -f $data" 0 1 2 5 15 do
dialog --backtitle "Freedombone Configuration" \ data=$(tempfile 2>/dev/null)
--inputbox "Microblog domain name" 10 30 2> $data trap "rm -f $data" 0 1 2 5 15
sel=$?
case $sel in
0) MICROBLOG_DOMAIN_NAME=$(cat $data);;
1) exit 0;;
255) exit 0;;
esac
if [ $MICROBLOG_DOMAIN_NAME ]; then
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Configuration" \ dialog --backtitle "Freedombone Configuration" \
--inputbox "Microblog FreeDNS subdomain code" 10 30 2> $data --title "Microblog Configuration" \
sel=$? --form "\nPlease enter your Microblog details:" 11 55 3 \
case $sel in "Domain:" 1 1 "" 1 16 16 15 \
0) MICROBLOG_FREEDNS_SUBDOMAIN_CODE=$(cat $data);; "FreeDNS code:" 2 1 "" 2 16 16 15 \
1) exit 0;; 2> $data
255) exit 0;; else
esac dialog --backtitle "Freedombone Configuration" \
if [ ! $MICROBLOG_FREEDNS_SUBDOMAIN_CODE ]; then --title "Microblog Configuration" \
exit 9508 --form "\nPlease enter your Microblog details:" 11 55 3 \
fi "Domain:" 1 1 "" 1 16 16 15 \
2> $data
fi
sel=$?
case $sel in
1) exit 0;;
255) exit 0;;
esac
MICROBLOG_DOMAIN_NAME=$(cat $data | sed -n 1p)
done
if [ ! $DOMAIN_NAME ]; then
DOMAIN_NAME=$MICROBLOG_DOMAIN_NAME
fi
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
MICROBLOG_FREEDNS_SUBDOMAIN_CODE=$(cat $data | sed -n 2p)
if [[ $DOMAIN_NAME == "$MICROBLOG_DOMAIN_NAME" ]]; then
FREEDNS_SUBDOMAIN_CODE=$MICROBLOG_FREEDNS_SUBDOMAIN_CODE
fi fi
fi fi
fi fi