bsdconfig: drop support for floppies

Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D42083
This commit is contained in:
Baptiste Daroussin 2023-10-05 10:37:39 +02:00
parent e19b2ef976
commit 77e93191b9
10 changed files with 3 additions and 268 deletions

View file

@ -16,13 +16,6 @@ You can install from the following types of media:
get the distribution files from there.
Floppy Get distribution files from one or more DOS or UFS
formatted floppies. Such floppies are assumed to
contain the appropriate distribution pieces - see
ABOUT.TXT for more information about making floppy
distribution media.
FTP Get the distribution files from an anonymous ftp server
(you will be presented with a list). Please note that
you may invoke FTP in "Active"/"Passive" auto-mode, or

View file

@ -77,7 +77,6 @@ msg_checking_access_to="Checking access to\n %s"
msg_chinese_desc="Ported software for the Chinese market."
msg_choose_a_cd_dvd_type="Choose a CD/DVD type"
msg_choose_a_dos_partition="Choose a DOS partition"
msg_choose_a_floppy_drive="Choose a Floppy drive"
msg_choose_a_ufs_partition="Choose a UFS partition"
msg_choose_a_usb_drive="Choose a USB drive"
msg_choose_installation_media="Choose Installation Media"
@ -129,7 +128,6 @@ msg_enter_a_fully_qualified_pathname_for_the_directory="Enter a fully qualified
msg_enter_the_device_name_of_a_ufs_formatted_partition="Enter the device-name of a UFS formatted partition"
msg_error="Error"
msg_error_mounting_device="Error mounting %s on %s: %s"
msg_error_mounting_floppy_device="Error mounting floppy %s (%s) on %s: %s"
msg_error_mounting_usb_drive="Error mounting USB drive %s on %s: %s"
msg_error_when_requesting_url="Error when requesting %s, you could try an other server"
msg_estonia="Estonia"
@ -141,7 +139,6 @@ msg_failed_to_reach_wpa_supplicant="Failed to reach wpa_supplicant: %s"
msg_file_system="File System"
msg_finance_desc="Monetary, financial and related applications."
msg_finland="Finland"
msg_floppy="Floppy"
msg_forget_all="Forget All"
msg_forget_all_confirm="WARNING! Are you really sure you want to forget all known networks\nby re-initializing wpa_supplicant.conf(5)? This cannot be undone."
msg_forget_all_help="Reset wpa_supplicant(8) configuration, forgetting all known networks"
@ -171,7 +168,6 @@ msg_http_proxy="HTTP Proxy"
msg_hungarian_desc="Ported software for the Hungarian market."
msg_iceland="Iceland"
msg_install_from_a_dos_partition="Install from a DOS partition"
msg_install_from_a_floppy_disk_set="Install from a floppy disk set"
msg_install_from_a_freebsd_cd_dvd="Install from a FreeBSD CD/DVD"
msg_install_from_a_ufs_partition="Install from a UFS partition"
msg_install_from_a_usb_drive="Install from a USB drive"
@ -257,7 +253,6 @@ msg_no="No"
msg_no_cd_dvd_devices_found="No CD/DVD devices found! Please check that your system's\nconfiguration is correct and that the CD/DVD drive is of a\nsupported type. For more information, consult the hardware\nguide in the Doc menu."
msg_no_description_provided="No description provided"
msg_no_dos_primary_partitions_found="No DOS primary partitions found! This installation method is unavailable"
msg_no_floppy_devices_found="No floppy devices found! Please check that your system's configuration\nis correct. For more information, consult the hardware guide in the Doc\nmenu."
msg_no_gateway_has_been_set="No gateway has been set. You will be unable to access hosts\nnot on your local network"
msg_no_network_devices="No network devices available!"
msg_no_package_name_passed_in_package_variable="No package name passed in package variable"
@ -297,11 +292,8 @@ msg_please_enter_the_full_nfs_file_specification="Please enter the full NFS file
msg_please_enter_the_password_for_this_user="Please enter the password for this user:"
msg_please_enter_the_username_you_wish_to_login_as="Please enter the username you wish to login as:"
msg_please_enter_username_password="Please enter a username and password for sudo(8):"
msg_please_insert_floppy_containing="Please insert floppy containing %s in %s"
msg_please_insert_floppy_in_drive="Please insert floppy in %s"
msg_please_select_a_category_to_display="Please select a category to display."
msg_please_select_a_cd_dvd_drive="FreeBSD can be installed directly from a CD/DVD containing a valid\nFreeBSD distribution. If you are seeing this menu it is because\nmore than one CD/DVD drive was found on your system. Please select\none of the following CD/DVD drives as your installation drive."
msg_please_select_a_floppy_drive="You have more than one floppy drive. Please choose which drive\nyou would like to use."
msg_please_select_a_freebsd_ftp_distribution_site="Please select a FreeBSD FTP distribution site"
msg_please_select_a_freebsd_http_distribution_site="Please select a FreeBSD HTTP distribution site"
msg_please_select_a_usb_drive="You have more than one USB drive. Please choose which drive\nyou would like to use."
@ -447,7 +439,6 @@ msg_xfce_desc="Software related to the Xfce Desktop Environment."
msg_yes="Yes"
msg_yes_to_all="Yes to All"
msg_you_are_not_root_but="You are not root but %s can use sudo(8).\nWhat would you like to do?"
msg_you_may_remove_the_floppy="You may remove the floppy from %s"
msg_youve_already_done_the_network_configuration="You've already done the network configuration once,\nwould you like to skip over it now?"
msg_zope_desc="Software related to the Zope platform."
tcplayout_extras_help="Any interface-specific options to ifconfig you would like to add"

View file

@ -85,9 +85,7 @@ Release Name: Which release to attempt to load from installation media.
You should only change this option if you're really sure you know
what you are doing! This will change the release name used by
bsdconfig when fetching components of any distributions, and
is a useful way of using a more recent installation boot floppy
with an older release (say, on CDROM).
bsdconfig when fetching components of any distributions.
Media Type: Which media type is being used.

View file

@ -77,7 +77,6 @@ f_struct_define DEVICE_INFO \
setvar DEVICE_TYPE_ANY "any" # Any
setvar DEVICE_TYPE_NONE "NONE" # Unknown
setvar DEVICE_TYPE_DISK "DISK" # GEOM `DISK'
setvar DEVICE_TYPE_FLOPPY "FD" # GEOM `FD'
setvar DEVICE_TYPE_FTP "FTP" # Dynamic network device
setvar DEVICE_TYPE_NETWORK "NETWORK" # See f_device_get_all_network
setvar DEVICE_TYPE_CDROM "CDROM" # GEOM `DISK'
@ -440,14 +439,6 @@ f_device_probe_geom()
return $retval
;;
$GEOM_CLASS_FD)
f_dprintf "Found floppy device named %s" "$devname"
debug= f_device_register device "$devname" "$desc" \
"/dev/$devname" $DEVICE_TYPE_FLOPPY 1 \
f_media_init_floppy f_media_get_floppy \
f_media_shutdown_floppy "" "$capacity"
return $?
;;
$GEOM_CLASS_LABEL)
: fall through to below section # reduces indentation level
;;
@ -936,7 +927,6 @@ f_device_desc()
case "$__type" in
$DEVICE_TYPE_CDROM) __cp="<unknown cdrom device type>" ;;
$DEVICE_TYPE_DISK) __cp="<unknown disk device type>" ;;
$DEVICE_TYPE_FLOPPY) __cp="<unknown floppy device type>" ;;
$DEVICE_TYPE_USB) __cp="<unknown USB storage device type>" ;;
$DEVICE_TYPE_NETWORK) __cp="<unknown network interface type>" ;;
*)
@ -1247,7 +1237,6 @@ f_device_menu()
#
f_cdrom() { f_device_catalog_set $DEVICE_TYPE_CDROM "$1" "$2"; }
f_disk() { f_device_catalog_set $DEVICE_TYPE_DISK "$1" "$2"; }
f_floppy() { f_device_catalog_set $DEVICE_TYPE_FLOPPY "$1" "$2"; }
f_usb() { f_device_catalog_set $DEVICE_TYPE_USB "$1" "$2"; }
f_network() { f_device_catalog_set $DEVICE_TYPE_NETWORK "$1" "$2"; }
@ -1262,7 +1251,7 @@ f_network() { f_device_catalog_set $DEVICE_TYPE_NETWORK "$1" "$2"; }
DEVICE_CATALOG_APPEND_ONLY=1 # Make initial loading faster
# CDROM, Disk, Floppy, and USB devices/names
# CDROM, Disk, and USB devices/names
f_cdrom "cd%d" "SCSI CDROM drive"
f_cdrom "mcd%d" "Mitsumi (old model) CDROM drive"
f_cdrom "scd%d" "Sony CDROM drive - CDU31/33A type"
@ -1277,7 +1266,6 @@ f_disk "mfid%d" "LSI MegaRAID SAS array"
f_disk "mlxd%d" "Mylex RAID disk"
f_disk "twed%d" "3ware ATA RAID array"
f_disk "vtbd%d" "VirtIO Block Device"
f_floppy "fd%d" "Floppy Drive unit A"
f_usb "da%da" "USB Mass Storage Device"
# Network interfaces/names

View file

@ -1,7 +1,7 @@
FILESDIR= ${SHAREDIR}/bsdconfig/media
FILES= any.subr cdrom.subr common.subr directory.subr dos.subr \
floppy.subr ftp.subr http.subr httpproxy.subr network.subr \
ftp.subr http.subr httpproxy.subr network.subr \
nfs.subr options.subr tcpip.subr ufs.subr usb.subr wlan.subr
.include <bsd.prog.mk>

View file

@ -34,7 +34,6 @@ f_include $BSDCFG_SHARE/dialog.subr
f_include $BSDCFG_SHARE/media/cdrom.subr
f_include $BSDCFG_SHARE/media/directory.subr
f_include $BSDCFG_SHARE/media/dos.subr
f_include $BSDCFG_SHARE/media/floppy.subr
f_include $BSDCFG_SHARE/media/ftp.subr
f_include $BSDCFG_SHARE/media/http.subr
f_include $BSDCFG_SHARE/media/httpproxy.subr
@ -78,7 +77,6 @@ f_media_get_type()
'6 $msg_nfs' '$msg_install_over_nfs'
'7 $msg_dos' '$msg_install_from_a_dos_partition'
'8 $msg_ufs' '$msg_install_from_a_ufs_partition'
'9 $msg_floppy' '$msg_install_from_a_floppy_disk_set'
'A $msg_usb' '$msg_install_from_a_usb_drive'
'X $msg_options' '$msg_view_set_various_media_options'
" # END-QUOTE
@ -128,7 +126,6 @@ f_media_get_type()
?" $msg_dos") f_media_set_dos ;;
?" $msg_nfs") f_media_set_nfs ;;
?" $msg_ufs") f_media_set_ufs ;;
?" $msg_floppy") f_media_set_floppy ;;
?" $msg_usb") f_media_set_usb ;;
?" $msg_options")
f_media_options_menu

View file

