Tidying
This commit is contained in:
parent
a2199f3bec
commit
8961765c54
|
@ -120,6 +120,8 @@ FRIENDS_MIRRORS_SSH_PORT=2222
|
|||
FRIENDS_MIRRORS_PASSWORD=
|
||||
MY_MIRRORS_PASSWORD=
|
||||
|
||||
VALID_CODE=
|
||||
|
||||
function show_help {
|
||||
echo ''
|
||||
echo $"${PROJECT_NAME}-config -f [config filename] -m [min password length]"
|
||||
|
@ -138,6 +140,19 @@ function show_help {
|
|||
exit 0
|
||||
}
|
||||
|
||||
function validate_freedns_code {
|
||||
freedns_code="$1"
|
||||
if [[ "$freedns_code" == *"."* || "$freedns_code" == "http"* || "$freedns_code" == *"wget "* || "$freedns_code" == *" "* ]]; then
|
||||
echo $'Only the code between ? and = should be entered'
|
||||
VALID_CODE=
|
||||
fi
|
||||
if [ ${#freedns_code} -lt 30 ]; then
|
||||
echo $'Freedns code is too short. Did you enter the entire code?'
|
||||
VALID_CODE=
|
||||
fi
|
||||
VALID_CODE='yes'
|
||||
}
|
||||
|
||||
# Get the commandline options
|
||||
while [[ $# > 1 ]]
|
||||
do
|
||||
|
@ -1387,13 +1402,9 @@ function interactive_configuration {
|
|||
else
|
||||
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
|
||||
WIKI_CODE=$(cat $data | sed -n 3p)
|
||||
if [ ${#WIKI_CODE} -lt 30 ]; then
|
||||
validate_freedns_code "$WIKI_CODE"
|
||||
if [ ! $VALID_CODE ]; then
|
||||
WIKI_DOMAIN_NAME=
|
||||
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
fi
|
||||
if [[ $WIKI_CODE == *"."* ]]; then
|
||||
WIKI_DOMAIN_NAME=
|
||||
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -1451,13 +1462,9 @@ function interactive_configuration {
|
|||
else
|
||||
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
|
||||
FULLBLOG_CODE=$(cat $data | sed -n 3p)
|
||||
if [ ${#FULLBLOG_CODE} -lt 30 ]; then
|
||||
validate_freedns_code "$FULLBLOG_CODE"
|
||||
if [ ! $VALID_CODE ]; then
|
||||
FULLBLOG_DOMAIN_NAME=
|
||||
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
fi
|
||||
if [[ $FULLBLOG_CODE == *"."* ]]; then
|
||||
FULLBLOG_DOMAIN_NAME=
|
||||
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -1508,13 +1515,9 @@ function interactive_configuration {
|
|||
else
|
||||
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
|
||||
OWNCLOUD_CODE=$(cat $data | sed -n 2p)
|
||||
if [ ${#OWNCLOUD_CODE} -lt 30 ]; then
|
||||
validate_freedns_code "$OWNCLOUD_CODE"
|
||||
if [ ! $VALID_CODE ]; then
|
||||
OWNCLOUD_DOMAIN_NAME=
|
||||
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
fi
|
||||
if [[ $OWNCLOUD_CODE == *"."* ]]; then
|
||||
OWNCLOUD_DOMAIN_NAME=
|
||||
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -1565,13 +1568,9 @@ function interactive_configuration {
|
|||
else
|
||||
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
|
||||
HUBZILLA_CODE=$(cat $data | sed -n 2p)
|
||||
if [ ${#HUBZILLA_CODE} -lt 30 ]; then
|
||||
validate_freedns_code "$HUBZILLA_CODE"
|
||||
if [ ! $VALID_CODE ]; then
|
||||
HUBZILLA_DOMAIN_NAME=
|
||||
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
fi
|
||||
if [[ $HUBZILLA_CODE == *"."* ]]; then
|
||||
HUBZILLA_DOMAIN_NAME=
|
||||
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -1637,13 +1636,9 @@ function interactive_configuration {
|
|||
else
|
||||
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
|
||||
MICROBLOG_CODE=$(cat $data | sed -n 4p)
|
||||
if [ ${#MICROBLOG_CODE} -lt 30 ]; then
|
||||
validate_freedns_code "$MICROBLOG_CODE"
|
||||
if [ ! $VALID_CODE ]; then
|
||||
MICROBLOG_DOMAIN_NAME=
|
||||
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
fi
|
||||
if [[ $MICROBLOG_CODE == *"."* ]]; then
|
||||
MICROBLOG_DOMAIN_NAME=
|
||||
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -1695,13 +1690,9 @@ function interactive_configuration {
|
|||
else
|
||||
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
|
||||
GIT_CODE=$(cat $data | sed -n 2p)
|
||||
if [ ${#GIT_CODE} -lt 30 ]; then
|
||||
validate_freedns_code "$GIT_CODE"
|
||||
if [ ! $VALID_CODE ]; then
|
||||
GIT_DOMAIN_NAME=
|
||||
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
fi
|
||||
if [[ $GIT_CODE == *"."* ]]; then
|
||||
GIT_DOMAIN_NAME=
|
||||
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -1740,13 +1731,9 @@ function interactive_configuration {
|
|||
DEFAULT_DOMAIN_NAME=$(cat $data | sed -n 1p)
|
||||
DEFAULT_DOMAIN_CODE=$(cat $data | sed -n 2p)
|
||||
if [ $DEFAULT_DOMAIN_NAME ]; then
|
||||
if [ ${#DEFAULT_DOMAIN_CODE} -lt 30 ]; then
|
||||
validate_freedns_code "$DEFAULT_DOMAIN_CODE"
|
||||
if [ ! $VALID_CODE ]; then
|
||||
DEFAULT_DOMAIN_NAME=
|
||||
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
fi
|
||||
if [[ $DEFAULT_DOMAIN_CODE == *"."* ]]; then
|
||||
DEFAULT_DOMAIN_NAME=
|
||||
dialog --title $"FreeDNS code" --msgbox "$FREEDNS_MESSAGE" 15 50
|
||||
fi
|
||||
fi
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue