dpkg (1.18.25) stretch; urgency=medium
[dpkg] / dselect / methods / floppy / setup
CommitLineData
1479465f
GJ
1#!/bin/sh
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <https://www.gnu.org/licenses/>.
15
16set -e
17vardir="$1"
18method=$2
19option=$3
20
21cd "$vardir/methods/floppy"
22
23defaultfloppy=fd0
24defaultfstype=msdos
25if [ -f shvar.$option ]
26then
27 . ./shvar.$option
28 defaultfloppy="`echo \"$defaultfloppy\" | sed -e 's,^/dev/,,'`"
29fi
30
31while [ -z "$floppy" ]
32do
33 echo -n '
34Which floppy disk drive do you wish to use ? Give the name in
35/dev (eg fd0) or the MSDOS drive letter (eg A). ['$defaultfloppy'] '
36 read floppy
37 if [ -z "$floppy" ]
38 then
39 floppy="$defaultfloppy"
40 fi
41 case "$floppy" in
42 [ABab] | [ABab]: )
43 floppy="`echo $floppy | \
44 sed -e 's/:$//; s,^[Aa],/dev/fd0,; s,^[Bb],/dev/fd1,'`"
45 ;;
46 /* )
47 ;;
48 * )
49 floppy="/dev/$floppy"
50 ;;
51 esac
52 if ! [ -b "$floppy" ]
53 then
54 echo "$floppy is not a block device."
55 floppy=""
56 fi
57done
58
59while [ -z "$fstype" ]
60do
61 echo -n '
62What kind of filesystem is on the floppies ? ['$defaultfstype'] '
63 read fstype
64 if [ -z "$fstype" ]
65 then
66 fstype="$defaultfstype"
67 fi
68 if ! grep " $fstype$" /proc/filesystems >/dev/null
69 then
70 echo \
71 "Your kernel does not appear to support that filesystem type."
72 fstype=""
73 fi
74done
75
76echo
77
78outputparam () {
79 echo "$2" | sed -e "s/'/'\\\\''/; s/^/$1='/; s/$/'/" >&3
80}
81
82exec 3>shvar.$option.new
83
84outputparam defaultfloppy "$floppy"
85outputparam defaultfstype "$fstype"
86
87mv shvar.$option.new shvar.$option
88
89exit 0