@ -1,228 +0,0 @@
if [ ! "$_MEDIA_FLOPPY_SUBR" ]; then _MEDIA_FLOPPY_SUBR=1
#
# Copyright (c) 2012-2013 Devin Teske
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# 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
# 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 (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
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
############################################################ INCLUDES
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." media/floppy.subr
f_include $BSDCFG_SHARE/device.subr
f_include $BSDCFG_SHARE/dialog.subr
f_include $BSDCFG_SHARE/media/common.subr
f_include $BSDCFG_SHARE/struct.subr
f_include $BSDCFG_SHARE/variable.subr
BSDCFG_LIBE="/usr/libexec/bsdconfig"
f_include_lang $BSDCFG_LIBE/include/messages.subr
############################################################ GLOBALS
FLOPPY_MOUNTED=
FLOPPY_DISTWANTED=
############################################################ FUNCTIONS
# f_media_set_floppy
#
# Return success if we both found and set the media type to be a floppy.
#
f_media_set_floppy()
{
f_media_close
local devs ndevs
f_device_find "" $DEVICE_TYPE_FLOPPY devs
f_count ndevs $devs
if [ ${ndevs:=0} -eq 0 ]; then
f_interactive && f_show_msg "$msg_no_floppy_devices_found"
return $FAILURE
elif [ $ndevs -eq 1 ]; then
f_struct_copy $devs device_media
else
local dev
local title="$msg_choose_a_floppy_drive"
local prompt="$msg_please_select_a_floppy_drive"
local hline=
dev=$( f_device_menu \
"$title" "$prompt" "$hline" $DEVICE_TYPE_FLOPPY \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) ||
return $FAILURE
f_struct_copy "$dev" device_media
fi
f_struct device_media &&
device_media unset private
f_struct device_media || return $FAILURE
}
# f_media_init_floppy $device
#
# Initializes the Floppy media device. Returns success if able to mount the
# Floppy disk device using either mount_msdosfs(8) or mount(8) (tried in that
# order).
#
f_media_init_floppy()
{
local funcname=f_media_init_floppy
local dev="$1" devname err
$dev get devname devname || return $FAILURE
f_dprintf "Init floppy called for %s distribution. devname=[%s]" \
"${FLOPPY_DISTWANTED:-some}" "$devname"
if [ "$FLOPPY_MOUNTED" ]; then
f_dprintf "Floppy device already mounted."
return $SUCCESS
fi
local mp
$dev get private mp
if [ ! -e "${mp:=$MOUNTPOINT}" ] && ! f_quietly mkdir -p "$mp"; then
f_show_msg "$msg_unable_to_make_directory_mountpoint" \
"$mp" "$devname"
return $FAILURE
fi
if f_interactive; then
local desc
$dev get desc desc
if [ "$FLOPPY_DISTWANTED" ]; then
f_show_msg "$msg_please_insert_floppy_in_drive" "$desc"
else
f_show_msg "$msg_please_insert_floppy_containing" \
"$FLOPPY_DISTWANTED" "$desc"
fi
fi
if ! {
f_eval_catch -dk err $funcname mount_msdosfs \
'mount_msdosfs -o ro -m 0777 -u 0 -g 0 "%s" "%s"' \
"$devname" "$mp" ||
f_eval_catch -dk err $funcname mount \
'mount -o ro "%s" "%s"' "$devname" "$mp"
}; then
err="${err#mount: }"; err="${err#*: }"
local name
$dev get name name
f_show_msg "$msg_error_mounting_floppy_device" \
"$name" "$devname" "$mp" "$err"
return $FAILURE
fi
FLOPPY_MOUNTED=1
FLOPPY_DISTWANTED=
return $SUCCESS
}
# f_media_get_floppy $device $file [$probe_type]
#
# Returns data from $file on a mounted Floppy disk device. Similar to cat(1).
# 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 funcname=f_media_get_floppy
local dev="$1" file="$2" probe_type="$3"
local name
$dev get name name
f_dprintf "f_media_get_floppy: dev=[%s] file=[%s] probe_type=%s" \
"$name" "$file" "$probe_type"
#
# floppies don't use f_media_generic_get() because it's too expensive
# to speculatively open files on a floppy disk. Make user get it
# right or give up with floppies.
#
local mp
$dev get private mp
local fp="${mp:=$MOUNTPOINT}/$file"
if ! [ -f "$fp" -a -r "$fp" ]; then
local nretries=4
[ "$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"
f_media_shutdown_floppy "$dev"
f_media_init_floppy "$dev" || return $FAILURE
nretries=$(( $nretries - 1 ))
done
fi
#
# If we reach here, $file exists
#
if [ "$probe_type" = "$PROBE_SIZE" ]; then
local size
f_eval_catch -dk size $funcname stat 'stat -f %%z "%s"' "$fp"
f_isinteger "$size" || size=-1
echo "$size"
fi
[ "$probe_type" ] && return $SUCCESS
cat "$fp"
}
# f_media_shutdown_floppy $device
#
# Shuts down the Floppy disk device using umount(8). Return status should be
# ignored.
#
f_media_shutdown_floppy()
{
local funcname=f_media_shutdown_floppy
local dev="$1" err mp
[ "$FLOPPY_MOUNTED" ] || return $FAILURE
$dev get private mp
if f_eval_catch -d $funcname umount \
'umount -f "%s"' "${mp:=$MOUNTPOINT}"
then
FLOPPY_MOUNTED=
if f_interactive && [ "$_systemState" != "fixit" ]; then
local desc
$dev get desc desc
f_show_msg "$msg_you_may_remove_the_floppy" "$desc"
fi
fi
}
############################################################ MAIN
f_dprintf "%s: Successfully loaded." media/floppy.subr
fi # ! $_MEDIA_FLOPPY_SUBR

View file

@ -158,7 +158,6 @@ f_media_options_menu()
$DEVICE_TYPE_UFS|$DEVICE_TYPE_DISK)
cp="$msg_file_system" ;;
$DEVICE_TYPE_DIRECTORY) cp="$msg_directory" ;;
$DEVICE_TYPE_FLOPPY) cp="$msg_floppy" ;;
$DEVICE_TYPE_FTP) cp="$msg_ftp" ;;
$DEVICE_TYPE_HTTP_PROXY) cp="$msg_http_proxy" ;;
$DEVICE_TYPE_HTTP) cp="$msg_http_direct" ;;

View file

@ -90,8 +90,6 @@ f_index_initialize()
case "$__type" in
$DEVICE_TYPE_DIRECTORY)
__site="file://$__data/packages/$PKG_ABI" ;;
$DEVICE_TYPE_FLOPPY)
__site="file://${__data:-$MOUNTPOINT}/packages/$PKG_ABI" ;;
$DEVICE_TYPE_FTP)
f_getvar $VAR_FTP_PATH __site
__site="$__site/packages/$PKG_ABI" ;;

View file

@ -171,7 +171,6 @@ f_resword_new mediaGetType f_media_get_type # media/any.subr
f_resword_new mediaSetCDROM f_media_set_cdrom # media/cdrom.subr
f_resword_new mediaSetDOS f_media_set_dos # media/dos.subr
f_resword_new mediaSetDirectory f_media_set_directory # media/directory.subr
f_resword_new mediaSetFloppy f_media_set_floppy # media/floppy.subr
f_resword_new mediaSetNFS f_media_set_nfs # media/nfs.subr
f_resword_new mediaSetUFS f_media_set_ufs # media/ufs.subr
f_resword_new mediaSetUSB f_media_set_usb # media/usb.subr