Debian Codegraph @

scripts/sbin/drbl-gen-pxe-nbi

raw symbols SCIP
1 #!/bin/bash
2 # Author: Steven Shiau <steven _at_ clonezilla org>
3 # License: GPL
4 # Description: DRBL utitilty to create the Network Boot Image (NBI) files for PXELINUX clients.
5 # NOTE! THIS COMMAND IS USUALLY CALLED BY DRBLSRV SINCE IT RUNS mknic-nbi WITH --no-modules.
6 # If you already finished drblush, it's better to run "mknic-nbi" directly.
7
8 # Load DRBL setting and functions
9 DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
10
11 . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
12
13 #
14 USAGE() {
15 echo "Usage: $0 [OPTION]"
16 echo "OPTION"
17 language_help_prompt_by_idx_no
18 echo "-k, --client-kernel-ver 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"
19 echo "-s, --smp: force to find SMP kernel when creating NIC images"
20 }
21
22 # Parse command-line options
23 while [ $# -gt 0 ]; do
24 case "$1" in
25 -l|--language)
26 shift
27 if [ -z "$(echo $1 |grep ^-.)" ]; then
28 # skip the -xx option, in case
29 specified_lang="$1"
30 shift
31 fi
32 ;;
33 -k|--client-kernel-ver)
34 shift
35 if [ -z "$(echo $1 |grep ^-.)" ]; then
36 # skip the -xx option, in case
37 client_kernel_ver="$1"
38 shift
39 fi
40 ;;
41 -s|--smp)
42 shift; SMP_OPTION="-smp"
43 ;;
44 -*) echo "${0}: ${1}: invalid option" >&2
45 USAGE >& 2
46 exit 2 ;;
47 *) break ;;
48 esac
49 done
50
51 #
52 check_if_root
53
54 #
55 ask_and_load_lang_set $specified_lang
56
57 #
58 echo "$msg_delimiter_star_line"
59 echo "$msg_create_nbi_files"
60 # put and create the kernel and initrd for DRBL clients, this will be done by
61 # mknic-nbi
62 [ -n "$client_kernel_ver" ] && echo "$msg_latest_kernel_for_clients $client_kernel_ver"
63
64 # check if mknic-nbi is installed or not.
65 if ! type mknic-nbi &>/dev/null; then
66 [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
67 echo "$msg_no_drbl_script"
68 [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
69 exit 1
70 fi
71 # create the NBI and PXE image for DRBL clients
72 # modules will be copied when user runs drblpush
73 [ -n "$client_kernel_ver" ] && kernel_opt="--kernel $client_kernel_ver"
74 case "$SMP_OPTION" in
75 "-smp")
76 echo "Running mknic-nbi $kernel_opt --all --smp --no-modules"
77 mknic-nbi $kernel_opt --all --smp --no-modules
78 ;;
79 *)
80 echo "Running mknic-nbi $kernel_opt --all --no-modules"
81 mknic-nbi $kernel_opt --all --no-modules
82 ;;
83 esac
84 echo "$msg_Done!"