/[fai]/trunk/examples/simple/scripts/BOOT
ViewVC logotype

Contents of /trunk/examples/simple/scripts/BOOT

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1997 - (show annotations) (download)
Wed Jul 30 15:27:55 2003 UTC (9 years, 9 months ago) by lange
File size: 3712 byte(s)
add menu.lst entries for FAI_BOOTPART class
1 #! /bin/sh
2
3 # copyright Thomas Lange 2001-2003, lange@debian.org
4
5 # this is the function: AppendIfNoSuchLine
6 egrep -q "^auto" $target/etc/modules 2>/dev/null || echo "auto" >> $target/etc/modules
7
8 # a list of modules which are loaded at boot time
9 for module in $moduleslist; do
10 echo $module >> $target/etc/modules
11 done
12
13 cd $target/boot && kernelversion=`ls vmlinuz-*`
14
15 # if class MBR is defined, write lilo into master boot record
16 ifclass MBR || BOOT_DEVICE=$ROOT_PARTITION
17
18 if ifclass LILO; then
19 fcopy /etc/lilo.conf || {
20 # if the installed kernel is using an initial ramdisk
21 if [ -L $target/initrd.img ]; then
22 initrdopt="initrd=/initrd.img"
23 fi
24 # write lilo.conf and install lilo to disk
25 echo "Creating lilo.conf for /vmlinuz"
26 cat > $target/etc/lilo.conf <<-EOF
27 boot=$BOOT_DEVICE
28 root=$ROOT_PARTITION
29 install=/boot/boot.b
30 map=/boot/map
31 vga=normal
32 delay=50
33
34 image=/vmlinuz
35 append="devfs=nomount"
36 $initrdopt
37 label=linux
38 read-only
39
40 image=/vmlinuz.old
41 label=linux.old
42 read-only
43 optional
44 $liloappend
45 EOF
46 }
47 fi
48
49 if ifclass GRUB; then
50 kernelname=/vmlinuz
51 echo "Installing grub and boot entry for $kernelname"
52 grub-install --root-directory=$target $BOOT_DEVICE
53 broot=`device2grub $ROOT_PARTITION`
54 if [ -L $target/initrd.img ]; then
55 initrdopt="initrd $broot/initrd.img"
56 fi
57
58 fcopy /boot/grub/menu.lst || {
59 cat > $target/boot/grub/menu.lst <<-EOF
60
61 # created by FAI
62
63 timeout 10
64 default 0
65 color cyan/blue white/blue
66
67 title Debian GNU/Linux, $kernelname $kernelversion
68 root $broot
69 kernel $kernelname
70 $initrdopt
71 EOF
72 if ifclass BOOTWINDOWS; then
73 cat >> $target/boot/grub/menu.lst <<-EOF
74
75 # created by FAI
76
77 # For booting Windows NT or Windows95
78 title Windows
79 rootnoverify (hd0,0)
80 makeactive
81 chainloader +1
82 EOF
83 fi
84
85 # add entry for memtest
86 if dpkg -l memtest86 > /dev/null 2>&1 ; then
87 cat >> $target/boot/grub/menu.lst <<-EOF
88
89 title memtest
90 root $broot
91 kernel /boot/memtest86.bin
92
93 EOF
94 fi
95
96 }
97 rdev $target/$kernelname $ROOT_PARTITION
98 echo "Grub installed for $kernelname on $broot"
99
100 fi
101
102 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
103 # this was the script FAI_BOOTPART
104 # this must be executes after the part above, because we append
105 # some lines to the boot loader configuration files
106
107 # create a partition for booting FAI from local disk and
108 # add this kernel to lilo or grub
109
110 # Thomas Lange, Uni Koeln, 2000,2002
111
112 ifclass FAI_BOOTPART && {
113
114 mkdir -p $target/fai-boot/boot
115 cp -a /boot/vmlinuz* $target/fai-boot/boot
116
117 ifclass LILO && {
118 # write lilo.conf and install lilo to disk
119 echo "Add /fai-boot partition to lilo.conf"
120
121 cat >> $target/etc/lilo.conf <<-EOF
122 image=/fai-boot/boot/$kernelversion
123 $initrdopt
124 append="devfs=nomount"
125 label=FAI
126 EOF
127
128 mkdir $target/fai-boot/etc
129 cp $target/etc/lilo.conf $target/fai-boot/etc
130 }
131
132 ifclass GRUB && {
133
134 echo "Add /fai-boot partition to menu.lst for grub"
135 cd $target/fai-boot/ && kernelname=/`ls boot/vmlinuz-*`
136 # get device for this boot partition
137 dev=`df $target/fai-boot | grep '^/dev/' | cut -d ' ' -f1`
138 broot=`device2grub $dev`
139
140 cat >> $target/boot/grub/menu.lst <<-EOF
141
142 title start FAI with FAI_ACTION=sysinfo
143 root $broot
144 kernel $kernelname root=/dev/nfs ip=dhcp FAI_FLAGS=$FAI_FLAGS FAI_LOCATION=$FAI_LOCATION FAI_ACTION=sysinfo
145
146 title FAI re-Installation
147 root $broot
148 kernel $kernelname root=/dev/nfs ip=dhcp FAI_FLAGS=$FAI_FLAGS FAI_LOCATION=$FAI_LOCATION FAI_ACTION=install
149 EOF
150 echo "Grub for $kernelversion installed on $broot"
151 }
152 }
153
154 # now call lilo
155 # you can also use this
156 # $ROOTCMD lilo -v
157 if ifclass LILO; then
158 $target/sbin/lilo -r $target
159 fi

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5