Use f_show_msg() instead of f_dialog_msgbox() where appropriate. The main
difference between these two functions: Usage: f_show_msg() $format_string [ $format_args ... ] Usage: f_dialog_msgbox() $text [ $hline ] The former lends itself well to displaying the $msg_* i18n text, prompts, etc. While the latter is better for text you do not control (error strings captured as a response from external commands) -- or if you have to control the hline.
This commit is contained in:
parent
e45e1f2730
commit
7079fc4e02
@ -124,7 +124,7 @@ f_dialog_menu_netdev()
|
||||
done
|
||||
)
|
||||
if [ ! "$interfaces" ]; then
|
||||
f_dialog_msgbox "$msg_no_network_interfaces"
|
||||
f_show_msg "$msg_no_network_interfaces"
|
||||
return $FAILURE
|
||||
fi
|
||||
|
||||
|
@ -371,9 +371,9 @@ f_dialog_input_nameserver()
|
||||
local retval=$?
|
||||
case $retval in
|
||||
1) f_die 1 "$msg_internal_error_nsindex_value" "$nsindex" ;;
|
||||
2) f_dialog_msgbox "$msg_resolv_conf_changed_while_editing"
|
||||
2) f_show_msg "$msg_resolv_conf_changed_while_editing"
|
||||
return $retval ;;
|
||||
3) f_dialog_msgbox "$msg_resolv_conf_entry_no_longer_exists"
|
||||
3) f_show_msg "$msg_resolv_conf_entry_no_longer_exists"
|
||||
return $retval ;;
|
||||
esac
|
||||
|
||||
|
@ -75,7 +75,7 @@ f_mustberoot_init
|
||||
if f_dialog_input_password; then
|
||||
err=$( echo "$pw_password" | pw usermod $USER_ROOT -h 0 2>&1 ) ||
|
||||
f_die $? "%s" "$err"
|
||||
f_dialog_msgbox "$msg_password_changed"
|
||||
f_show_msg "$msg_password_changed"
|
||||
fi
|
||||
|
||||
return $SUCCESS
|
||||
|
@ -100,13 +100,13 @@ f_dialog_input_password()
|
||||
|
||||
# Check for NULL entry
|
||||
if ! [ "$_password1" -o "$_password2" ]; then
|
||||
f_dialog_msgbox "$msg_password_is_empty"
|
||||
f_show_msg "$msg_password_is_empty"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Check for password mismatch
|
||||
if [ "$_password1" != "$_password2" ]; then
|
||||
f_dialog_msgbox "$msg_passwords_do_not_match"
|
||||
f_show_msg "$msg_passwords_do_not_match"
|
||||
continue
|
||||
fi
|
||||
|
||||
|
@ -61,7 +61,7 @@ f_media_set_cdrom()
|
||||
ndevs=$( set -- $devs; echo $# )
|
||||
|
||||
if [ ${ndevs:=0} -eq 0 ]; then
|
||||
f_interactive && f_dialog_msgbox "$msg_no_cd_dvd_devices_found"
|
||||
f_interactive && f_show_msg "$msg_no_cd_dvd_devices_found"
|
||||
return $FAILURE
|
||||
elif [ $ndevs -gt 1 ]; then
|
||||
local title="$msg_choose_a_cd_dvd_type"
|
||||
|
@ -59,7 +59,7 @@ f_media_set_dos()
|
||||
ndevs=$( set -- $devs; echo $# )
|
||||
|
||||
if [ ${ndevs:=0} -eq 0 ]; then
|
||||
f_dialog_msgbox "$msg_no_dos_primary_partitions_found"
|
||||
f_show_msg "$msg_no_dos_primary_partitions_found"
|
||||
return $FAILURE
|
||||
elif [ $ndevs -gt 1 ]; then
|
||||
local title="$msg_choose_a_dos_partition"
|
||||
|
@ -60,7 +60,7 @@ f_media_set_floppy()
|
||||
ndevs=$( set -- $devs; echo $# )
|
||||
|
||||
if [ ${ndevs:=0} -eq 0 ]; then
|
||||
f_interactive && f_dialog_msgbox "$msg_no_floppy_devices_found"
|
||||
f_interactive && f_show_msg "$msg_no_floppy_devices_found"
|
||||
return $FAILURE
|
||||
elif [ $ndevs -gt 1 ]; then
|
||||
local title="$msg_choose_a_floppy_drive"
|
||||
|
@ -630,8 +630,7 @@ f_media_init_ftp()
|
||||
! f_getvar $VAR_FTP_PATH cp ||
|
||||
[ ! "$cp" ]
|
||||
then
|
||||
f_dialog_msgbox \
|
||||
"$msg_unable_to_get_proper_ftp_path"
|
||||
f_show_msg "$msg_unable_to_get_proper_ftp_path"
|
||||
f_device_network_down $dev
|
||||
return $FAILURE
|
||||
fi
|
||||
@ -642,7 +641,7 @@ f_media_init_ftp()
|
||||
f_getvar $VAR_FTP_HOST ftp_host &&
|
||||
f_getvar $VAR_FTP_DIR ftp_dir
|
||||
}; then
|
||||
f_dialog_msgbox "$msg_missing_ftp_host_or_directory"
|
||||
f_show_msg "$msg_missing_ftp_host_or_directory"
|
||||
f_device_network_down $dev
|
||||
return $FAILURE
|
||||
fi
|
||||
|
@ -110,7 +110,7 @@ f_media_init_network()
|
||||
local rp
|
||||
f_getvar $VAR_GATEWAY rp
|
||||
if [ ! "$rp" ]; then
|
||||
f_dialog_msgbox "$msg_no_gateway_has_been_set"
|
||||
f_show_msg "$msg_no_gateway_has_been_set"
|
||||
else
|
||||
#
|
||||
# Explicitly flush all routes to get back to a
|
||||
@ -121,7 +121,7 @@ f_media_init_network()
|
||||
f_quietly route -n flush
|
||||
f_dprintf "Adding default route to %s." "$rp"
|
||||
if ! f_quietly route -n add default "$rp"; then
|
||||
f_dialog_msgbox \
|
||||
f_show_msg \
|
||||
"$msg_failed_to_add_default_route"
|
||||
return $FAILURE
|
||||
fi
|
||||
|
@ -82,7 +82,7 @@ f_media_set_nfs()
|
||||
case "$nfs" in
|
||||
*:*) : valid NFS path ;;
|
||||
*)
|
||||
f_dialog_msgbox "$msg_invalid_nfs_path_specification"
|
||||
f_show_msg "$msg_invalid_nfs_path_specification"
|
||||
return $FAILURE
|
||||
esac
|
||||
|
||||
|
@ -456,20 +456,20 @@ f_dialog_validate_tcpip()
|
||||
local ipnum masknum
|
||||
|
||||
if [ ! "$hostname" ]; then
|
||||
f_dialog_msgbox "$msg_must_specify_a_host_name_of_some_sort"
|
||||
f_show_msg "$msg_must_specify_a_host_name_of_some_sort"
|
||||
elif ! f_validate_hostname "$hostname"; then
|
||||
f_dialog_msgbox "$msg_invalid_hostname_value"
|
||||
f_show_msg "$msg_invalid_hostname_value"
|
||||
elif [ "$netmask" ] && ! f_validate_netmask "$netmask"; then
|
||||
f_dialog_msgbox "$msg_invalid_netmask_value"
|
||||
f_show_msg "$msg_invalid_netmask_value"
|
||||
elif [ "$nameserver" ] &&
|
||||
! f_validate_ipaddr "$nameserver" &&
|
||||
! f_validate_ipaddr6 "$nameserver"; then
|
||||
f_dialog_msgbox "$msg_invalid_name_server_ip_address_specified"
|
||||
! f_validate_ipaddr "$nameserver" &&
|
||||
! f_validate_ipaddr6 "$nameserver"; then
|
||||
f_show_msg "$msg_invalid_name_server_ip_address_specified"
|
||||
elif [ "$ipaddr" ] && ! f_validate_ipaddr "$ipaddr" "$netmask"; then
|
||||
f_dialog_msgbox "$msg_invalid_ipv4_address"
|
||||
f_show_msg "$msg_invalid_ipv4_address"
|
||||
elif [ "$gateway" -a "$gateway" != "NO" ] &&
|
||||
! f_validate_gateway "$gateway" "$ipaddr" "$netmask"; then
|
||||
f_dialog_msgbox "$msg_invalid_gateway_ipv4_address_specified"
|
||||
! f_validate_gateway "$gateway" "$ipaddr" "$netmask"; then
|
||||
f_show_msg "$msg_invalid_gateway_ipv4_address_specified"
|
||||
else
|
||||
return $SUCCESS
|
||||
fi
|
||||
@ -1264,7 +1264,7 @@ f_device_dialog_tcp()
|
||||
if f_netinteractive || f_interactive || [ ! "$_hostname" ]
|
||||
then
|
||||
[ ! "$_hostname" ] && f_interactive &&
|
||||
f_dialog_msgbox "$msg_hostname_variable_not_set"
|
||||
f_show_msg "$msg_hostname_variable_not_set"
|
||||
|
||||
local title=" $msg_network_configuration "
|
||||
local hline="$hline_alnum_arrows_punc_tab_enter"
|
||||
@ -1593,7 +1593,7 @@ f_device_select_tcp()
|
||||
fi
|
||||
done
|
||||
|
||||
f_interactive && f_dialog_msgbox "$msg_no_network_devices"
|
||||
f_interactive && f_show_msg "$msg_no_network_devices"
|
||||
return $FAILURE
|
||||
|
||||
fi # $network_dev
|
||||
@ -1616,7 +1616,7 @@ f_device_select_tcp()
|
||||
|
||||
local retval=$SUCCESS
|
||||
if [ ${cnt:=0} -eq 0 ]; then
|
||||
f_dialog_msgbox "$msg_no_network_devices"
|
||||
f_show_msg "$msg_no_network_devices"
|
||||
retval=$FAILURE
|
||||
elif [ $cnt -eq 1 ]; then
|
||||
f_device_dialog_tcp $dev
|
||||
|
@ -60,7 +60,7 @@ f_media_set_usb()
|
||||
ndevs=$( set -- $devs; echo $# )
|
||||
|
||||
if [ ${ndevs:=0} -eq 0 ]; then
|
||||
f_dialog_msgbox "$msg_no_usb_devices_found"
|
||||
f_show_msg "$msg_no_usb_devices_found"
|
||||
return $FAILURE
|
||||
elif [ $ndevs -gt 1 ]; then
|
||||
local title="$msg_choose_a_usb_drive"
|
||||
|
@ -330,7 +330,7 @@ f_authenticate_some_user()
|
||||
unset user_pass # scrub memory
|
||||
if [ ! "$user" ]; then
|
||||
nfailures=$(( $nfailures + 1 ))
|
||||
f_dialog_msgbox "$msg_no_username"
|
||||
f_show_msg "$msg_no_username"
|
||||
continue
|
||||
fi
|
||||
if [ ! "$SECURE_ALLOW_ROOT" ]; then
|
||||
|
@ -469,14 +469,14 @@ f_dialog_input_rcvar()
|
||||
|
||||
# Check for invalid entry (1of2)
|
||||
if ! echo "$_input" | grep -q "^[[:alpha:]_]"; then
|
||||
f_dialog_msgbox "$msg_rcvar_must_start_with"
|
||||
f_show_msg "$msg_rcvar_must_start_with"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Check for invalid entry (2of2)
|
||||
if ! echo "$_input" | grep -q "^[[:alpha:]_][[:alnum:]_]*$"
|
||||
then
|
||||
f_dialog_msgbox "$msg_rcvar_contains_invalid_chars"
|
||||
f_show_msg "$msg_rcvar_contains_invalid_chars"
|
||||
continue
|
||||
fi
|
||||
|
||||
|
@ -66,7 +66,7 @@ save_changes()
|
||||
f_dialog_msgbox "$msg_error $err\n"
|
||||
return $retval
|
||||
fi
|
||||
f_dialog_msgbox "$msg_group_deleted"
|
||||
f_show_msg "$msg_group_deleted"
|
||||
;;
|
||||
Add)
|
||||
local cmd="pw groupadd -n '$group_name'"
|
||||
@ -85,7 +85,7 @@ save_changes()
|
||||
f_dialog_msgbox "$msg_error $err\n"
|
||||
return $retval
|
||||
fi
|
||||
f_dialog_msgbox "$msg_group_added"
|
||||
f_show_msg "$msg_group_added"
|
||||
;;
|
||||
Edit/View)
|
||||
local cmd="pw groupmod -n '$group_name'"
|
||||
@ -104,7 +104,7 @@ save_changes()
|
||||
f_dialog_msgbox "$msg_error $err\n"
|
||||
return $retval
|
||||
fi
|
||||
f_dialog_msgbox "$msg_group_updated"
|
||||
f_show_msg "$msg_group_updated"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -138,13 +138,13 @@ f_dialog_input_group_name()
|
||||
|
||||
# Check for NULL entry
|
||||
if [ ! "$_input" ]; then
|
||||
f_dialog_msgbox "$msg_group_is_empty"
|
||||
f_show_msg "$msg_group_is_empty"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Check for invalid entry
|
||||
if ! echo "$_input" | grep -q "^[[:alpha:]]"; then
|
||||
f_dialog_msgbox "$msg_group_must_start_with_letter"
|
||||
f_show_msg "$msg_group_must_start_with_letter"
|
||||
continue
|
||||
fi
|
||||
|
||||
@ -231,7 +231,7 @@ f_dialog_input_group_password()
|
||||
|
||||
# Check for password mismatch
|
||||
if [ "$_password1" != "$_password2" ]; then
|
||||
f_dialog_msgbox "$msg_group_passwords_do_not_match"
|
||||
f_show_msg "$msg_group_passwords_do_not_match"
|
||||
continue
|
||||
fi
|
||||
|
||||
|
@ -242,13 +242,13 @@ f_dialog_input_name()
|
||||
|
||||
# Check for NULL entry
|
||||
if [ ! "$_input" ]; then
|
||||
f_dialog_msgbox "$msg_login_is_empty"
|
||||
f_show_msg "$msg_login_is_empty"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Check for invalid entry
|
||||
if ! echo "$_input" | grep -q "^[[:alpha:]]"; then
|
||||
f_dialog_msgbox "$msg_login_must_start_with_letter"
|
||||
f_show_msg "$msg_login_must_start_with_letter"
|
||||
continue
|
||||
fi
|
||||
|
||||
@ -328,7 +328,7 @@ f_dialog_input_password()
|
||||
|
||||
# Check for password mismatch
|
||||
if [ "$_password1" != "$_password2" ]; then
|
||||
f_dialog_msgbox "$msg_passwords_do_not_match"
|
||||
f_show_msg "$msg_passwords_do_not_match"
|
||||
continue
|
||||
fi
|
||||
|
||||
@ -584,7 +584,7 @@ f_dialog_input_expire_password()
|
||||
|
||||
# Taint-check the user's input
|
||||
if ! f_isinteger "$ret_days"; then
|
||||
f_dialog_msgbox "$msg_invalid_number_of_days"
|
||||
f_show_msg "$msg_invalid_number_of_days"
|
||||
continue
|
||||
fi
|
||||
|
||||
@ -610,8 +610,7 @@ f_dialog_input_expire_password()
|
||||
|
||||
# Taint-check the user's input
|
||||
if ! f_isinteger "${_input:-0}"; then
|
||||
f_dialog_msgbox \
|
||||
"$msg_invalid_number_of_seconds"
|
||||
f_show_msg "$msg_invalid_number_of_seconds"
|
||||
continue
|
||||
fi
|
||||
|
||||
@ -769,7 +768,7 @@ f_dialog_input_expire_account()
|
||||
|
||||
# Taint-check the user's input
|
||||
if ! f_isinteger "$ret_days"; then
|
||||
f_dialog_msgbox "$msg_invalid_number_of_days"
|
||||
f_show_msg "$msg_invalid_number_of_days"
|
||||
continue
|
||||
fi
|
||||
|
||||
@ -795,8 +794,7 @@ f_dialog_input_expire_account()
|
||||
|
||||
# Taint-check the user's input
|
||||
if ! f_isinteger "${_input:-0}"; then
|
||||
f_dialog_msgbox \
|
||||
"$msg_invalid_number_of_seconds"
|
||||
f_show_msg "$msg_invalid_number_of_seconds"
|
||||
continue
|
||||
fi
|
||||
|
||||
|
@ -84,7 +84,7 @@ save_changes()
|
||||
f_dialog_msgbox "$msg_error $err\n"
|
||||
return $retval
|
||||
fi
|
||||
f_dialog_msgbox "$msg_login_deleted"
|
||||
f_show_msg "$msg_login_deleted"
|
||||
|
||||
if [ "$pw_group_delete" = "$msg_yes" ] &&
|
||||
f_quietly pw groupshow -g "$pw_gid"
|
||||
@ -122,7 +122,7 @@ save_changes()
|
||||
f_dialog_msgbox "$msg_error $err\n"
|
||||
return $retval
|
||||
fi
|
||||
f_dialog_msgbox "$msg_login_added"
|
||||
f_show_msg "$msg_login_added"
|
||||
|
||||
if [ "$pw_home_create" = "$msg_yes" ]; then
|
||||
err=$( mkdir -p "$pw_home_dir" 2>&1 )
|
||||
@ -168,7 +168,7 @@ save_changes()
|
||||
f_dialog_msgbox "$msg_error $err\n"
|
||||
return $retval
|
||||
fi
|
||||
f_dialog_msgbox "$msg_login_updated"
|
||||
f_show_msg "$msg_login_updated"
|
||||
|
||||
if [ "$pw_home_create" = "$msg_yes" ]; then
|
||||
err=$( mkdir -p "$pw_home_dir" )
|
||||
|
Loading…
x
Reference in New Issue
Block a user