File: mkbootfloppy

package info (click to toggle)
lessdisks 0.5.3cvs.20040906-16
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,480 kB
  • ctags: 271
  • sloc: sh: 3,058; makefile: 92
file content (53 lines) | stat: -rwxr-xr-x 1,160 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
#/usr/sbin/mkbootfloppy

# copyright 2004 vagrant@freegeek.org, distributed under the terms of the
# GNU General Public License version 2 or any later version.

cd /boot/disks

if [ -r "$1" ]; then
  floppyimage="$1"
else
  PATH="/usr/local/lib/easydialog:/usr/share/easydialog:/usr/lib/easydialog:$PATH" . easydialog.sh

  if [ -r default.img ]; then
    defaultimage=$(ls -l default.img | awk '{print $9" "$11}' ; echo on)
  fi

  otherimages=$(ls *.img | egrep -v default.img)

  for thisimage in $otherimages; do
    images="$images $thisimage . off"
  done

  radioBox "select floppy image" \
    "which floppy disk image would you like to create?" \
    $defaultimage \
    $images

  case $? in
    0) ;;
    1) echo "floppy image selection cancelled..." 
      exit 0 ;;
    255) echo "something went wrong, exiting..."
      exit 1 ;;
  esac

  floppyimage="$REPLY"
fi

if [ -r /boot/disks/$floppyimage ]; then
  echo "making boot floppy with $floppyimage"
  dd if=/boot/disks/$floppyimage of=/dev/fd0 bs=1k
  status="$?"
else
  echo "no valid floppy image found, exiting..."
  exit 1
fi

sleep 3

echo "floppy image finished..."

exit "$?"