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