Debian Codegraph @

sbin/mknic-nbi

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # Author: Steven Shiau <steven _at_ clonezilla org>
3 # license: GPL
4 # Description: this program will create the NBI image for PXE and etherboot
5 # client.
6
7 # Load DRBL setting and functions
8 DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
9
10 . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
11
12 # Settings
13 NETDEV_MOD="/usr/lib/mkpxeinitrd-net/initrd-skel/etc/modulesscip-shell filesystem . . `/usr/lib/mkpxeinitrd-net/initrd-skel/etc/modules`."
14 NETINITRD_CFG="/usr/lib/mkpxeinitrd-net/initrd-skel/etc/linuxrc.confscip-shell filesystem . . `/usr/lib/mkpxeinitrd-net/initrd-skel/etc/linuxrc.conf`."
15 NETDEV_CFG="/usr/lib/mkpxeinitrd-net/initrd-skel/etc/netdev.confscip-shell filesystem . . `/usr/lib/mkpxeinitrd-net/initrd-skel/etc/netdev.conf`."
16
17 # Default settings
18 # The retry max times for udhcp in one ethernet port
19 iretry_max_default="5"
20 # Does linuxrc check the server name ?
21 check_server_name_default="yes"
22 # The default dhcp server name
23 dhcp_server_name_default="drbl"
24 # The default pause time after NIC is up.
25 sleep_time_after_NIC_up_default="0"
26 # The flag to include kernel wireless modules
27 include_wireless_mod="no"
28 # The flag to include all the firmwares in the created PXE initramfs.
29 copy_all_firmwares="no"
30 # The time out to wait for NIC to be linked. Unit: 0.1 secs
31 link_detect_timeout_default="70"
32 # Flag to use /run in initramfs.
33 use_run_in_initrd="yes"
34 # Flag to use /dev/pts in initramfs.
35 use_dev_pts_in_initrd="yes"
36
37 #
38 usagescip-shell shell shell-project 0.0.0 usage().() {
39 echoscip-shell system . . echo. "Update the kernel modules for DRBL clients then create PXE boot image."
40 echoscip-shell system . . echo. "Usage: $0 [Options]"
41 echoscip-shell system . . echo. "Options:"
42 echoscip-shell system . . echo. "-a, --all: create PXE boot image for all supported NIC (deprecated! Now this is default option, and you do not have to specify that.)"
43 echoscip-shell system . . echo. "-k, --kernel KERNEL_VER: specify the KERNEL_VER which you want to create PXE boot image for all supported NIC, If you do not specify any KERNEL_VER, it will try to find the latest DRBL kernel"
44 echoscip-shell system . . echo. "-s, --smp: force to find SMP kernel when creating NIC images"
45 echoscip-shell system . . echo. "-i, --archi ARCH: assign the kernel CPU arch of DRBL clients, ARCH could be i386/i586/i686/x86_64"
46 echoscip-shell system . . echo. "-c, --check-server-name [Y/n]: let client to check DHCP server name is drbl or not when it got IP address from some DHCP server."
47 echoscip-shell system . . echo. "-d, --dhcp-server-name SRVNAME: Force to use the DHCP server name SRVNAME in network initrd."
48 echoscip-shell system . . echo. "-r, --retry-max #: The retry max times # for udhcp in one ethernet port"
49 echoscip-shell system . . echo. "-m, --modules NET_MOD: assign the network device modules to be loaded in DRBL client initrd. NET_MOD is like 'tg3 bcm4400 bcm5700'. (Note! If more than one arguments, you must put \" \" or ' ' before and after the arguments.)"
50 echoscip-shell system . . echo. "-n, --netdev NET_DEV: assign the priority of network device to request IP address from server in DRBL client, NET_DEV is like 'eth1' (just request from eth1) or 'eth1 eth0' (request from eth1, then eth0) (Note! If more than one arguments, you must put \" \" or ' ' before and after the arguments.)"
51 echoscip-shell system . . echo. "-nu, --no-usb-modules: Do NOT include USB keyboard related modules in the network initrd."
52 echoscip-shell system . . echo. "-p, --pause #: Pause # secs after network card if up"
53 echoscip-shell system . . echo. "-P, --udhcpc-port #: Port # for udhcpc to request. Normally you do not have to assign this unless you want to use a special port. If you use this option with etherboot client with 'ALTERNATE_DHCP_PORTS_1067_1068', here you should assign it as 1068."
54 echoscip-shell system . . echo. "-t, --initfs-type [ext2|cramfs|initramfs]: Assign the filesystem type for initialized RAM disk or initialized RAM filesystem"
55 echoscip-shell system . . echo. "--no-modules: Force not to update the kernel modules from server to clients"
56 echoscip-shell system . . echo. "-w, --include-wireless-modules Include the kernel wireless modules in created initrd."
57 echoscip-shell system . . echo. "-if, --include-all-firmwares Include all the firmwares from /usr/lib/firmware/ to the created PXE initramfs."
58 echoscip-shell system . . echo. "-nf, --no-all-firmwares Not to include all the firmwares from /usr/lib/firmware/ to the created PXE initramfs. This is default."
59 echoscip-shell system . . echo. "-o, --link-detect-timeout #: The timeout time (Unit: 0.1 secs) to wait for network card to be linked."
60 echoscip-shell system . . echo. "-v, --verbose Prints out verbose information"
61 echoscip-shell system . . echo.
62 echoscip-shell system . . echo. "Ex:"
63 echoscip-shell system . . echo. "$0 -k 2.4.20-30.9"
64 }
65 #
66 get_pxe_ramdisk_sizescip-shell shell shell-project 0.0.0 get_pxe_ramdisk_size().() {
67 local initrd_tmp ratio
68 ratio="1.1" # The ratio to make $PXE_RAMDISK_SIZE size safer
69 # PXE_RAMDISK_SIZE is global variable
70 initrd_tmp="$(mktempscip-shell system . . mktemp. /tmp/initrd_tmp.XXXXXXscip-shell filesystem . . `/tmp/initrd_tmp.XXXXXX`.)"
71 zcatscip-shell system . . zcat. $pxecfg_pd/initrd-pxe.img > $initrd_tmp
72 PXE_RAMDISK_SIZE="$(LC_ALL=C echoscip-shell system . . echo. "scale=0; $(LANG=C statscip-shell system . . stat. -c "%s" $initrd_tmp) * $ratio / 1024 / 1" | bc -l)"
73 [scip-shell system . . `[`. -z "$PXE_RAMDISK_SIZE" ] && PXE_RAMDISK_SIZE="$PXE_RAMDISK_SIZE_DEF"
74 [scip-shell system . . `[`. -e "$initrd_tmp" ] && rmscip-shell system . . rm. -f $initrd_tmp
75 }
76
77 #
78 check_if_root
79
80 # initial setting
81 SMP_OPTION=""
82 NIC="all"
83 use_usb_keyboard_modules="yes"
84 #
85 while [scip-shell system . . `[`. $# -gt 0 ]; do
86 case "$1" in
87 -v|--verbose)
88 shift; VERBOSE="-v"
89 ;;
90 -s|--smp)
91 shift; SMP_OPTION="-smp"
92 ;;
93 -a|--all)
94 # This is deprecated option, we already force to set NIC=all.
95 # Try to remove this option in the future.
96 shift; truescip-shell system . . true.
97 ;;
98 -i|--archi)
99 shift;
100 # skip the -xx option, in case
101 [scip-shell system . . `[`. -z "$(echoscip-shell system . . echo. $1 |grepscip-shell system . . grep. ^-.)" ] && CLIENT_ARCH="$1"
102 shift;;
103 --no-modules)
104 shift; CP_MODULES="no"
105 ;;
106 -k|--kernel)
107 shift;
108 # skip the -xx option, in case
109 [scip-shell system . . `[`. -z "$(echoscip-shell system . . echo. $1 |grepscip-shell system . . grep. ^-.)" ] && selected_kernel="$1"
110 shift;;
111 -n|--netdev)
112 shift;
113 # skip the -xx option, in case
114 [scip-shell system . . `[`. -z "$(echoscip-shell system . . echo. $1 |grepscip-shell system . . grep. ^-.)" ] && net_dev="$1"
115 shift;;
116 -m|--modules)
117 shift;
118 # skip the -xx option, in case
119 [scip-shell system . . `[`. -z "$(echoscip-shell system . . echo. $1 |grepscip-shell system . . grep. ^-.)" ] && net_modules="$1"
120 shift;;
121 -c|--check-server-name)
122 shift;
123 # skip the -xx option, in case
124 [scip-shell system . . `[`. -z "$(echoscip-shell system . . echo. $1 |grepscip-shell system . . grep. ^-.)" ] && check_server_name="$1"
125 shift;;
126 -d|--dhcp-server-name)
127 shift;
128 # skip the -xx option, in case
129 [scip-shell system . . `[`. -z "$(echoscip-shell system . . echo. $1 |grepscip-shell system . . grep. ^-.)" ] && dhcp_server_name="$1"
130 shift;;
131 -r|--retry-max)
132 shift;
133 # skip the -xx option, in case
134 [scip-shell system . . `[`. -z "$(echoscip-shell system . . echo. $1 |grepscip-shell system . . grep. ^-.)" ] && iretry_max="$1"
135 shift;;
136 -nu|--no-usb-modules) use_usb_keyboard_modules="no"; shift;;
137 -w|--include-wireless-modules) include_wireless_modules="yes"; shift;;
138 -nf|--no-all-firmwares) copy_all_firmwares="no"; shift;;
139 -if|--include-all-firmwares) copy_all_firmwares="yes"; shift;;
140 -p|--pause)
141 shift;
142 # skip the -xx option, in case
143 [scip-shell system . . `[`. -z "$(echoscip-shell system . . echo. $1 |grepscip-shell system . . grep. ^-.)" ] && sleep_time_after_NIC_up="$1"
144 shift;;
145 -P|--udhcpc-port)
146 shift;
147 # skip the -xx option, in case
148 [scip-shell system . . `[`. -z "$(echoscip-shell system . . echo. $1 |grepscip-shell system . . grep. ^-.)" ] && udhcpc_port="$1"
149 shift;;
150 -t|--initfs-type)
151 shift
152 [scip-shell system . . `[`. -z "$(echoscip-shell system . . echo. $1 |grepscip-shell system . . grep. ^-.)" ] && initfs_type="$1"
153 shift ;;
154 -o|--link-detect-timeout)
155 shift
156 [scip-shell system . . `[`. -z "$(echoscip-shell system . . echo. $1 |grepscip-shell system . . grep. ^-.)" ] && link_detect_timeout="$1"
157 shift ;;
158 -*) echoscip-shell system . . echo. "${0}: ${1}: invalid option" >&2
159 usagescip-shell shell shell-project 0.0.0 usage(). >& 2
160 exit 2 ;;
161 *) break ;;
162 esac
163 done
164
165 [scip-shell system . . `[`. -z "$NIC" ] && usagescip-shell shell shell-project 0.0.0 usage(). && exit
166 # parse the parameter for etc/linuxrc.conf in mkpxeinitrd-net
167 [scip-shell system . . `[`. -z "$iretry_max" ] && iretry_max="$iretry_max_default"
168 [scip-shell system . . `[`. -z "$check_server_name" ] && check_server_name="$check_server_name_default"
169 [scip-shell system . . `[`. -z "$dhcp_server_name" ] && dhcp_server_name="$dhcp_server_name_default"
170 [scip-shell system . . `[`. -z "$sleep_time_after_NIC_up" ] && sleep_time_after_NIC_up="$sleep_time_after_NIC_up_default"
171 [scip-shell system . . `[`. -z "$link_detect_timeout" ] && link_detect_timeout="$link_detect_timeout_default"
172
173 # NFS protocol. Read from "$drbl_nfs_prot" in drbl.conf
174 case "$drbl_nfs_prot" in
175 nfs4) nfs_prot_in_initrd="nfs4";;
176 *) nfs_prot_in_initrd="nfs3";;
177 esac
178
179 # Format the variable in case inputed variable is not we want.
180 case "$check_server_name" in
181 n|N|[nN][oO])
182 check_server_name="no"
183 ;;
184 *)
185 check_server_name="yes"
186 ;;
187 esac
188 case "$iretry_max" in
189 [0-9]*)
190 iretry_max="$iretry_max"
191 ;;
192 *)
193 iretry_max="$iretry_max_default"
194 ;;
195 esac
196 case "$sleep_time_after_NIC_up" in
197 [0-9]*)
198 sleep_time_after_NIC_up_no="$sleep_time_after_NIC_up"
199 ;;
200 *)
201 sleep_time_after_NIC_up_no="$sleep_time_after_NIC_up_default"
202 ;;
203 esac
204 case "$use_usb_keyboard_modules" in
205 yes)
206 usb_kb_opt=""
207 ;;
208 no)
209 usb_kb_opt="--no-usb-modules"
210 ;;
211 esac
212
213 # create some directories if they do not exist
214 [scip-shell system . . `[`. ! -d $drbl_common_root/usr/lib/modules ] && mkdirscip-shell system . . mkdir. -p $drbl_common_root/usr/lib/modules
215 [scip-shell system . . `[`. ! -d $drbl_common_root/tmp/boot ] && mkdirscip-shell system . . mkdir. -p $drbl_common_root/tmp/boot
216 (
217 cd $drbl_common_root
218 [scip-shell system . . `[`. -L boot ] && rmscip-shell system . . rm. -f boot
219 lnscip-shell system . . ln. -fs tmp/boot boot
220 )
221
222 # If /run is a mountpoint on server, same as client's initrd.
223 if ! mountpointscip-shell system . . mountpoint. /runscip-shell filesystem . . `/run`. &>/dev/nullscip-shell filesystem . . `/dev/null`.; then
224 use_run_in_initrd="no"
225 fi
226 # If /dev/pts is a mountpoint on server, same as client's initrd.
227 #if ! mountpoint /dev/pts &>/dev/null; then
228 # use_dev_pts_in_initrd="no"
229 #fi
230 # Let use_dev_pts_in_initrd be the same with use_run_in_initrd, i.e. only when /run is created in initrd, we carete /dev/pts, too.
231 use_dev_pts_in_initrd="$use_run_in_initrd"
232
233 # Change the setting in $NETINITRD_CFG
234 echoscip-shell system . . echo. "Will client check DHCP server name is \"$dhcp_server_name\" or not: $check_server_name"
235 echoscip-shell system . . echo. "The maximum times to try to get IP address for a client: $iretry_max"
236 echoscip-shell system . . echo. "The pause time after network card is up: $sleep_time_after_NIC_up"
237 echoscip-shell system . . echo. "The timeout to wait for network card linked (Unit: 0.1 secs): $link_detect_timeout"
238 echoscip-shell system . . echo. "The NFS protocol for DRBL system: $nfs_prot_in_initrd"
239 perlscip-shell system . . perl. -p -i -e "s/^check_server_name=.*/check_server_name=\"$check_server_name\"/g" $NETINITRD_CFG
240 perlscip-shell system . . perl. -p -i -e "s/^dhcp_server_name=.*/dhcp_server_name=\"$dhcp_server_name\"/g" $NETINITRD_CFG
241 perlscip-shell system . . perl. -p -i -e "s/^iretry_max=.*/iretry_max=\"$iretry_max\"/g" $NETINITRD_CFG
242 perlscip-shell system . . perl. -p -i -e "s/^sleep_time_after_NIC_up=.*/sleep_time_after_NIC_up=\"$sleep_time_after_NIC_up\"/g" $NETINITRD_CFG
243 perlscip-shell system . . perl. -p -i -e "s/^link_detect_timeout=.*/link_detect_timeout=\"$link_detect_timeout\"/g" $NETINITRD_CFG
244 perlscip-shell system . . perl. -p -i -e "s/^use_run_in_initrd=.*/use_run_in_initrd=\"$use_run_in_initrd\"/g" $NETINITRD_CFG
245 perlscip-shell system . . perl. -p -i -e "s/^use_dev_pts_in_initrd=.*/use_dev_pts_in_initrd=\"$use_dev_pts_in_initrd\"/g" $NETINITRD_CFG
246 perlscip-shell system . . perl. -p -i -e "s/^nfs_prot_in_initrd=.*/nfs_prot_in_initrd=\"$nfs_prot_in_initrd\"/g" $NETINITRD_CFG
247 if [scip-shell system . . `[`. -n "$udhcpc_port" ]; then
248 echoscip-shell system . . echo. "The port for udhcpc to request is: $udhcpc_port"
249 perlscip-shell system . . perl. -p -i -e "s/^udhcpc_port=.*/udhcpc_port=\"$udhcpc_port\"/g" $NETINITRD_CFG
250 else
251 echoscip-shell system . . echo. "Setting port for udhcpc request to default..."
252 perlscip-shell system . . perl. -p -i -e "s/^udhcpc_port=.*/udhcpc_port=\"\"/g" $NETINITRD_CFG
253 fi
254
255 if [scip-shell system . . `[`. -n "$net_modules" ]; then
256 echoscip-shell system . . echo. "The extra network device module assigned: $net_modules"
257 # Clean all in $NETDEV_MOD, make it as initial one.
258 perlscip-shell system . . perl. -p -i -e "s/^[[:space:]]*[^#]+.*//g" $NETDEV_MOD
259 for imod in $net_modules; do
260 echoscip-shell system . . echo. $imod >> $NETDEV_MOD
261 done
262 fi
263
264 if [scip-shell system . . `[`. -n "$net_dev" ]; then
265 echoscip-shell system . . echo. "The priority of network card for client to request IP address is: $net_dev"
266 perlscip-shell system . . perl. -p -i -e "s/^[[:space:]]*netdevices=.*/netdevices=\"$net_dev\"/g" $NETDEV_CFG
267 fi
268
269 # If we do not specifie kernel, try to find in
270 # (1) /usr/lib/modules (by rpm ...) - old way
271 # (2) /tftpboot/usr/lib/modules (by finding directory)
272 if [scip-shell system . . `[`. -z "$selected_kernel" ]; then
273 echoscip-shell system . . echo. "Searching the latest installed kernel for DRBL client... This might take several minutes..."
274 kernel_mod_list=$(findscip-shell system . . find. $drbl_common_root/usr/lib/modules/ -maxdepth 1 -mindepth 1 -name "[0-9].[0-9]*" -type d -print | sortscip-shell system . . sort. -g | tailscip-shell system . . tail. -n 1)
275 if [scip-shell system . . `[`. -n "$kernel_mod_list" ]; then
276 # the kernel in drbl_common_root is found,
277 # use method (2) (/tftpboot/usr/lib/modules)
278 echoscip-shell system . . echo. "Trying to find the kernel in $drbl_common_root "
279 drbl_kernel="$(basenamescip-shell system . . basename. $kernel_mod_list)"
280 else
281 # the kernel in drbl_common_root is NOT found,
282 # use method (1) (/usr/lib/modules)
283 latest_drbl_kernel="$(rpm -qa | grepscip-shell system . . grep. -E "kernel${SMP_OPTION}[#-]2\.[0-9]+\.[0-9]+" | grepscip-shell system . . grep. -v "test" | pkg-ver-latest)"
284 [scip-shell system . . `[`. -z "$latest_drbl_kernel" ] && echoscip-shell system . . echo. "Unable to find kernel for client!!! Program terminated!!!" && exit 1
285
286 rpm -q --qf '%{filenames}\n' $latest_drbl_kernel &> /dev/nullscip-shell filesystem . . `/dev/null`. && boot_kernel="$(rpm -q --qf '%{filenames}\n' $latest_drbl_kernel)"
287 drbl_kernel="$(echoscip-shell system . . echo. $boot_kernel |cutscip-shell system . . cut. -d"-" -f2-)"
288 fi
289 else
290 # specify the kernel, so we have to check if the kernel exist or not.
291 # By checking the kernel modules, we will know that!
292 # (Here we assume the kernel modules will be created, not all buildin)
293 # the kernel will exist in
294 # (1) /usr/lib/modules - old way
295 # (2) /tftpboot/usr/lib/modules
296 [scip-shell system . . `[`. ! -d "$drbl_common_root/usr/lib/modules/$selected_kernel" -a ! -d "/usr/lib/modules/$selected_kernel" ] && echoscip-shell system . . echo. "Can NOT find the kernel \"$selected_kernel\" you specified! Program terminated!" && exit 1
297 drbl_kernel="$selected_kernel"
298 # if we can find the modules in the common_root, use it first.
299 # the drbl_kernel_mod_path is the leading path.
300 if [scip-shell system . . `[`. -d "$drbl_common_root/usr/lib/modules/$selected_kernel" ]; then
301 drbl_kernel_mod_path="$drbl_common_root/"
302 else
303 drbl_kernel_mod_path=""
304 fi
305 echoscip-shell system . . echo. "Using the kernel modules from $drbl_kernel_mod_path/usr/lib/modules..."
306
307 fi
308
309 #
310 echoscip-shell system . . echo. "The selected kernel for DRBL clients is: $drbl_kernel"
311 #
312 if [scip-shell system . . `[`. -z "$initfs_type" -a -n "$(echoscip-shell system . . echo. $drbl_kernel | grepscip-shell system . . grep. -E "^(2\.6\.1[5-9]+|2\.6\.[2-9][0-9]|3\.|4\.)" )" ]; then
313 # default to use initramfs for kernel 2.6.15 or later.
314 echoscip-shell system . . echo. "Kernel 2.6 or 3 was found, so default to use initramfs."
315 initfs_type="initramfs"
316 fi
317
318 if [scip-shell system . . `[`. -n "$initfs_type" ]; then
319 # put the option for mkpxeinitrd-net
320 initfs_opt="-t $initfs_type"
321 fi
322
323 if [scip-shell system . . `[`. "$include_wireless_modules" = "yes" ]; then
324 wireless_mod_option="-w"
325 else
326 wireless_mod_option=""
327 fi
328 if [scip-shell system . . `[`. "$copy_all_firmwares" = "yes" ]; then
329 # By default we include all of them in the created initramfs.
330 inc_all_firmwares_opt="-if"
331 else
332 inc_all_firmwares_opt="-nf"
333 fi
334
335 # prepare the directories for DRBL clients
336 [scip-shell system . . `[`. ! -d /tftpbootscip-shell filesystem . . `/tftpboot`. ] && mkdirscip-shell system . . mkdir. /tftpbootscip-shell filesystem . . `/tftpboot`.
337 [scip-shell system . . `[`. ! -d /tftpboot/nbi_imgscip-shell filesystem . . `/tftpboot/nbi_img`. ] && mkdirscip-shell system . . mkdir. -p /tftpboot/nbi_imgscip-shell filesystem . . `/tftpboot/nbi_img`.
338 [scip-shell system . . `[`. ! -d /tftpboot/node_rootscip-shell filesystem . . `/tftpboot/node_root`. ] && mkdirscip-shell system . . mkdir. -p /tftpboot/node_rootscip-shell filesystem . . `/tftpboot/node_root`.
339 [scip-shell system . . `[`. ! -d /tftpboot/nodesscip-shell filesystem . . `/tftpboot/nodes`. ] && mkdirscip-shell system . . mkdir. -p /tftpboot/nodesscip-shell filesystem . . `/tftpboot/nodes`.
340
341 #
342 echoscip-shell system . . echo. "$drbl_kernel" > $pxecfg_pd/kernel_version_in_initrd.txt
343 [scip-shell system . . `[`. -n "$CLIENT_ARCH" ] && echoscip-shell system . . echo. "$CLIENT_ARCH" > $pxecfg_pd/client_kernel_arch.txt
344
345 if [scip-shell system . . `[`. "$CP_MODULES" != "no" ]; then
346 update-drbl-client-kernel-from-server
347 fi
348
349 # create the initrd and kernel for clients.
350 KARCH_CLIENT="$(catscip-shell system . . cat. $pxecfg_pd/client_kernel_arch.txt 2>/dev/nullscip-shell filesystem . . `/dev/null`.)"
351 KARCH_EXISTING_KERNEL="$(drbl-check-kernel-cpu-arch --drbl-client $drbl_kernel)"
352 if [scip-shell system . . `[`. -z "$KARCH_EXISTING_KERNEL" ]; then
353 [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
354 echoscip-shell system . . echo. "The requested kernel \"$KARCH_CLIENT\" $drbl_kernel kernel files are NOT found in $drbl_common_root/usr/lib/modules/ and $drbl_common_root/boot in the server! The necessary modules in the network initrd can NOT be created!"
355 echoscip-shell system . . echo. "Client will NOT remote boot correctly!"
356 echoscip-shell system . . echo. "Program terminated!"
357 [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
358 exit 1
359 fi
360
361 if [scip-shell system . . `[`. "$KARCH_CLIENT" = "best_optimization" -o "$KARCH_EXISTING_KERNEL" = "$KARCH_CLIENT" ]; then
362 echoscip-shell system . . echo. "Creating the network boot initrd for PXE clients by: mkpxeinitrd-net -k $drbl_kernel $initfs_opt $usb_kb_opt $wireless_mod_option $inc_all_firmwares_opt $VERBOSE"
363 mkpxeinitrd-net -k $drbl_kernel $initfs_opt $usb_kb_opt $wireless_mod_option $inc_all_firmwares_opt $VERBOSE
364 rc=$?
365 if [scip-shell system . . `[`. "$rc" -eq 0 ]; then
366 case "$initfs_type" in
367 initramfs|INITRAMFS)
368 echoscip-shell system . . echo. "Initramfs, remove ramdisk_size/ramdisk_block in $PXE_CONF_DEF if exists..."
369 del_param_in_pxelinux_cfg_drbl_related_block $PXE_CONF_DEF "ramdisk_size=.*"
370 del_param_in_pxelinux_cfg_drbl_related_block $PXE_CONF_DEF "ramdisk_blocksize=.*"
371 ;;
372 *)
373 get_pxe_ramdisk_sizescip-shell shell shell-project 0.0.0 get_pxe_ramdisk_size(). # Get the variable PXE_RAMDISK_SIZE
374 echoscip-shell system . . echo. "Initrd, assign ramdisk_size ($PXE_RAMDISK_SIZE) and ramdisk_block ($PXE_RAMDISK_BLOCKSIZE) in $PXE_CONF_DEF."
375 add_param_in_pxelinux_cfg_drbl_related_block $PXE_CONF_DEF "ramdisk_size=$PXE_RAMDISK_SIZE"
376 add_param_in_pxelinux_cfg_drbl_related_block $PXE_CONF_DEF "ramdisk_blocksize=$PXE_RAMDISK_BLOCKSIZE"
377 ;;
378 *) usagescip-shell shell shell-project 0.0.0 usage().
379 exit 2;;
380 esac
381 fi
382 else
383 [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
384 echoscip-shell system . . echo. "The requested kernel \"$KARCH_CLIENT\" $drbl_kernel kernel files are NOT found in $drbl_common_root/usr/lib/modules/ and $drbl_common_root/boot in the server! The necessary modules in the network initrd can NOT be created!"
385 echoscip-shell system . . echo. "Client will NOT remote boot correctly!"
386 echoscip-shell system . . echo. "Program terminated!"
387 [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
388 exit 1
389 fi
390
391 echoscip-shell system . . echo. "Finished!"
392 exit 0