File: fast.sh

package info (click to toggle)
boot-floppies 2.0.11
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 4,504 kB
  • ctags: 3,437
  • sloc: ansic: 18,814; sh: 1,738; yacc: 765; makefile: 443; lex: 100; perl: 60
file content (42 lines) | stat: -rwxr-xr-x 645 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
#!	/bin/sh

# Abort on any non-zero return.
set -e

# Verbose shell execution.
#set -x
#set -v

# Print a usage message and exit if the argument count is wrong.
if [ $# != 2 ]; then
	echo "Usage: "$0" old-floppy new-floppy" 1>&2
	cat 1>&2 << EOF

	old-floppy: Floppy image to modify.
	new-floppy: name for the modified floppy image.
EOF
	exit -1
fi

oldf=$1
newf=$2

mnt=/var/tmp/mnt.$$

loopdevice=/dev/loop3

cp $oldf $newf.tmp

(umount $loopdevice; true)
(/sbin/losetup -d $loopdevice; true)

/sbin/losetup $loopdevice $newf.tmp

syslinux $loopdevice

/sbin/losetup -d $loopdevice

(rm -f -r $newf;true)
mv $newf.tmp $newf
ls -l $newf
exit 0