diff options
Diffstat (limited to 'usr.sbin/bsdconfig/share/media')
-rw-r--r-- | usr.sbin/bsdconfig/share/media/any.subr | 6 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/media/cdrom.subr | 22 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/media/common.subr | 52 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/media/directory.subr | 21 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/media/dos.subr | 22 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/media/floppy.subr | 36 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/media/ftp.subr | 30 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/media/http.subr | 33 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/media/httpproxy.subr | 35 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/media/network.subr | 10 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/media/nfs.subr | 22 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/media/options.subr | 6 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/media/tcpip.subr | 30 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/media/ufs.subr | 20 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/media/usb.subr | 24 |
15 files changed, 223 insertions, 146 deletions
diff --git a/usr.sbin/bsdconfig/share/media/any.subr b/usr.sbin/bsdconfig/share/media/any.subr index 047bf15..3675713 100644 --- a/usr.sbin/bsdconfig/share/media/any.subr +++ b/usr.sbin/bsdconfig/share/media/any.subr @@ -1,7 +1,7 @@ if [ ! "$_MEDIA_ANY_SUBR" ]; then _MEDIA_ANY_SUBR=1 # # Copyright (c) 2012-2013 Devin Teske -# All Rights Reserved. +# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -13,11 +13,11 @@ if [ ! "$_MEDIA_ANY_SUBR" ]; then _MEDIA_ANY_SUBR=1 # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY diff --git a/usr.sbin/bsdconfig/share/media/cdrom.subr b/usr.sbin/bsdconfig/share/media/cdrom.subr index 4350367..cd68029 100644 --- a/usr.sbin/bsdconfig/share/media/cdrom.subr +++ b/usr.sbin/bsdconfig/share/media/cdrom.subr @@ -1,7 +1,7 @@ if [ ! "$_MEDIA_CDROM_SUBR" ]; then _MEDIA_CDROM_SUBR=1 # # Copyright (c) 2012-2013 Devin Teske -# All Rights Reserved. +# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -13,11 +13,11 @@ if [ ! "$_MEDIA_CDROM_SUBR" ]; then _MEDIA_CDROM_SUBR=1 # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY @@ -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" @@ -144,19 +144,21 @@ f_media_init_cdrom() return $SUCCESS } -# f_media_get_cdrom $device $file [$probe_only] +# f_media_get_cdrom $device $file [$probe_type] # # Returns data from $file on a mounted CDROM device. Similar to cat(1). If -# $probe_only is present and non-NULL, returns success if $file exists. +# $probe_type is present and non-NULL, returns success if $file exists. If +# $probe_type is equal to $PROBE_SIZE, prints the size of $file in bytes to +# standard-out. # f_media_get_cdrom() { - local dev="$1" file="$2" probe_only="$3" + local dev="$1" file="$2" probe_type="$3" - f_dprintf "f_media_get_cdrom: dev=[%s] file=[%s] probe_only=%s" \ - "$dev" "$file" "$probe_only" + f_dprintf "f_media_get_cdrom: dev=[%s] file=[%s] probe_type=%s" \ + "$dev" "$file" "$probe_type" - f_media_generic_get "$MOUNTPOINT" "$file" "$probe_only" + f_media_generic_get "$MOUNTPOINT" "$file" "$probe_type" } # f_media_shutdown_cdrom $device diff --git a/usr.sbin/bsdconfig/share/media/common.subr b/usr.sbin/bsdconfig/share/media/common.subr index 4550d70..495aca7 100644 --- a/usr.sbin/bsdconfig/share/media/common.subr +++ b/usr.sbin/bsdconfig/share/media/common.subr @@ -1,7 +1,7 @@ if [ ! "$_MEDIA_COMMON_SUBR" ]; then _MEDIA_COMMON_SUBR=1 # # Copyright (c) 2012-2013 Devin Teske -# All Rights Reserved. +# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -13,11 +13,11 @@ if [ ! "$_MEDIA_COMMON_SUBR" ]; then _MEDIA_COMMON_SUBR=1 # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY @@ -42,6 +42,13 @@ f_include $BSDCFG_SHARE/struct.subr # MOUNTPOINT=/dist +# +# Media probe values to use for `f_media_get_TYPE media $file $PROBE' or +# `f_device_get media $file $PROBE' (where $PROBE is one of the below values). +# +PROBE_EXIST=1 +PROBE_SIZE=2 + ############################################################ FUNCTIONS # f_media_open @@ -83,18 +90,20 @@ f_media_verify() f_struct device_media || f_media_get_type } -# f_media_generic_get $base $file [$probe_only] +# f_media_generic_get $base $file [$probe_type] # # A generic open which follows a well-known "path" of places to look. If -# $probe_only is present and non-NULL, returns success if $file exists. +# $probe_type is present and non-NULL, returns success if $file exists. If +# $probe_type is equal to $PROBE_SIZE, prints the size of $file in bytes to +# standard-out. # f_media_generic_get() { - local base="$1" file="$2" probe_only="$3" + local base="$1" file="$2" probe_type="$3" local fname=f_media_generic_get - f_dprintf "%s: base=[%s] files=[%s] probe_only=%s" \ - $fname "$base" "$file" "$probe_only" + f_dprintf "%s: base=[%s] files=[%s] probe_type=%s" \ + $fname "$base" "$file" "$probe_type" local rel path f_getvar $VAR_RELNAME rel @@ -106,7 +115,17 @@ f_media_generic_get() ; do if [ -f "$path" -a -r "$path" ]; then f_dprintf "%s: file exists path=[%s]" $fname "$path" - [ "$probe_only" ] && return $SUCCESS + if [ "$probe_type" = "$PROBE_SIZE" ]; then + local size + if ! size=$( stat -f %z "$path" 2>&1 ); then + f_dprintf "stat: %s" "$size" + echo "-1" + else + f_isinteger "$size" || size=-1 + echo $size + fi + fi + [ "$probe_type" ] && return $SUCCESS cat "$path" return fi @@ -115,8 +134,19 @@ f_media_generic_get() path="$base/releases/$rel/$file" # Final path to try if [ -f "$path" -a -r "$path" ]; then f_dprintf "%s: file exists path=[%s]" $fname "$path" - [ "$probe_only" ] && return $SUCCESS - elif [ "$probe_only" ]; then + if [ "$probe_type" = "$PROBE_SIZE" ]; then + local size + if ! size=$( stat -f %z "$path" 2>&1 ); then + f_dprintf "stat: %s" "$size" + echo "-1" + else + f_isinteger "$size" || size=-1 + echo $size + fi + fi + [ "$probe_type" ] && return $SUCCESS + elif [ "$probe_type" ]; then + [ "$probe_type" = "$PROBE_SIZE" ] && echo "-1" return $FAILURE fi cat "$base/releases/$rel/$file" # Final path to try diff --git a/usr.sbin/bsdconfig/share/media/directory.subr b/usr.sbin/bsdconfig/share/media/directory.subr index 82c1b8c..3f46293 100644 --- a/usr.sbin/bsdconfig/share/media/directory.subr +++ b/usr.sbin/bsdconfig/share/media/directory.subr @@ -1,7 +1,7 @@ if [ ! "$_MEDIA_DIRECTORY_SUBR" ]; then _MEDIA_DIRECTORY_SUBR=1 # # Copyright (c) 2012-2013 Devin Teske -# All Rights Reserved. +# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -13,11 +13,11 @@ if [ ! "$_MEDIA_DIRECTORY_SUBR" ]; then _MEDIA_DIRECTORY_SUBR=1 # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY @@ -115,21 +115,22 @@ f_media_init_directory() return $SUCCESS } -# f_media_get_directory $device $file [$probe_only] +# f_media_get_directory $device $file [$probe_type] # # Returns data from $file in the existing/current filesystem. Similar to -# cat(1). If $probe_only is present and non-NULL, returns success if $file -# exists. +# cat(1). If $probe_type is present and non-NULL, returns success if $file +# exists. If $probe_type is equal to $PROBE_SIZE, prints the size of $file in +# bytes to standard-out. # f_media_get_directory() { - local dev="$1" file="$2" probe_only="$3" path + local dev="$1" file="$2" probe_type="$3" path - f_dprintf "f_media_get_directory: dev=[%s] file=[%s] probe_only=%s" \ - "$dev" "$file" "$probe_only" + f_dprintf "f_media_get_directory: dev=[%s] file=[%s] probe_type=%s" \ + "$dev" "$file" "$probe_type" device_$dev get private path - f_media_generic_get "$path" "$file" "$probe_only" + f_media_generic_get "$path" "$file" "$probe_type" } # f_media_shutdown_directory $device diff --git a/usr.sbin/bsdconfig/share/media/dos.subr b/usr.sbin/bsdconfig/share/media/dos.subr index 9320c2c..440c5c9 100644 --- a/usr.sbin/bsdconfig/share/media/dos.subr +++ b/usr.sbin/bsdconfig/share/media/dos.subr @@ -1,7 +1,7 @@ if [ ! "$_MEDIA_DOS_SUBR" ]; then _MEDIA_DOS_SUBR=1 # # Copyright (c) 2012-2013 Devin Teske -# All Rights Reserved. +# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -13,11 +13,11 @@ if [ ! "$_MEDIA_DOS_SUBR" ]; then _MEDIA_DOS_SUBR=1 # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY @@ -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" @@ -122,19 +122,21 @@ f_media_init_dos() return $SUCCESS } -# f_media_get_dos $device $file [$probe_only] +# f_media_get_dos $device $file [$probe_type] # # Returns data from $file on a mounted DOS partition device. Similar to cat(1). -# If $probe_only is present and non-NULL, returns success if $file exists. +# If $probe_type is present and non-NULL, returns success if $file exists. If +# $probe_type is equal to $PROBE_SIZE, prints the size of $file in bytes to +# standard-out. # f_media_get_dos() { - local dev="$1" file="$2" probe_only="$3" + local dev="$1" file="$2" probe_type="$3" - f_dprintf "f_media_get_dos: dev=[%s] file=[%s] probe_only=%s" \ - "$dev" "$file" "$probe_only" + f_dprintf "f_media_get_dos: dev=[%s] file=[%s] probe_type=%s" \ + "$dev" "$file" "$probe_type" - f_media_generic_get "$MOUNTPOINT" "$file" "$probe_only" + f_media_generic_get "$MOUNTPOINT" "$file" "$probe_type" } # f_media_shutdown_dos $device diff --git a/usr.sbin/bsdconfig/share/media/floppy.subr b/usr.sbin/bsdconfig/share/media/floppy.subr index beb574e..eb6bc5e 100644 --- a/usr.sbin/bsdconfig/share/media/floppy.subr +++ b/usr.sbin/bsdconfig/share/media/floppy.subr @@ -1,7 +1,7 @@ if [ ! "$_MEDIA_FLOPPY_SUBR" ]; then _MEDIA_FLOPPY_SUBR=1 # # Copyright (c) 2012-2013 Devin Teske -# All Rights Reserved. +# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -13,11 +13,11 @@ if [ ! "$_MEDIA_FLOPPY_SUBR" ]; then _MEDIA_FLOPPY_SUBR=1 # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY @@ -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" @@ -144,17 +144,19 @@ f_media_init_floppy() return $SUCCESS } -# f_media_get_floppy $device $file [$probe_only] +# f_media_get_floppy $device $file [$probe_type] # # Returns data from $file on a mounted Floppy disk device. Similar to cat(1). -# If $probe_only is present and non-null, limits retries to zero. +# If $probe_type is present and non-NULL, limits retries to zero and returns +# success if $file exists. If $probe_type is equal to $PROBE_SIZE, prints the +# size of $file in bytes to standard-out. # f_media_get_floppy() { - local dev="$1" file="$2" probe_only="$3" + local dev="$1" file="$2" probe_type="$3" - f_dprintf "f_media_get_floppy: dev=[%s] file=[%s] probe_only=%s" \ - "$dev" "$file" "$probe_only" + f_dprintf "f_media_get_floppy: dev=[%s] file=[%s] probe_type=%s" \ + "$dev" "$file" "$probe_type" # # floppies don't use f_media_generic_get() because it's too expensive @@ -166,11 +168,13 @@ f_media_get_floppy() local fp="${mp:=$MOUNTPOINT}/$file" if ! [ -f "$fp" -a -r "$fp" ]; then local nretries=4 - [ "$probe_only" ] && return $FAILURE + [ "$probe_type" = "$PROBE_SIZE" ] && echo "-1" + [ "$probe_type" ] && return $FAILURE while ! [ -f "$fp" -a -r "$fp" ]; do if [ $nretries -eq 0 ]; then f_show_msg "$msg_failed_to_get_floppy_file" \ "$fp" + [ "$probe_type" = "$PROBE_SIZE" ] && echo "-1" return $FAILURE fi FLOPPY_DISTWANTED="$fp" @@ -178,9 +182,17 @@ f_media_get_floppy() f_media_init_floppy "$dev" || return $FAILURE nretries=$(( $nretries - 1 )) done - elif [ "$probe_only" ]; then - return $SUCCESS fi + # + # If we reach here, $file exists + # + if [ "$probe_type" = "$PROBE_SIZE" ]; then + local size + size=$( stat -f %z "$fp" 2>&1 ) || f_dprintf "stat: %s" "$size" + f_isinteger "$size" || size=-1 + echo "$size" + fi + [ "$probe_type" ] && return $SUCCESS cat "$fp" } diff --git a/usr.sbin/bsdconfig/share/media/ftp.subr b/usr.sbin/bsdconfig/share/media/ftp.subr index fb96b91..638584c 100644 --- a/usr.sbin/bsdconfig/share/media/ftp.subr +++ b/usr.sbin/bsdconfig/share/media/ftp.subr @@ -1,7 +1,7 @@ if [ ! "$_MEDIA_FTP_SUBR" ]; then _MEDIA_FTP_SUBR=1 # # Copyright (c) 2012-2013 Devin Teske -# All Rights Reserved. +# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -13,11 +13,11 @@ if [ ! "$_MEDIA_FTP_SUBR" ]; then _MEDIA_FTP_SUBR=1 # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY @@ -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 @@ -788,12 +787,13 @@ f_media_init_ftp() return $FAILURE } -# f_media_get_ftp $device $file [$probe_only] +# f_media_get_ftp $device $file [$probe_type] # # Returns data from $file on an FTP server using ftp(1). Please note that # $device is unused but must be present (even if null). Information is instead -# gathered from the environment. If $probe_only is present and non-NULL, -# returns success if $file exists. +# gathered from the environment. If $probe_type is present and non-NULL, +# returns success if $file exists. If $probe_type is equal to $PROBE_SIZE, +# prints the size of $file in bytes to standard-out. # # Variables from variable.subr used to configure the connection are as follows # (all of which are configured by f_media_set_ftp above): @@ -827,10 +827,10 @@ f_media_init_ftp() # f_media_get_ftp() { - local dev="$1" file="$2" probe_only="$3" hosts= + local dev="$1" file="$2" probe_type="$3" hosts= - f_dprintf "f_media_get_ftp: dev=[%s] file=[%s] probe_only=%s" \ - "$dev" "$file" "$probe_only" + f_dprintf "f_media_get_ftp: dev=[%s] file=[%s] probe_type=%s" \ + "$dev" "$file" "$probe_type" local ftp_host ftp_port f_getvar $VAR_FTP_HOST ftp_host @@ -900,14 +900,16 @@ f_media_get_ftp() f_dprintf "sending ftp request for: %s" "ftp://$host$port/$dir/$file" - if [ "$probe_only" ]; then - local url="ftp://$userpass$host$port/$dir/$file" + if [ "$probe_type" ]; then + local url="ftp://$userpass$host$port/$dir/$file" size [ "$use_anon" ] && url="ftp://$host$port/$dir/$file" if ! size=$( fetch -s "$url" 2>&1 ) || ! f_isinteger "$size" then f_dprintf "request failed! size response=[%s]" "$size" + [ "$probe_type" = "$PROBE_SIZE" ] && echo "-1" return $FAILURE fi + [ "$probe_type" = "$PROBE_SIZE" ] && echo "$size" return $SUCCESS fi diff --git a/usr.sbin/bsdconfig/share/media/http.subr b/usr.sbin/bsdconfig/share/media/http.subr index 7144128..1236c99 100644 --- a/usr.sbin/bsdconfig/share/media/http.subr +++ b/usr.sbin/bsdconfig/share/media/http.subr @@ -1,7 +1,7 @@ if [ ! "$_MEDIA_HTTP_SUBR" ]; then _MEDIA_HTTP_SUBR=1 # # Copyright (c) 2012-2013 Devin Teske -# All Rights Reserved. +# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -13,11 +13,11 @@ if [ ! "$_MEDIA_HTTP_SUBR" ]; then _MEDIA_HTTP_SUBR=1 # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY @@ -510,13 +510,15 @@ f_media_init_http() return $http_found } -# f_media_get_http $device $file [$probe_only] +# f_media_get_http $device $file [$probe_type] # # Returns data from $file on an HTTP server using nc(1). Please note that # $device is unused but must be present (even if null). Information is instead -# gathered from the environment. If $probe_only is both present and non-NULL, +# gathered from the environment. If $probe_type is both present and non-NULL, # this function exits after receiving the HTTP header response from the server # (if the HTTP response code is 200, success is returned; otherwise failure). +# If $probe_type is equal to $PROBE_SIZE, prints the content-length in bytes +# from the response (or -1 if not found) to standard-out. # # The variables used to configure the connection are as follows (all of which # are configured by f_media_set_http above): @@ -542,10 +544,10 @@ f_media_init_http() # f_media_get_http() { - local dev="$1" file="$2" probe_only="$3" hosts= + local dev="$1" file="$2" probe_type="$3" hosts= - f_dprintf "f_media_get_http: dev=[%s] file=[%s] probe_only=%s" \ - "$dev" "$file" "$probe_only" + f_dprintf "f_media_get_http: dev=[%s] file=[%s] probe_type=%s" \ + "$dev" "$file" "$probe_type" local http_host http_port f_getvar $VAR_HTTP_HOST http_host @@ -591,7 +593,7 @@ f_media_get_http() # this is extremely quick'n dirty # - rv=0 + rv=0 length=-1 while read LINE; do case "$LINE" in HTTP*) @@ -599,6 +601,12 @@ f_media_get_http() set -- $LINE; rv=$2 f_isinteger "$rv" || rv=0 ;; + "Content-Length: "*) + length="${LINE%
}" + length="${length#Content-Length: }" + f_dprintf "received content-length: %s" \ + "$length" + ;; *) [ "${LINE%
}" ] || break # End of headers esac @@ -610,14 +618,17 @@ f_media_get_http() [ $rv -ge 300 ] && exit 3 [ $rv -eq 200 ] || exit $FAILURE - if [ ! "$probe_only" ]; then + if [ ! "$probe_type" ]; then cat # output the rest ``as-is'' + elif [ "$probe_type" = "$PROBE_SIZE" ]; then + f_isinteger "$length" || length=-1 + echo "$length" fi exit 200 ) local retval=$? [ $retval -eq 200 ] && return $SUCCESS - [ "$probe_only" ] && return $FAILURE + [ "$probe_type" ] && return $FAILURE case "$retval" in 5) f_show_msg "$msg_server_error_when_requesting_url" "$url" ;; diff --git a/usr.sbin/bsdconfig/share/media/httpproxy.subr b/usr.sbin/bsdconfig/share/media/httpproxy.subr index 5a11323..66e5be4 100644 --- a/usr.sbin/bsdconfig/share/media/httpproxy.subr +++ b/usr.sbin/bsdconfig/share/media/httpproxy.subr @@ -1,7 +1,7 @@ if [ ! "$_MEDIA_HTTPPROXY_SUBR" ]; then _MEDIA_HTTPPROXY_SUBR=1 # # Copyright (c) 2012-2013 Devin Teske -# All Rights Reserved. +# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -13,11 +13,11 @@ if [ ! "$_MEDIA_HTTPPROXY_SUBR" ]; then _MEDIA_HTTPPROXY_SUBR=1 # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY @@ -329,14 +329,16 @@ f_media_init_http_proxy() return $http_found } -# f_media_get_http_proxy $device $file [$probe_only] +# f_media_get_http_proxy $device $file [$probe_type] # # Returns data from $file on an FTP server via HTTP proxy using nc(1). Please # note that $device is unused but must be present (even if null). Information -# is instead gathered from the environment. If $probe_only is both present and +# is instead gathered from the environment. If $probe_type is both present and # non-NULL, this function exits after receiving the HTTP header response from # the proxy server (if the HTTP response code is 200, success is returned; -# otherwise failure). +# otherwise failure). If $probe_type is equal to $PROBE_SIZE, prints the +# content-length in bytes from the response (or -1 if not found) to standard- +# out. # # The variables used to configure the connection are as follows (all of which # are configured by f_media_set_http_proxy above): @@ -358,10 +360,10 @@ f_media_init_http_proxy() # f_media_get_http_proxy() { - local dev="$1" file="$2" probe_only="$3" hosts= + local dev="$1" file="$2" probe_type="$3" hosts= - f_dprintf "f_media_get_http_proxy: dev=[%s] file=[%s] probe_only=%s" \ - "$dev" "$file" "$probe_only" + f_dprintf "f_media_get_http_proxy: dev=[%s] file=[%s] probe_type=%s" \ + "$dev" "$file" "$probe_type" local proxy_host proxy_port f_getvar $VAR_HTTP_PROXY_HOST proxy_host @@ -408,7 +410,7 @@ f_media_get_http_proxy() # this is extremely quick'n dirty # - rv=0 + rv=0 length=-1 while read LINE; do case "$LINE" in HTTP*) @@ -416,6 +418,12 @@ f_media_get_http_proxy() set -- $LINE; rv=$2 f_isinteger "$rv" || rv=0 ;; + "Content-Length: "*) + length="${LINE%
}" + length="${length#Content-Length: }" + f_dprintf "received content-length: %s" \ + "$length" + ;; *) [ "${LINE%
}" ] || break # End of headers esac @@ -427,14 +435,17 @@ f_media_get_http_proxy() [ $rv -ge 300 ] && exit 3 [ $rv -eq 200 ] || exit $FAILURE - if [ ! "$probe_only" ]; then + if [ ! "$probe_type" ]; then cat # output the rest ``as-is'' + elif [ "$probe_type" = "$PROBE_SIZE" ]; then + f_isinteger "$length" || length=-1 + echo "$length" fi exit 200 ) local retval=$? [ $retval -eq 200 ] && return $SUCCESS - [ "$probe_only" ] && return $FAILURE + [ "$probe_type" ] && return $FAILURE case "$retval" in 5) f_show_msg "$msg_server_error_when_requesting_url" "$url" ;; diff --git a/usr.sbin/bsdconfig/share/media/network.subr b/usr.sbin/bsdconfig/share/media/network.subr index d9fe8e6..6e17200 100644 --- a/usr.sbin/bsdconfig/share/media/network.subr +++ b/usr.sbin/bsdconfig/share/media/network.subr @@ -1,7 +1,7 @@ if [ ! "$_MEDIA_NETWORK_SUBR" ]; then _MEDIA_NETWORK_SUBR=1 # # Copyright (c) 2012-2013 Devin Teske -# All Rights Reserved. +# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -13,11 +13,11 @@ if [ ! "$_MEDIA_NETWORK_SUBR" ]; then _MEDIA_NETWORK_SUBR=1 # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY @@ -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 diff --git a/usr.sbin/bsdconfig/share/media/nfs.subr b/usr.sbin/bsdconfig/share/media/nfs.subr index 86bdde2..9ce0467 100644 --- a/usr.sbin/bsdconfig/share/media/nfs.subr +++ b/usr.sbin/bsdconfig/share/media/nfs.subr @@ -1,7 +1,7 @@ if [ ! "$_MEDIA_NFS_SUBR" ]; then _MEDIA_NFS_SUBR=1 # # Copyright (c) 2012-2013 Devin Teske -# All Rights Reserved. +# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -13,11 +13,11 @@ if [ ! "$_MEDIA_NFS_SUBR" ]; then _MEDIA_NFS_SUBR=1 # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY @@ -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 @@ -208,19 +208,21 @@ f_media_init_nfs() return $SUCCESS } -# f_media_get_nfs $device $file [$probe_only] +# f_media_get_nfs $device $file [$probe_type] # # Returns data from $file on a mounted NFS device. Similar to cat(1). If -# $probe_only is present and non-NULL, returns success if $file exists. +# $probe_type is present and non-NULL, returns success if $file exists. If +# $probe_type is equal to $PROBE_SIZE, prints the size of $file in bytes to +# standard-out. # f_media_get_nfs() { - local dev="$1" file="$2" probe_only="$3" + local dev="$1" file="$2" probe_type="$3" - f_dprintf "f_media_get_nfs: dev=[%s] file=[%s] probe_only=%s" \ - "$dev" "$file" "$probe_only" + f_dprintf "f_media_get_nfs: dev=[%s] file=[%s] probe_type=%s" \ + "$dev" "$file" "$probe_type" - f_media_generic_get "$MOUNTPOINT" "$file" "$probe_only" + f_media_generic_get "$MOUNTPOINT" "$file" "$probe_type" } # f_media_shutdown_nfs $device diff --git a/usr.sbin/bsdconfig/share/media/options.subr b/usr.sbin/bsdconfig/share/media/options.subr index 3ad3c07..3f71a96 100644 --- a/usr.sbin/bsdconfig/share/media/options.subr +++ b/usr.sbin/bsdconfig/share/media/options.subr @@ -1,7 +1,7 @@ if [ ! "$_MEDIA_OPTIONS_SUBR" ]; then _MEDIA_OPTIONS_SUBR=1 # # Copyright (c) 2012-2013 Devin Teske -# All Rights Reserved. +# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -13,11 +13,11 @@ if [ ! "$_MEDIA_OPTIONS_SUBR" ]; then _MEDIA_OPTIONS_SUBR=1 # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY diff --git a/usr.sbin/bsdconfig/share/media/tcpip.subr b/usr.sbin/bsdconfig/share/media/tcpip.subr index 0daada6..6b4791e 100644 --- a/usr.sbin/bsdconfig/share/media/tcpip.subr +++ b/usr.sbin/bsdconfig/share/media/tcpip.subr @@ -1,7 +1,7 @@ if [ ! "$_MEDIA_TCPIP_SUBR" ]; then _MEDIA_TCPIP_SUBR=1 # # Copyright (c) 2012-2013 Devin Teske -# All Rights Reserved. +# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -13,11 +13,11 @@ if [ ! "$_MEDIA_TCPIP_SUBR" ]; then _MEDIA_TCPIP_SUBR=1 # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY @@ -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 diff --git a/usr.sbin/bsdconfig/share/media/ufs.subr b/usr.sbin/bsdconfig/share/media/ufs.subr index 14e2081..cc63475 100644 --- a/usr.sbin/bsdconfig/share/media/ufs.subr +++ b/usr.sbin/bsdconfig/share/media/ufs.subr @@ -1,7 +1,7 @@ if [ ! "$_MEDIA_UFS_SUBR" ]; then _MEDIA_UFS_SUBR=1 # # Copyright (c) 2012-2013 Devin Teske -# All Rights Reserved. +# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -13,11 +13,11 @@ if [ ! "$_MEDIA_UFS_SUBR" ]; then _MEDIA_UFS_SUBR=1 # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY @@ -152,19 +152,21 @@ f_media_init_ufs() return $SUCCESS } -# f_media_get_ufs $device $file [$probe_only] +# f_media_get_ufs $device $file [$probe_type] # # Returns data from $file on a mounted UFS partition device. Similar to cat(1). -# If $probe_only is present and non-NULL, returns success if $file exists. +# If $probe_type is present and non-NULL, returns success if $file exists. If +# $probe_type is equal to $PROBE_SIZE, prints the size of $file in bytes to +# standard-out. # f_media_get_ufs() { - local dev="$1" file="$2" probe_only="$3" + local dev="$1" file="$2" probe_type="$3" - f_dprintf "f_media_get_ufs: dev=[%s] file=[%s] probe_only=%s" \ - "$dev" "$file" "$probe_only" + f_dprintf "f_media_get_ufs: dev=[%s] file=[%s] probe_type=%s" \ + "$dev" "$file" "$probe_type" - f_media_generic_get "$MOUNTPOINT" "$file" "$probe_only" + f_media_generic_get "$MOUNTPOINT" "$file" "$probe_type" } # f_media_shutdown_ufs $device diff --git a/usr.sbin/bsdconfig/share/media/usb.subr b/usr.sbin/bsdconfig/share/media/usb.subr index c2ece47..e345ae0 100644 --- a/usr.sbin/bsdconfig/share/media/usb.subr +++ b/usr.sbin/bsdconfig/share/media/usb.subr @@ -1,7 +1,7 @@ if [ ! "$_MEDIA_USB_SUBR" ]; then _MEDIA_USB_SUBR=1 # # Copyright (c) 2012-2013 Devin Teske -# All Rights Reserved. +# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -13,11 +13,11 @@ if [ ! "$_MEDIA_USB_SUBR" ]; then _MEDIA_USB_SUBR=1 # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY @@ -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" @@ -132,19 +132,21 @@ f_media_init_usb() return $FAILURE } -# f_media_get_usb $device $file [$probe_only] +# f_media_get_usb $device $file [$probe_type] # -# Returns data from $file on a mounted USB disk device. Similar to cat(1). -# If $probe_only is present and non-NULL, returns success if $file exists. +# Returns data from $file on a mounted USB disk device. Similar to cat(1). If +# $probe_type is present and non-NULL, returns success if $file exists. If +# $probe_type is equal to $PROBE_SIZE, prints the size of $file in bytes to +# standard-out. # f_media_get_usb() { - local dev="$1" file="$2" probe_only="$3" + local dev="$1" file="$2" probe_type="$3" - f_dprintf "f_media_get_usb: dev=[%s] file=[%s] probe_only=%s" \ - "$dev" "$file" "$probe_only" + f_dprintf "f_media_get_usb: dev=[%s] file=[%s] probe_type=%s" \ + "$dev" "$file" "$probe_type" - f_media_generic_get "$MOUNTPOINT" "$file" "$probe_only" + f_media_generic_get "$MOUNTPOINT" "$file" "$probe_type" } # f_media_shutdown_usb $device |