Fixing interactive installer
This commit is contained in:
parent
5e862cdc35
commit
2fec0b17ff
|
@ -245,30 +245,27 @@ function interactive_gpg_from_remote {
|
|||
REMOTE_SERVERS_LIST=/home/$MY_USERNAME/keyshareservers.txt
|
||||
|
||||
# get a list of remote servers
|
||||
freedombone-remote -u $MY_USERNAME -l $REMOTE_SERVERS_LIST
|
||||
if [ ! "$?" = "0" ]; then
|
||||
freedombone-remote -u $MY_USERNAME -l $REMOTE_SERVERS_LIST -t "Remote server"
|
||||
|
||||
if [ ! -f $REMOTE_SERVERS_LIST ]; then
|
||||
dialog --title "Encryption keys" --msgbox 'Error obtaining server list' 6 70
|
||||
echo "1"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f $REMOTE_SERVERS_LIST ]; then
|
||||
echo "2"
|
||||
return
|
||||
fi
|
||||
|
||||
# check the number of entries in the file
|
||||
no_of_servers=$(cat $REMOTE_SERVERS_LIST | wc -l)
|
||||
if [[ ${no_of_servers} < 3 ]]; then
|
||||
dialog --title "Encryption keys" --msgbox 'There must be at least three servers to recover the key' 6 70
|
||||
echo "3"
|
||||
echo "2"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
# try to recover the key from the servers
|
||||
freedombone-recoverkey -u $MY_USERNAME -l $REMOTE_SERVERS_LIST
|
||||
if [ ! "$?" = "0" ]; then
|
||||
dialog --title "Encryption keys" --msgbox 'Your key could not be recovered' 6 70
|
||||
echo "4"
|
||||
echo "3"
|
||||
return
|
||||
fi
|
||||
|
||||
|
@ -346,21 +343,21 @@ function interactive_gpg {
|
|||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle "Freedombone Configuration" \
|
||||
--radiolist "GPG/PGP keys for your system:" 17 40 3 \
|
||||
--radiolist "GPG/PGP keys for your system:" 13 70 3 \
|
||||
1 "Generate new keys (new user)" on \
|
||||
2 "Import keys from a USB drive" off \
|
||||
3 "Retrieve keys from friends servers" off 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 123;;
|
||||
255) exit 234;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) return;;
|
||||
2) interactive_gpg_from_usb
|
||||
return;;
|
||||
3) retval=interactive_gpg_from_remote
|
||||
if [[ retval != '0' ]]; then
|
||||
3) interactive_gpg_from_remote
|
||||
if [ ! "$?" = "0" ]; then
|
||||
GPG_CONFIGURED="no"
|
||||
fi;;
|
||||
esac
|
||||
|
@ -393,8 +390,8 @@ function interactive_configuration {
|
|||
9 Developer off 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) SYSTEM_TYPE=$VARIANT_FULL;;
|
||||
|
@ -417,8 +414,8 @@ function interactive_configuration {
|
|||
sel=$?
|
||||
case $sel in
|
||||
0) MY_USERNAME=$(cat $data | awk -F '/' '{print $3}');;
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
if [ ! $MY_USERNAME ]; then
|
||||
echo 'No user account was selected'
|
||||
|
@ -452,7 +449,7 @@ function interactive_configuration {
|
|||
case $sel in
|
||||
0) INSTALLING_ON_BBB="yes";;
|
||||
1) INSTALLING_ON_BBB="no";;
|
||||
255) exit 0;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
if [[ $INSTALLING_ON_BBB == "yes" ]]; then
|
||||
USB_DRIVE=/dev/sda1
|
||||
|
@ -478,13 +475,13 @@ function interactive_configuration {
|
|||
fi
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
2) HWRNG_TYPE="beaglebone";;
|
||||
3) HWRNG_TYPE="onerng";;
|
||||
255) exit 0;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
save_configuration_file
|
||||
|
||||
|
@ -543,8 +540,8 @@ function interactive_configuration {
|
|||
49 "United States" on 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) DEBIAN_REPO='ftp.au.debian.org';;
|
||||
|
@ -596,7 +593,7 @@ function interactive_configuration {
|
|||
47) DEBIAN_REPO='ftp.ua.debian.org';;
|
||||
48) DEBIAN_REPO='ftp.uk.debian.org';;
|
||||
49) DEBIAN_REPO='ftp.us.debian.org';;
|
||||
255) exit 0;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
save_configuration_file
|
||||
|
||||
|
@ -622,8 +619,8 @@ function interactive_configuration {
|
|||
16 "Google" off 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) NAMESERVER1='85.214.73.63'
|
||||
|
@ -674,7 +671,7 @@ function interactive_configuration {
|
|||
16) NAMESERVER1='8.8.8.8'
|
||||
NAMESERVER2='4.4.4.4'
|
||||
;;
|
||||
255) exit 0;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
save_configuration_file
|
||||
|
||||
|
@ -698,8 +695,8 @@ function interactive_configuration {
|
|||
14 changeip off 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) DDNS_PROVIDER="default@dyndns.org";;
|
||||
|
@ -716,7 +713,7 @@ function interactive_configuration {
|
|||
12) DDNS_PROVIDER="default@sitelutions.com";;
|
||||
13) DDNS_PROVIDER="default@dnsexit.com";;
|
||||
14) DDNS_PROVIDER="default@changeip.com";;
|
||||
255) exit 0;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
save_configuration_file
|
||||
|
||||
|
@ -729,8 +726,8 @@ function interactive_configuration {
|
|||
sel=$?
|
||||
case $sel in
|
||||
0) DDNS_USERNAME=$(cat $data);;
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
done
|
||||
save_configuration_file
|
||||
|
@ -746,8 +743,8 @@ function interactive_configuration {
|
|||
sel=$?
|
||||
case $sel in
|
||||
0) DDNS_PASSWORD=$(cat $data);;
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
if [ ${#DDNS_PASSWORD} -lt $MINIMUM_PASSWORD_LENGTH ]; then
|
||||
dialog --title "Password quality check" --msgbox "The password given was too short. It must be at least $MINIMUM_PASSWORD_LENGTH characters. You may need to change your password on the dynamic DNS provider's web site." 10 40
|
||||
|
@ -765,8 +762,8 @@ function interactive_configuration {
|
|||
sel=$?
|
||||
case $sel in
|
||||
0) MY_NAME=$(cat $data);;
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
done
|
||||
save_configuration_file
|
||||
|
@ -793,8 +790,8 @@ function interactive_configuration {
|
|||
2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
LOCAL_NETWORK_STATIC_IP_ADDRESS=$(cat $data | sed -n 1p)
|
||||
ROUTER_IP_ADDRESS=$(cat $data | sed -n 2p)
|
||||
|
@ -825,8 +822,8 @@ function interactive_configuration {
|
|||
fi
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
WIKI_TITLE=$(cat $data | sed -n 1p)
|
||||
WIKI_DOMAIN_NAME=$(cat $data | sed -n 2p)
|
||||
|
@ -877,8 +874,8 @@ function interactive_configuration {
|
|||
fi
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
MY_BLOG_TITLE=$(cat $data | sed -n 1p)
|
||||
FULLBLOG_DOMAIN_NAME=$(cat $data | sed -n 2p)
|
||||
|
@ -930,8 +927,8 @@ function interactive_configuration {
|
|||
fi
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
OWNCLOUD_DOMAIN_NAME=$(cat $data | sed -n 1p)
|
||||
if [ $OWNCLOUD_DOMAIN_NAME ]; then
|
||||
|
@ -979,8 +976,8 @@ function interactive_configuration {
|
|||
fi
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
REDMATRIX_DOMAIN_NAME=$(cat $data | sed -n 1p)
|
||||
if [ $REDMATRIX_DOMAIN_NAME ]; then
|
||||
|
@ -1028,8 +1025,8 @@ function interactive_configuration {
|
|||
fi
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
MICROBLOG_DOMAIN_NAME=$(cat $data | sed -n 1p)
|
||||
if [ $MICROBLOG_DOMAIN_NAME ]; then
|
||||
|
@ -1081,8 +1078,8 @@ function interactive_configuration {
|
|||
fi
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
GIT_DOMAIN_NAME=$(cat $data | sed -n 1p)
|
||||
if [ $GIT_DOMAIN_NAME ]; then
|
||||
|
@ -1124,8 +1121,8 @@ function interactive_configuration {
|
|||
2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
DEFAULT_DOMAIN_NAME=$(cat $data | sed -n 1p)
|
||||
DEFAULT_DOMAIN_CODE=$(cat $data | sed -n 2p)
|
||||
|
@ -1142,8 +1139,8 @@ function interactive_configuration {
|
|||
sel=$?
|
||||
case $sel in
|
||||
0) DEFAULT_DOMAIN_NAME=$(cat $data);;
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
fi
|
||||
if [ $DEFAULT_DOMAIN_NAME ]; then
|
||||
|
@ -1176,8 +1173,8 @@ function interactive_configuration {
|
|||
sel=$?
|
||||
case $sel in
|
||||
0) MY_EMAIL_ADDRESS=$(cat $data);;
|
||||
1) exit 0;;
|
||||
255) exit 0;;
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
|
|
@ -42,6 +42,9 @@ MINIMUM_PASSWORD_LENGTH=10
|
|||
# How many remote locations were specified
|
||||
entering_remote_backups_ctr=0
|
||||
|
||||
# Title shown
|
||||
TITLE='Remote Backup'
|
||||
|
||||
function show_help {
|
||||
echo ''
|
||||
echo 'freedombone-remote -u [username] -l [backup list filename] -m [min password length]'
|
||||
|
@ -53,6 +56,7 @@ function show_help {
|
|||
echo ' -u --username User to create the backups.list file for'
|
||||
echo ' -l --list Remote backup list (usually /home/$USER/backup.list)'
|
||||
echo ' -m --min Minimum password length (characters)'
|
||||
echo ' -t --title Title shown'
|
||||
echo ''
|
||||
exit 0
|
||||
}
|
||||
|
@ -82,6 +86,11 @@ case $key in
|
|||
shift
|
||||
MINIMUM_PASSWORD_LENGTH="$1"
|
||||
;;
|
||||
# Title shown
|
||||
-t|--title)
|
||||
shift
|
||||
TITLE="$1"
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
|
@ -119,7 +128,7 @@ function interactive_configuration_remote_backups {
|
|||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle "Freedombone Configuration" \
|
||||
--title "Remote Backup ${entering_remote_backups_ctr}" \
|
||||
--title "$TITLE ${entering_remote_backups_ctr}" \
|
||||
--form "\nPlease specify the SSH login details:" 11 55 4 \
|
||||
"Username:" 1 1 "" 1 16 16 15 \
|
||||
"Domain:" 2 1 "" 2 16 16 15 \
|
||||
|
@ -153,10 +162,6 @@ function interactive_configuration_remote_backups {
|
|||
if [ -f $FRIENDS_SERVERS_LIST ]; then
|
||||
chown $MY_USERNAME:$MY_USERNAME $FRIENDS_SERVERS_LIST
|
||||
fi
|
||||
|
||||
if [[ ${entering_remote_backups_ctr} > 3 ]]; then
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
function show_result {
|
||||
|
|
Loading…
Reference in New Issue