Debian Codegraph @

scripts/sbin/set-default-grub-efi-img

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # Author: Steven Shiau <steven _at_ clonezilla org>
3 # License: GPL
4 # Description: set the default grub efi image for grub menu format.
5
6 # Load DRBL setting and functions
7 DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
8
9 . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
10
11 #
12 GRUB_CONF_DEF="$GRUB_EFINB_DIR/grub.cfg"
13
14 #
15 USAGEscip-shell shell shell-project 0.0.0 USAGE().() {
16 echoscip-shell system . . echo. "Usage:"
17 echoscip-shell system . . echo. "To set the default GRUB client menu:"
18 echoscip-shell system . . echo. "`basenamescip-shell system . . basename. $0` [OPTION] ENTRY_ID"
19 echoscip-shell system . . echo. " Options:"
20 echoscip-shell system . . echo. " -i, --entry-id ENTRY_ID Set ENTRY_ID as the default one"
21 echoscip-shell system . . echo. " -c, --config CONF Use the CONF file instead of default one ($GRUB_CONF_DEF)"
22 echoscip-shell system . . echo. " -l, --label LABEL Assign the menuentry LABEL description"
23 echoscip-shell system . . echo. " -v, --verbose Show verbose messages"
24 echoscip-shell system . . echo. " -h, --help Display this help and exit"
25 echoscip-shell system . . echo. "ENTRY_ID is the menuentry ID"
26 echoscip-shell system . . echo. "Ex:"
27 echoscip-shell system . . echo. "To set the default menuentry as \"drbl-client\" without updating the menuentry label"
28 echoscip-shell system . . echo. " $ocs -i drbl-client"
29 echoscip-shell system . . echo. "To set the default menuentry as \"clonezilla-se-client\" and update the menuentry label as \"Clonezilla: multicast restore precise-x86 to disk sda\""
30 echoscip-shell system . . echo. " $ocs -i clonezilla-se-client -l \"Clonezilla: multicast restore precise-x86 to disk sda\""
31 echoscip-shell system . . echo.
32 }
33
34 ####################
35 ### Main program ###
36 ####################
37
38 ocs_file="$0"
39 ocs=`basenamescip-shell system . . basename. $ocs_file`
40 #
41 # Parse command-line options
42 while [scip-shell system . . `[`. $# -gt 0 ]; do
43 case "$1" in
44 -i|--entry-id)
45 shift;
46 # skip the -xx option, in case
47 if [scip-shell system . . `[`. -z "$(echoscip-shell system . . echo. $1 |grepscip-shell system . . grep. ^-.)" ]; then
48 entry_id="$1"
49 shift
50 fi
51 [scip-shell system . . `[`. -z "$entry_id" ] && USAGEscip-shell shell shell-project 0.0.0 USAGE(). && exit 1
52 ;;
53 -c|--config)
54 shift;
55 # skip the -xx option, in case
56 if [scip-shell system . . `[`. -z "$(echoscip-shell system . . echo. $1 |grepscip-shell system . . grep. ^-.)" ]; then
57 GRUB_CONF="$1"
58 shift
59 fi
60 [scip-shell system . . `[`. -z "$GRUB_CONF" ] && USAGEscip-shell shell shell-project 0.0.0 USAGE(). && exit 1
61 ;;
62 -h|--help)
63 USAGEscip-shell shell shell-project 0.0.0 USAGE(). >& 2
64 exit 2 ;;
65 -l|--label)
66 shift;
67 # skip the -xx option, in case
68 if [scip-shell system . . `[`. -z "$(echoscip-shell system . . echo. $1 |grepscip-shell system . . grep. ^-.)" ]; then
69 ENTRY_LABEL="$1"
70 shift
71 fi
72 [scip-shell system . . `[`. -z "$ENTRY_LABEL" ] && USAGEscip-shell shell shell-project 0.0.0 USAGE(). && exit 1
73 ;;
74 -v|--verbose)
75 VERBOSE="on"
76 shift;;
77 -*) echoscip-shell system . . echo. "${0}: ${1}: invalid option" >&2
78 USAGEscip-shell shell shell-project 0.0.0 USAGE(). >& 2
79 exit 2 ;;
80 *) break ;;
81 esac
82 done
83
84 [scip-shell system . . `[`. -z "$GRUB_CONF" ] && GRUB_CONF=$GRUB_CONF_DEF
85 if [scip-shell system . . `[`. -z "$entry_id" ]; then
86 [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
87 echoscip-shell system . . echo. "You must specify the entry ID! Program terminated!!!"
88 [scip-shell system . . `[`. "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
89 USAGEscip-shell shell shell-project 0.0.0 USAGE().
90 exit 1
91 fi
92 # Enable it first
93 hide_reveal_grub_efi_ent "$entry_id" reveal $GRUB_CONF
94
95 # Set default one
96 sub_default_grub_efi_img "$entry_id" $GRUB_CONF "$ENTRY_LABEL"