fixed bug, that would prevent re-initialization after reboot (stunnel.pem)

re-indentation
switches dfsbuild-host from "localhost" to "127.0.0.1" (in case of missing fstab)
This commit is contained in:
lars 2005-09-20 23:52:20 +00:00
parent 882b9d1bb7
commit 4c1d197472
3 changed files with 16 additions and 15 deletions

View File

@ -105,12 +105,12 @@ function create_config()
cp -a "$CONFIG_DEFAULTS_DIR/." "$CONFIG_DIR" cp -a "$CONFIG_DEFAULTS_DIR/." "$CONFIG_DIR"
log_msg "Copying temporary cerificate file to config filesystem ..." log_msg "Copying temporary cerificate file to config filesystem ..."
# beware: the temp file should always be there - even after reboot - see "mount_config"
cp -p "$CERT_TEMP" "$CERT_FILE" cp -p "$CERT_TEMP" "$CERT_FILE"
log_msg "Setting inital values ..." log_msg "Setting inital values ..."
# beware: config_set_value remounts the config partition read-only # beware: config_set_value remounts the config partition read-only
config_set_value "device" "$1" config_set_value "device" "$1"
config_set_value "ip" "$(get_current_ip)" config_set_value "ip" "$(get_current_ip)"
# reinitialise configuration # reinitialise configuration
@ -221,6 +221,8 @@ function mount_config()
if [ -n "$device" ] && mount "${device}1" "$CONFIG_DIR" if [ -n "$device" ] && mount "${device}1" "$CONFIG_DIR"
then log_msg "configuraton found on $device" then log_msg "configuraton found on $device"
config_set_value "device" "$device" config_set_value "device" "$device"
# copy certificate to /tmp in case of re-initialization
cp "$CERT_FILE" "$CERT_TEMP"
return 0 return 0
else log_msg "failed to locate harddisk" else log_msg "failed to locate harddisk"
return 1 return 1
@ -319,8 +321,6 @@ ACTION=help
case "$ACTION" in case "$ACTION" in
config-up ) config-up )
# the "cruft" option could help to prevent the error "interleaved files not (yet) supported"
mount -o remount,cruft /
if mount_config if mount_config
then echo "Cryptobox configuration successfully loaded" then echo "Cryptobox configuration successfully loaded"
else error_msg 3 "Could not find a configuration partition!" else error_msg 3 "Could not find a configuration partition!"

View File

@ -48,6 +48,8 @@ sub load_hdf
(my $script_url = $ENV{'SCRIPT_NAME'}) =~ m/^[^&]*/; (my $script_url = $ENV{'SCRIPT_NAME'}) =~ m/^[^&]*/;
$hdf->setValue("ScriptName", ($ENV{'SCRIPT_NAME'} eq '/')? '/cryptobox' : $script_url ); $hdf->setValue("ScriptName", ($ENV{'SCRIPT_NAME'} eq '/')? '/cryptobox' : $script_url );
&load_selected_language($hdf);
&get_available_languages($hdf); &get_available_languages($hdf);
return $hdf; return $hdf;
@ -75,9 +77,9 @@ sub load_selected_language
# load the data # load the data
$config_language = "$weblang"; $config_language = "$weblang";
# add the setting to every link # add the setting to every link
$pagedata->setValue('Data.PostData.weblang', "$weblang"); $data->setValue('Data.PostData.weblang', "$weblang");
} else { } else {
$pagedata->setValue('Data.Warning', 'InvalidLanguage'); $data->setValue('Data.Warning', 'InvalidLanguage');
} }
} }
# import the configured resp. the temporarily selected language # import the configured resp. the temporarily selected language
@ -86,13 +88,13 @@ sub load_selected_language
########## select documentation language ########## ########## select documentation language ##########
if (&validate_doc_language($config_language)) { if (&validate_doc_language($config_language)) {
# selected web interface language # selected web interface language
$pagedata->setValue('Settings.DocLang', "$config_language"); $data->setValue('Settings.DocLang', "$config_language");
} elsif (&validate_doc_language($DEFAULT_LANGUAGE)) { } elsif (&validate_doc_language($DEFAULT_LANGUAGE)) {
# configured CryptoBox language # configured CryptoBox language
$pagedata->setValue('Settings.DocLang', "$DEFAULT_LANGUAGE"); $data->setValue('Settings.DocLang', "$DEFAULT_LANGUAGE");
} else { } else {
# default hardcoded language (english) # default hardcoded language (english)
$pagedata->setValue('Settings.DocLang', "en"); $data->setValue('Settings.DocLang', "en");
} }
} }
@ -175,8 +177,6 @@ sub get_admin_pw
sub render sub render
{ {
&load_selected_language($pagedata);
$pagedata->setValue("PageName","$pagename"); $pagedata->setValue("PageName","$pagename");
my $pagefile = "$HTML_TEMPLATE_DIR/main.cs"; my $pagefile = "$HTML_TEMPLATE_DIR/main.cs";
print "Content-Type: text/html\n\n"; print "Content-Type: text/html\n\n";
@ -319,11 +319,11 @@ if ( ! &check_ssl()) {
# unmounten # unmounten
&umount_vol(); &umount_vol();
if (&check_mounted()) { if (&check_mounted()) {
$pagedata->setValue('Data.Warning', 'UmountFailed'); $pagedata->setValue('Data.Warning', 'UmountFailed');
$pagedata->setValue('Data.Action', 'umount_form'); $pagedata->setValue('Data.Action', 'umount_form');
} else { } else {
$pagedata->setValue('Data.Success', 'UmountDone'); $pagedata->setValue('Data.Success', 'UmountDone');
$pagedata->setValue('Data.Action', 'mount_form'); $pagedata->setValue('Data.Action', 'mount_form');
} }
} }
################ mount_do ######################## ################ mount_do ########################
@ -450,6 +450,7 @@ if ( ! &check_ssl()) {
$pagedata->setValue('Data.Action', 'config_form'); $pagedata->setValue('Data.Action', 'config_form');
} else { } else {
system("$CB_SCRIPT", "set_config", "language", $query->param('language')); system("$CB_SCRIPT", "set_config", "language", $query->param('language'));
&load_selected_language($pagedata);
system("$CB_SCRIPT", "set_config", "timeout", $query->param('timeout')); system("$CB_SCRIPT", "set_config", "timeout", $query->param('timeout'));
# check, if the ip was reconfigured # check, if the ip was reconfigured
if ($query->param('ip') ne `$CB_SCRIPT get_config ip`) if ($query->param('ip') ne `$CB_SCRIPT get_config ip`)

View File

@ -118,7 +118,7 @@ allpackages = util-linux
#patch #patch
# Default mirror for "repo" sections # Default mirror for "repo" sections
mirror = http://localhost/apt-cacher/ftp.de.debian.org/debian mirror = http://127.0.0.1/apt-cacher/ftp.de.debian.org/debian
#mirror = http://ftp.debian.org/debian #mirror = http://ftp.debian.org/debian
#mirror = http://mirrors/debian #mirror = http://mirrors/debian