Adjust configuration for new grml2usb layout; fix dirname usage
[grml-terminalserver.git] / templates / grub-pxelinux_config
1 # the following variables are available in the template:
2 #
3 # $INTERFACE_     (interface for the terminalserver)
4 # $IP_            (ip for the terminalserver to bind)
5 # $NETMASK_       (network mask)
6 # $GW_            (gateway)
7 # $NAMESERVERS_   (nameservers for the nodes)
8 # $IPRANGE_FROM_  (user configured iprange, first ip)
9 # $IPRANGE_TO_    (user configured iprange, last ip)
10 # $NETWORK_       (first ip in this subnet)
11 # $OPTIONS_       (options for grml-terminalserver)
12 # $BOOT_ARGS_     (boot arguments for the nodes)
13 #
14 # NOTE:
15 # templates are shellscript fragments and will be sourced from the
16 # terminalserver
17 #
18 # GLOBAL_README_END
19
20 if grep -q live-media-path= /proc/cmdline 2>/dev/null ; then
21     live_media_path_="live-media-path=$(awk -F live-media-path= '{print $2}' /proc/cmdline)"
22 fi
23
24 # default boot arguments used for both grub and pxelinux
25 if [ -e '/live/cow' ]; then
26     default_boot_args_="root=/dev/nfs rw nfsroot=$IP_:$MOUNT_POINT_ \
27 boot=live $live_media_path_ nomce quiet apm=power-off nodhcp noprompt noeject"
28 else
29     default_boot_args_="ramdisk_size=24000 root=/dev/ram0 rw \
30 init=/etc/init nfsdir=$IP_:$MOUNT_POINT_ nodhcp noprompt noeject \
31 apm=power-off nomce"
32 fi
33
34 # special boot arguments required by grub
35 grub_def_boot_args_="/linux26 $default_boot_args_"
36
37 # special boot arguments required by pxelinux
38 pxe_def_boot_args_="$default_boot_args_ initrd=minirt26.gz"
39
40 # default arguments for framebuffer console
41 def_fb_args_="vga=791"
42 no_fb_args_="vga=normal"
43
44 ###
45 ## create grub config
46 ###
47
48 cat >"$TFTPD_DATA_DIR_/menu.lst" <<EOT
49 default=0
50 timeout=10
51 title GRML
52   root (nd)
53   kernel $grub_def_boot_args_ $def_fb_args_ $BOOT_ARGS_
54   initrd /minirt26.gz
55
56 title GRML no framebuffer
57   root (nd)
58   kernel $grub_def_boot_args_ $no_fb_args_ $BOOT_ARGS_
59
60 title GRML small
61   root (nd)
62   kernel $grub_def_boot_args_ small $def_fb_args_ $BOOT_ARGS_
63   initrd /minirt26.gz
64
65 title GRML small nofb
66   root (nd)
67   kernel $grub_def_boot_args_ small $no_fb_args_ $BOOT_ARGS_
68   initrd /minirt26.gz
69
70 title GRML debuginit
71   root (nd)
72   kernel $grub_def_boot_args_ debuginitrd $def_fb_args_ $BOOT_ARGS_
73   initrd /minirt26.gz
74
75 title GRML debuginit nofb
76   root (nd)
77   kernel $grub_def_boot_args_ debuginitrd $no_fb_args_ $BOOT_ARGS_
78   initrd /minirt26.gz
79
80 title GRML rescue
81   root (nd)
82   kernel $grub_def_boot_args_ $no_fb_args_
83   initrd /minirt26.gz
84
85 title memtest
86   root (nd)
87   kernel /memtest
88
89 title Reload config
90   configfile (nd)/menu.lst
91 EOT
92
93 ret_=$?
94
95
96 ###
97 ## create pxelinux config
98 ###
99
100 cat >"$TFTPD_DATA_DIR_/pxelinux.cfg/default" <<EOT
101 DEFAULT linux26
102 APPEND $pxe_def_boot_args_ $def_fb_args_ $BOOT_ARGS_
103 TIMEOUT 100
104 PROMPT 1
105 DISPLAY boot.msg
106 F1 boot.msg
107 LABEL grml
108 KERNEL linux26
109 APPEND $pxe_def_boot_args_ $def_fb_args_ $BOOT_ARGS_
110 LABEL grmlnofb
111 KERNEL linux26
112 APPEND $pxe_def_boot_args_ $no_fb_args_ $BOOT_ARGS_
113 LABEL small
114 KERNEL linux26
115 APPEND $pxe_def_boot_args_ small $def_fb_args_ $BOOT_ARGS_
116 LABEL smallnofb
117 KERNEL linux26
118 APPEND $pxe_def_boot_args_ small $no_fb_args_ $BOOT_ARGS_
119 LABEL debuginit
120 KERNEL linux26
121 APPEND $pxe_def_boot_args_ debuginit $def_fb_args_ $BOOT_ARGS_
122 LABEL debuginit
123 KERNEL linux26
124 APPEND $pxe_def_boot_args_ debuginit $no_fb_args_ $BOOT_ARGS_
125 LABEL rescue
126 KERNEL linux26
127 APPEND $pxe_def_boot_args_ $no_fb_args_
128 LABEL memtest
129 KERNEL memtest
130 APPEND fix
131
132 EOT
133
134 let ret_=$ret_+$?
135 return $ret_