Update mkrescue script
[rrq/maintain_lilo.git] / debian / patches / 14_update-mkrescue-script.patch
1 Package:     lilo
2 Subject:     update mkrescue script
3 Author:      Joachim Wiedorn <ad_debian at joonet.de>
4 Bug-Debian:  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=627120
5 Forwarded:   yes
6 Last-Update: 2011-06-18
7
8 The last small change of mkrescue were incomplete. The script don't
9 run successfully. Now I have made a larger update of this old script.
10 Changes of needed tools: genisoimage instead of mkisofs, wodim as
11 other tool for cdrecord.
12 ---
13
14 diff -urN s13/mkrescue s14/mkrescue
15 --- s13/mkrescue        2011-04-09 17:05:16.000000000 +0200
16 +++ s14/mkrescue        2011-06-18 23:29:51.000000000 +0200
17 @@ -1,39 +1,35 @@
18  #!/bin/bash
19  #
20 -# mkrescue
21 -#
22 -#      30-Oct-2001     original version 1.0
23 -#
24 -# Revision history:
25 -#      09-Apr-2002     John Coffman    modify for lilo 22.3   1.1
26 -#      09-Jun-2002     John Coffman    get keyboard translation table 1.2
27 -#                                      (suggested by Qing Liu)
28 -#      07-May-2003     John Coffman    add nowarn for lilo 22.5.2  1.3
29 -#      13-May-2003     John Coffman    use default image, add append=  1.4
30 -#      24-May-2003     John Coffman    specify ext2 params for xtra space
31 -#      26-May-2003     John Coffman    el-torito-bootable-CD   2.1
32 -#      30-May-2003        "            add lilo version check  2.1
33 -#      07-Jul-2003        "            determine loopback dynamically 2.3
34 -#      29-Aug-2004        "            allow --root LABEL=lblname  2.4
35 -#      01-Sep-2004        "            fix check for LILO version  2.4
36 -#      03-Oct-2004        "            get root= from /etc/fstab   2.5
37 -#      15-Nov-2004        "            support --iso --size HD     3.0
38 -#      18-Aug-2005        "            applied temp-file security patch 3.1
39 -#      25-Sep-2005        "            log config file on --debug  3.2
40 -#      04-Oct-2005        "            new 'master' determination  3.2
41 -#      07-Oct-2005        "            add -v0 -w to usages of -I  3.2
42 +#       mkrescue - create a boot floppy or cd image with the current kernel
43  #
44 +#       Copyright 2001-2005 John Coffman
45 +#       Copyright 2010-2011 Joachim Wiedorn <ad_debian at joonet.de>
46 +#       
47 +#       This program is free software; you can redistribute it and/or modify
48 +#       it under the terms of the GNU General Public License as published by
49 +#       the Free Software Foundation; either version 2 of the License, or
50 +#       (at your option) any later version.
51 +#       
52 +#       This program is distributed in the hope that it will be useful,
53 +#       but WITHOUT ANY WARRANTY; without even the implied warranty of
54 +#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
55 +#       GNU General Public License for more details.
56 +#       
57 +#       You should have received a copy of the GNU General Public License
58 +#       along with this program; if not, write to the Free Software
59 +#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
60 +#       MA 02110-1301, USA.
61  
62  debug=false
63  #debug=true
64  
65  # set the version number on this command
66 -version=3.2
67 +version=3.8
68  
69  # set the version of LILO required to run
70  major=22
71 -minor=6
72 -revision=1
73 +minor=8
74 +revision=0
75  
76  log=$(pwd)/mkrescue.log
77  clog=$(pwd)/mkrescue.conf.log
78 @@ -50,32 +46,29 @@
79             [--root <device>] [--nocompact] [--noformat]
80             [--iso] [--size 1440|1200|2880|HD]
81  
82 -  --device  is the floppy drive; e.g.,  /dev/fd0
83 -  --fast  specifies creation using a loopback device, which may be faster
84 -  --fs  is the filesystem to make on the device; e.g.,  ext2
85 -  --help  prints this helpfile
86 -  --iso  create a bootable ISO image to burn to a CD-R or CD-RW
87 -  --keymap  is the keyboard translation table; default to same as lilo.conf
88 +  --device   is the floppy drive; e.g.,  /dev/fd0
89 +  --fast     specifies creation using a loopback device, which may be faster
90 +  --fs       is the filesystem to make on the device; e.g.,  ext2
91 +  --help     prints this helpfile
92 +  --iso      create a bootable ISO image to burn to a CD-R or CD-RW
93 +  --keymap   is the keyboard translation table; default to same as lilo.conf
94    --noformat  bypasses creation of a new filesystem on device
95    --nocompact  omits lilo map file compaction
96 -  --size  is assumed to be 1440 (1.44M), unless 1200 or 2880 is specified
97 -       HD may be specified for ISO images
98 -  --image  specifies the label of the kernel/initrd if not the default
99 -  --install  text is the default for floppies, menu for ISO images
100 -  --initrd and --kernel  are the initial ramdisk & kernel files
101 -  --append  is a string used to specify kernel options
102 -  --root  is the root filesystem for the boot floppy; e.g., current
103 +  --size     is assumed to be 1440 (1.44M), unless 1200 or 2880 is specified
104 +             HD may be specified for ISO images
105 +  --image    specifies the label of the kernel/initrd if not the default
106 +  --install  'text' is the default for floppies, 'menu' for ISO images
107 +  --initrd   and --kernel  are the initial ramdisk & kernel files
108 +  --append   is a string used to specify kernel options
109 +  --root     is the root filesystem for the boot floppy; e.g., current
110    --version  prints the version number of `basename $0`
111 +  --debug    provide verbose output and pausing after defined steps
112  
113  Used without any arguments, `basename $0` will use the default kernel in
114  /etc/lilo.conf, the companion initrd (if any), and the specified root
115  filesystem to make a bootable rescue floppy.
116  
117  EOF
118 -#
119 -# --install & --debug are undocumented above
120 -#
121 -#
122      exit $1
123  }
124  
125 @@ -96,11 +89,9 @@
126  compact=-c
127  device=/dev/fd0
128  fs=ext2
129 -tmpbase="`mktemp -dt $(basename $0).XXXXXXXXXX`" || exit
130 -if [ "$debug" != true ]; then
131 -        trap 'rm -rf -- "$tmpbase"' EXIT
132 -        trap 'trap - EXIT; rm -rf -- "$tmpbase"; exit 1' HUP INT QUIT TERM
133 -fi
134 +tmpbase="`mktemp -dt $(basename $0).XXXXXXXXXX`" || {
135 +    echo "Could not create temporary directory."; exit 1
136 +}
137  mount="$tmpbase/mkrescue-flp"
138  mfile="$tmpbase/mkrescue-emu"
139  mtemp="$tmpbase/mkrescue-tmp"
140 @@ -191,11 +182,6 @@
141  rm -rf $mount/*
142  > $mfile
143  
144 -mkdir $tmpbase || {
145 -    echo "Could not create temporary directory."
146 -    exit 1
147 -}
148 -
149  master=`mount | grep " / " | cut -d " " -f 1`
150  master=`echo $master | sed "s/part[0-9]*$/disc/"`
151  master=`echo $master | sed "s/[0-9]*$//"`
152 @@ -674,7 +660,8 @@
153  fi
154  
155  if [ $isoimage = yes ]; then
156 -       echo MKISOFS
157 +       echo START MakeISOFS:
158 +       echo
159         out=$device
160         opt=
161         if [ $size = $hdsize ]; then
162 @@ -683,18 +670,19 @@
163             opt=-hard-disk-boot
164         fi
165         mv $mfile $mount/boot.bin
166 -       mkisofs $opt -J -R -T \
167 +       genisoimage $opt -J -R -T \
168                 -V LILO_BOOT -A "Linux Boot CD created by LILO mkrescue" \
169                 -b boot.bin -c boot.cat -o $out $mount
170         cat <<EOF
171  
172 -END MKISOFS:  output is in  '$device'
173 +END MakeISOFS:  output is in  '$device'
174  
175  
176 -The bootable CD can be burned with the 'cdrecord' utility
177 +The bootable CD can be burned with the 'cdrecord' or 'wodim' utility
178  using a command of the form:
179  
180         cdrecord [<options>] [dev=<device>] $device
181 +       wodim [<options>] [dev=<device>] $device
182  
183  EOF
184  elif [ "$fast" = fast ]; then