Consolidation of configuration variables
This commit is contained in:
parent
3750bd9215
commit
811a39a924
|
@ -172,7 +172,7 @@ function choose_email_address {
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
save_configuration_file
|
save_configuration_values
|
||||||
}
|
}
|
||||||
|
|
||||||
function choose_default_domain_name {
|
function choose_default_domain_name {
|
||||||
|
@ -227,7 +227,7 @@ function choose_default_domain_name {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
save_configuration_file
|
save_configuration_values
|
||||||
}
|
}
|
||||||
|
|
||||||
function choose_static_ip {
|
function choose_static_ip {
|
||||||
|
@ -271,7 +271,7 @@ function choose_static_ip {
|
||||||
esac
|
esac
|
||||||
LOCAL_NETWORK_STATIC_IP_ADDRESS=$(cat $data | sed -n 1p)
|
LOCAL_NETWORK_STATIC_IP_ADDRESS=$(cat $data | sed -n 1p)
|
||||||
ROUTER_IP_ADDRESS=$(cat $data | sed -n 2p)
|
ROUTER_IP_ADDRESS=$(cat $data | sed -n 2p)
|
||||||
save_configuration_file
|
save_configuration_values
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ function choose_dynamic_dns {
|
||||||
14) DDNS_PROVIDER="default@changeip.com";;
|
14) DDNS_PROVIDER="default@changeip.com";;
|
||||||
255) exit 1;;
|
255) exit 1;;
|
||||||
esac
|
esac
|
||||||
save_configuration_file
|
save_configuration_values
|
||||||
|
|
||||||
valid_ddns_username=
|
valid_ddns_username=
|
||||||
while [ ! $valid_ddns_username ]
|
while [ ! $valid_ddns_username ]
|
||||||
|
@ -343,7 +343,7 @@ function choose_dynamic_dns {
|
||||||
255) exit 1;;
|
255) exit 1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
save_configuration_file
|
save_configuration_values
|
||||||
|
|
||||||
valid_ddns_password=
|
valid_ddns_password=
|
||||||
while [ ! $valid_ddns_password ]
|
while [ ! $valid_ddns_password ]
|
||||||
|
@ -373,7 +373,7 @@ function choose_dynamic_dns {
|
||||||
DDNS_PASSWORD=""
|
DDNS_PASSWORD=""
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
save_configuration_file
|
save_configuration_values
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,7 +455,7 @@ function choose_dns {
|
||||||
;;
|
;;
|
||||||
255) exit 1;;
|
255) exit 1;;
|
||||||
esac
|
esac
|
||||||
save_configuration_file
|
save_configuration_values
|
||||||
else
|
else
|
||||||
# as defaults for a minimal install process these settings are debatable
|
# as defaults for a minimal install process these settings are debatable
|
||||||
NAMESERVER1='85.214.73.63'
|
NAMESERVER1='85.214.73.63'
|
||||||
|
@ -575,7 +575,7 @@ function choose_debian_repo {
|
||||||
49) DEBIAN_REPO='ftp.us.debian.org';;
|
49) DEBIAN_REPO='ftp.us.debian.org';;
|
||||||
255) exit 1;;
|
255) exit 1;;
|
||||||
esac
|
esac
|
||||||
save_configuration_file
|
save_configuration_values
|
||||||
else
|
else
|
||||||
DEBIAN_REPO='ftp.de.debian.org'
|
DEBIAN_REPO='ftp.de.debian.org'
|
||||||
fi
|
fi
|
||||||
|
@ -605,7 +605,7 @@ function choose_rng {
|
||||||
else
|
else
|
||||||
HWRNG_TYPE="beaglebone"
|
HWRNG_TYPE="beaglebone"
|
||||||
fi
|
fi
|
||||||
save_configuration_file
|
save_configuration_values
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,7 +631,7 @@ function choose_social_key_management {
|
||||||
0) ENABLE_SOCIAL_KEY_MANAGEMENT="yes";;
|
0) ENABLE_SOCIAL_KEY_MANAGEMENT="yes";;
|
||||||
255) exit 1;;
|
255) exit 1;;
|
||||||
esac
|
esac
|
||||||
save_configuration_file
|
save_configuration_values
|
||||||
else
|
else
|
||||||
# enable for the minimal case
|
# enable for the minimal case
|
||||||
ENABLE_SOCIAL_KEY_MANAGEMENT="yes"
|
ENABLE_SOCIAL_KEY_MANAGEMENT="yes"
|
||||||
|
@ -659,7 +659,7 @@ function choose_beaglebone_options {
|
||||||
if [[ $INSTALLING_ON_BBB == "yes" ]]; then
|
if [[ $INSTALLING_ON_BBB == "yes" ]]; then
|
||||||
USB_DRIVE=/dev/sda1
|
USB_DRIVE=/dev/sda1
|
||||||
fi
|
fi
|
||||||
save_configuration_file
|
save_configuration_values
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -742,7 +742,7 @@ function choose_username {
|
||||||
echo $"The directory /home/$MY_USERNAME does not exist"
|
echo $"The directory /home/$MY_USERNAME does not exist"
|
||||||
exit 6437
|
exit 6437
|
||||||
fi
|
fi
|
||||||
save_configuration_file
|
save_configuration_values
|
||||||
}
|
}
|
||||||
|
|
||||||
function choose_full_name {
|
function choose_full_name {
|
||||||
|
@ -768,7 +768,7 @@ function choose_full_name {
|
||||||
255) exit 1;;
|
255) exit 1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
save_configuration_file
|
save_configuration_values
|
||||||
}
|
}
|
||||||
|
|
||||||
function choose_system_variant {
|
function choose_system_variant {
|
||||||
|
@ -795,7 +795,7 @@ function choose_system_variant {
|
||||||
27 40 20 $varslist)
|
27 40 20 $varslist)
|
||||||
variant_choice=$((variant_choice - 1))
|
variant_choice=$((variant_choice - 1))
|
||||||
export SYSTEM_TYPE=${variants_list[$variant_choice]}
|
export SYSTEM_TYPE=${variants_list[$variant_choice]}
|
||||||
save_configuration_file
|
save_configuration_values
|
||||||
write_config_param "SYSTEM_TYPE" "$SYSTEM_TYPE"
|
write_config_param "SYSTEM_TYPE" "$SYSTEM_TYPE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -854,53 +854,6 @@ do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
function save_configuration_file {
|
|
||||||
if [ ! $CONFIGURATION_FILE ]; then
|
|
||||||
CONFIGURATION_FILE='freedombone.cfg'
|
|
||||||
fi
|
|
||||||
|
|
||||||
save_variables=(MY_USERNAME
|
|
||||||
DEFAULT_DOMAIN_NAME
|
|
||||||
DEFAULT_DOMAIN_CODE
|
|
||||||
SYSTEM_TYPE
|
|
||||||
INSTALLING_ON_BBB
|
|
||||||
USB_DRIVE
|
|
||||||
DDNS_PROVIDER
|
|
||||||
DDNS_USERNAME
|
|
||||||
DDNS_PASSWORD
|
|
||||||
DEFAULT_LANGUAGE
|
|
||||||
MY_NAME
|
|
||||||
MY_EMAIL_ADDRESS
|
|
||||||
LOCAL_NETWORK_STATIC_IP_ADDRESS
|
|
||||||
ROUTER_IP_ADDRESS
|
|
||||||
ENABLE_CJDNS
|
|
||||||
ENABLE_BATMAN
|
|
||||||
ENABLE_BABEL
|
|
||||||
DEBIAN_REPO
|
|
||||||
NAMESERVER1
|
|
||||||
NAMESERVER2
|
|
||||||
HWRNG_TYPE
|
|
||||||
ENABLE_SOCIAL_KEY_MANAGEMENT
|
|
||||||
WIFI_SSID
|
|
||||||
WIFI_INTERFACE
|
|
||||||
WIFI_TYPE
|
|
||||||
WIFI_PASSPHRASE
|
|
||||||
WIFI_HOTSPOT
|
|
||||||
BATMAN_CELLID
|
|
||||||
WIFI_CHANNEL
|
|
||||||
DH_KEYLENGTH
|
|
||||||
ONION_ONLY
|
|
||||||
FRIENDS_MIRRORS_SERVER
|
|
||||||
FRIENDS_MIRRORS_SSH_PORT
|
|
||||||
FRIENDS_MIRRORS_PASSWORD
|
|
||||||
MY_MIRRORS_PASSWORD)
|
|
||||||
|
|
||||||
for v in "${save_variables[@]}"
|
|
||||||
do
|
|
||||||
write_config_param "$v" "${!v}"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# test a domain name to see if it's valid
|
# test a domain name to see if it's valid
|
||||||
function validate_domain_name {
|
function validate_domain_name {
|
||||||
# count the number of dots in the domain name
|
# count the number of dots in the domain name
|
||||||
|
@ -1169,7 +1122,7 @@ function set_main_repo {
|
||||||
dialog --title $"Main Repository" \
|
dialog --title $"Main Repository" \
|
||||||
--msgbox $"Main repository set to $FRIENDS_MIRRORS_SERVER" 6 60
|
--msgbox $"Main repository set to $FRIENDS_MIRRORS_SERVER" 6 60
|
||||||
fi
|
fi
|
||||||
save_configuration_file
|
save_configuration_values
|
||||||
}
|
}
|
||||||
|
|
||||||
function interactive_select_language {
|
function interactive_select_language {
|
||||||
|
@ -1320,7 +1273,7 @@ function interactive_select_language {
|
||||||
67) DEFAULT_LANGUAGE='uk_UA.UTF-8';;
|
67) DEFAULT_LANGUAGE='uk_UA.UTF-8';;
|
||||||
68) DEFAULT_LANGUAGE='vi_VN.UTF-8';;
|
68) DEFAULT_LANGUAGE='vi_VN.UTF-8';;
|
||||||
esac
|
esac
|
||||||
save_configuration_file
|
save_configuration_values
|
||||||
|
|
||||||
update-locale LANG=${DEFAULT_LANGUAGE}
|
update-locale LANG=${DEFAULT_LANGUAGE}
|
||||||
update-locale LANGUAGE=${DEFAULT_LANGUAGE}
|
update-locale LANGUAGE=${DEFAULT_LANGUAGE}
|
||||||
|
@ -1415,4 +1368,5 @@ fi
|
||||||
read_configuration_values
|
read_configuration_values
|
||||||
interactive_config
|
interactive_config
|
||||||
show_result
|
show_result
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -28,6 +28,81 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
configuration_variables=(FRIENDS_MIRRORS_SERVER
|
||||||
|
FRIENDS_MIRRORS_SSH_PORT
|
||||||
|
FRIENDS_MIRRORS_PASSWORD
|
||||||
|
MY_MIRRORS_PASSWORD
|
||||||
|
SYSTEM_TYPE
|
||||||
|
SSL_PROTOCOLS
|
||||||
|
SSL_CIPHERS
|
||||||
|
SSH_CIPHERS
|
||||||
|
SSH_MACS
|
||||||
|
SSH_KEX
|
||||||
|
SSH_HOST_KEY_ALGORITHMS
|
||||||
|
SSH_PASSWORDS
|
||||||
|
REFRESH_GPG_KEYS_HOURS
|
||||||
|
GPG_KEYSERVER
|
||||||
|
ENABLE_SOCIAL_KEY_MANAGEMENT
|
||||||
|
MY_USERNAME
|
||||||
|
DOMAIN_NAME
|
||||||
|
DEFAULT_DOMAIN_NAME
|
||||||
|
DEFAULT_DOMAIN_CODE
|
||||||
|
NAMESERVER1
|
||||||
|
NAMESERVER2
|
||||||
|
GET_IP_ADDRESS_URL
|
||||||
|
DDNS_PROVIDER
|
||||||
|
DDNS_USERNAME
|
||||||
|
DDNS_PASSWORD
|
||||||
|
LOCAL_NETWORK_STATIC_IP_ADDRESS
|
||||||
|
ROUTER_IP_ADDRESS
|
||||||
|
CPU_CORES
|
||||||
|
WEBSERVER_LOG_LEVEL
|
||||||
|
ROUTE_THROUGH_TOR
|
||||||
|
MY_NAME
|
||||||
|
MY_EMAIL_ADDRESS
|
||||||
|
INSTALLING_ON_BBB
|
||||||
|
SSH_PORT
|
||||||
|
INSTALLED_WITHIN_DOCKER
|
||||||
|
GPG_ENCRYPT_STORED_EMAIL
|
||||||
|
MY_GPG_PUBLIC_KEY
|
||||||
|
MY_GPG_PRIVATE_KEY
|
||||||
|
MY_GPG_PUBLIC_KEY_ID
|
||||||
|
USB_DRIVE
|
||||||
|
MAX_PHP_MEMORY
|
||||||
|
TLS_TIME_SOURCE1
|
||||||
|
TLS_TIME_SOURCE2
|
||||||
|
ONION_ONLY
|
||||||
|
DEFAULT_LANGUAGE
|
||||||
|
MINIMAL_INSTALL
|
||||||
|
LETSENCRYPT_SERVER
|
||||||
|
WIFI_INTERFACE
|
||||||
|
WIFI_SSID
|
||||||
|
WIFI_TYPE
|
||||||
|
WIFI_PASSPHRASE
|
||||||
|
WIFI_HOTSPOT
|
||||||
|
WIFI_NETWORKS_FILE
|
||||||
|
DEFAULT_SEARCH
|
||||||
|
SEARCH_ENGINE_PASSWORD
|
||||||
|
PROJECT_WEBSITE
|
||||||
|
PROJECT_REPO
|
||||||
|
GPGIT_REPO
|
||||||
|
GPGIT_COMMIT
|
||||||
|
NGINX_ENSITE_REPO
|
||||||
|
NGINX_ENSITE_REPO
|
||||||
|
NGINX_ENSITE_COMMIT
|
||||||
|
CLEANUP_MAILDIR_COMMIT
|
||||||
|
CLEANUP_MAILDIR_REPO
|
||||||
|
INADYN_REPO
|
||||||
|
INADYN_COMMIT
|
||||||
|
DH_KEYLENGTH
|
||||||
|
WIFI_CHANNEL
|
||||||
|
IPV6_NETWORK
|
||||||
|
HWRNG_TYPE
|
||||||
|
ENABLE_BABEL
|
||||||
|
ENABLE_BATMAN
|
||||||
|
ENABLE_CJDNS
|
||||||
|
PUBLIC_MAILING_LIST)
|
||||||
|
|
||||||
function read_config_param {
|
function read_config_param {
|
||||||
param_name="$1"
|
param_name="$1"
|
||||||
|
|
||||||
|
@ -63,6 +138,17 @@ function write_config_param {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function save_configuration_values {
|
||||||
|
if [ ! $CONFIGURATION_FILE ]; then
|
||||||
|
CONFIGURATION_FILE='freedombone.cfg'
|
||||||
|
fi
|
||||||
|
|
||||||
|
for v in "${configuration_variables[@]}"
|
||||||
|
do
|
||||||
|
write_config_param "$v" "${!v}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
function read_configuration_values {
|
function read_configuration_values {
|
||||||
# if not installing on a Beaglebone then use sdb as the USB drive by default
|
# if not installing on a Beaglebone then use sdb as the USB drive by default
|
||||||
if [ ! $INSTALLING_ON_BBB ]; then
|
if [ ! $INSTALLING_ON_BBB ]; then
|
||||||
|
@ -79,82 +165,7 @@ function read_configuration_values {
|
||||||
cp $CONFIGURATION_FILE /root/${PROJECT_NAME}.cfg
|
cp $CONFIGURATION_FILE /root/${PROJECT_NAME}.cfg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read_config_variables=(FRIENDS_MIRRORS_SERVER
|
for v in "${configuration_variables[@]}"
|
||||||
FRIENDS_MIRRORS_SSH_PORT
|
|
||||||
FRIENDS_MIRRORS_PASSWORD
|
|
||||||
MY_MIRRORS_PASSWORD
|
|
||||||
SYSTEM_TYPE
|
|
||||||
SSL_PROTOCOLS
|
|
||||||
SSL_CIPHERS
|
|
||||||
SSH_CIPHERS
|
|
||||||
SSH_MACS
|
|
||||||
SSH_KEX
|
|
||||||
SSH_HOST_KEY_ALGORITHMS
|
|
||||||
SSH_PASSWORDS
|
|
||||||
REFRESH_GPG_KEYS_HOURS
|
|
||||||
GPG_KEYSERVER
|
|
||||||
ENABLE_SOCIAL_KEY_MANAGEMENT
|
|
||||||
MY_USERNAME
|
|
||||||
DOMAIN_NAME
|
|
||||||
DEFAULT_DOMAIN_NAME
|
|
||||||
DEFAULT_DOMAIN_CODE
|
|
||||||
NAMESERVER1
|
|
||||||
NAMESERVER2
|
|
||||||
GET_IP_ADDRESS_URL
|
|
||||||
DDNS_PROVIDER
|
|
||||||
DDNS_USERNAME
|
|
||||||
DDNS_PASSWORD
|
|
||||||
LOCAL_NETWORK_STATIC_IP_ADDRESS
|
|
||||||
ROUTER_IP_ADDRESS
|
|
||||||
CPU_CORES
|
|
||||||
WEBSERVER_LOG_LEVEL
|
|
||||||
ROUTE_THROUGH_TOR
|
|
||||||
MY_NAME
|
|
||||||
MY_EMAIL_ADDRESS
|
|
||||||
INSTALLING_ON_BBB
|
|
||||||
SSH_PORT
|
|
||||||
INSTALLED_WITHIN_DOCKER
|
|
||||||
GPG_ENCRYPT_STORED_EMAIL
|
|
||||||
MY_GPG_PUBLIC_KEY
|
|
||||||
MY_GPG_PRIVATE_KEY
|
|
||||||
MY_GPG_PUBLIC_KEY_ID
|
|
||||||
USB_DRIVE
|
|
||||||
MAX_PHP_MEMORY
|
|
||||||
TLS_TIME_SOURCE1
|
|
||||||
TLS_TIME_SOURCE2
|
|
||||||
ONION_ONLY
|
|
||||||
DEFAULT_LANGUAGE
|
|
||||||
MINIMAL_INSTALL
|
|
||||||
LETSENCRYPT_SERVER
|
|
||||||
WIFI_INTERFACE
|
|
||||||
WIFI_SSID
|
|
||||||
WIFI_TYPE
|
|
||||||
WIFI_PASSPHRASE
|
|
||||||
WIFI_HOTSPOT
|
|
||||||
WIFI_NETWORKS_FILE
|
|
||||||
DEFAULT_SEARCH
|
|
||||||
SEARCH_ENGINE_PASSWORD
|
|
||||||
PROJECT_WEBSITE
|
|
||||||
PROJECT_REPO
|
|
||||||
GPGIT_REPO
|
|
||||||
GPGIT_COMMIT
|
|
||||||
NGINX_ENSITE_REPO
|
|
||||||
NGINX_ENSITE_REPO
|
|
||||||
NGINX_ENSITE_COMMIT
|
|
||||||
CLEANUP_MAILDIR_COMMIT
|
|
||||||
CLEANUP_MAILDIR_REPO
|
|
||||||
INADYN_REPO
|
|
||||||
INADYN_COMMIT
|
|
||||||
DH_KEYLENGTH
|
|
||||||
WIFI_CHANNEL
|
|
||||||
IPV6_NETWORK
|
|
||||||
HWRNG_TYPE
|
|
||||||
ENABLE_BABEL
|
|
||||||
ENABLE_BATMAN
|
|
||||||
ENABLE_CJDNS
|
|
||||||
PUBLIC_MAILING_LIST)
|
|
||||||
|
|
||||||
for v in "${read_config_variables[@]}"
|
|
||||||
do
|
do
|
||||||
read_config_param "$v"
|
read_config_param "$v"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue