Configure.sh: make dynamic variable prompts and run without tokenfile
This commit is contained in:
+10
-28
@@ -45,40 +45,20 @@ do_configure() {
|
||||
unset TLDOMAIN DOMAIN SERVERFQDN_IPA SERVERFQDN_NC CLIENTADMINGROUP \
|
||||
DECRYPTEDDATADIR ENCRYPTEDDATADIR IPAVAULTUSE IPAVAULTNAME HOSTNM FQDN
|
||||
# shellcheck disable=SC1090
|
||||
source "$CONF_FILE"
|
||||
|
||||
echo ""
|
||||
echo "=== System Configuration ==="
|
||||
echo "Press Enter to keep the current value, or type a new one."
|
||||
echo ""
|
||||
|
||||
new_TLDOMAIN=$(prompt_value "TLDOMAIN" "$TLDOMAIN")
|
||||
TLDOMAIN="$new_TLDOMAIN"
|
||||
|
||||
DOMAIN="ipa.$TLDOMAIN}"
|
||||
new_DOMAIN=$(prompt_value "DOMAIN" "$DOMAIN")
|
||||
DOMAIN="${new_DOMAIN}"
|
||||
|
||||
SERVERFQDN_IPA="ipa.${TLDOMAIN}"
|
||||
new_SERVERFQDN_IPA=$(prompt_value "SERVERFQDN_IPA" "$SERVERFQDN_IPA")
|
||||
SERVERFQDN_IPA="$new_SERVERFQDN_IPA"
|
||||
|
||||
SERVERFQDN_NC="nextcloud.${TLDOMAIN}"
|
||||
new_SERVERFQDN_NC=$(prompt_value "SERVERFQDN_NC" "$SERVERFQDN_NC")
|
||||
SERVERFQDN_NC="$new_SERVERFQDN_NC"
|
||||
|
||||
new_CLIENTADMINGROUP=$(prompt_value "CLIENTADMINGROUP" "$CLIENTADMINGROUP")
|
||||
CLIENTADMINGROUP="$new_CLIENTADMINGROUP"
|
||||
|
||||
set_conf_var "TLDOMAIN" "$new_TLDOMAIN"
|
||||
set_conf_var "DOMAIN" "$DOMAIN"
|
||||
set_conf_var "SERVERFQDN_IPA" "$new_SERVERFQDN_IPA"
|
||||
set_conf_var "SERVERFQDN_NC" "$new_SERVERFQDN_NC"
|
||||
set_conf_var "CLIENTADMINGROUP" "$new_CLIENTADMINGROUP"
|
||||
|
||||
# Re-source with the updated TLDOMAIN so DOMAIN and FQDN are recomputed correctly.
|
||||
unset DOMAIN HOSTNM FQDN
|
||||
source "$CONF_FILE"
|
||||
VARS=("TLDOMAIN" "DOMAIN" "SERVERFQDN_IPA" "SERVERFQDN_NC" "CLIENTADMINGROUP" )
|
||||
for ELE in "${VARS[@]}"
|
||||
do
|
||||
new_ELE=$(prompt_value "${ELE}" "${!ELE}")
|
||||
set_conf_var "${ELE}" "${new_ELE}"
|
||||
source "$CONF_FILE"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "Configuration written to: ${CONF_FILE}"
|
||||
@@ -94,8 +74,10 @@ while true; do
|
||||
echo ""
|
||||
echo "=== Testing: obtaining Nextcloud WebDAV token ==="
|
||||
while true; do
|
||||
# This makes the Token only available for this session
|
||||
# This makes the Token only available for this session, not written to disk
|
||||
unset DAVTOKENFILENAME
|
||||
#Sets a temporay Hostname for the Token
|
||||
export HOSTNM="OEMDRV_TEST_TOKEN"
|
||||
get_nc_token
|
||||
current_user="$(id -un)"
|
||||
if [[ "${DAVTOKEN_USER}" == "${current_user}" ]]; then
|
||||
|
||||
@@ -82,7 +82,8 @@ get_nc_token() {
|
||||
return 1 # Token for Superuser makes no sense and cannot work
|
||||
fi
|
||||
|
||||
if [ ${IPAVAULTUSE} == "true" ]; then
|
||||
# If Filename is given andf encryption is turned on, than first check for encrypted Directory
|
||||
if [ ${IPAVAULTUSE} == "true" ] && [ ! -z ${DAVTOKENFILENAME} ]; then
|
||||
check_data_isecrypted
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Data Directory is not encrypted. Please mount it first."
|
||||
|
||||
Reference in New Issue
Block a user