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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.5