/[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 - (hide annotations) (download)
Wed Dec 31 19:05:38 2003 UTC (9 years, 4 months ago) by lange
File size: 3664 byte(s)
remove unused line
1 lange 1906 #! /bin/sh
2    
3     # copyright Thomas Lange 2001-2003, lange@debian.org
4 lange 2004 # LILO support may be dropped in a future release
5 lange 1906
6 lange 2004 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 lange 1906 # 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 lange 2004 FFLAGS=${FAI_FLAGS// /,}
28    
29 lange 1931 cd $target/boot && kernelversion=`ls vmlinuz-*`
30    
31 lange 1906 # 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 lange 2004
68     fcopy /boot/grub/menu.lst || {
69     fullpath=$(ls $target/boot/vmlinuz-*)
70     grubvars $fullpath
71 lange 1906 if [ -L $target/initrd.img ]; then
72 lange 2004 iname=$(cd $target/boot; ls initrd.img*)
73     t="$target/boot"
74     ipath=${t#$mntp}
75     initrdopt="initrd $ipath/$iname"
76 lange 1906 fi
77 lange 2004 cat > $gmenu <<-EOF
78 lange 1906
79     # created by FAI
80    
81     timeout 10
82     default 0
83     color cyan/blue white/blue
84    
85 lange 2004 title Debian GNU/Linux, $kernelversion
86 lange 1906 root $broot
87 lange 2004 kernel $gpath root=$ROOT_PARTITION
88 lange 1906 $initrdopt
89     EOF
90     if ifclass BOOTWINDOWS; then
91 lange 2004 cat >> $gmenu <<-EOF
92 lange 1906
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 lange 2004 t="$target/boot"
106     gpath=${t#$mntp}
107     cat >> $gmenu <<-EOF
108 lange 1906
109 lange 2004 title memtest
110     root $broot
111     kernel $gpath/memtest86.bin
112 lange 1906 EOF
113     fi
114     }
115 lange 2004 echo "Grub installed for $kernelversion on $broot"
116 lange 1906 fi
117     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
118     ifclass FAI_BOOTPART && {
119    
120 lange 1997 mkdir -p $target/fai-boot/boot
121     cp -a /boot/vmlinuz* $target/fai-boot/boot
122 lange 1906
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 lange 1997 cd $target/fai-boot/ && kernelname=/`ls boot/vmlinuz-*`
141 lange 2004 fullpath=$(ls $target/fai-boot/boot/vmlinuz-*)
142     grubvars $fullpath
143     cat >> $gmenu <<-EOF
144 lange 1906
145 lange 1997 title start FAI with FAI_ACTION=sysinfo
146     root $broot
147 lange 2004 kernel $kernelname root=/dev/nfs ip=dhcp FAI_FLAGS=$FFLAGS FAI_LOCATION=$FAI_LOCATION FAI_ACTION=sysinfo
148 lange 1997
149     title FAI re-Installation
150     root $broot
151 lange 2004 kernel $kernelname root=/dev/nfs ip=dhcp FAI_FLAGS=$FFLAGS FAI_LOCATION=$FAI_LOCATION FAI_ACTION=install
152 lange 1906 EOF
153 lange 1931 echo "Grub for $kernelversion installed on $broot"
154 lange 1906 }
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