/usr/sbin/drbl-client-system-select is in drbl 2.20.11-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | #!/bin/bash
# Steven Shiau <steven@nchc.org.tw>
# License: GPL
# Description: To set the clients show prompt for boot system or not
# Load DRBL setting and functions
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
#
check_if_root
#
usage() {
echo "Usage:"
echo "To set the clients show prompt for boot system or not:"
echo "`basename $0` [OPTION] [on|off]"
echo " Options:"
echo " -t, --time the time to show prompt for boot system (unit: 1/10 sec) "
echo " -e, --enable-thin-client enable the thin client option in PXE boot menu"
echo " -d, --disable-thin-client disable the thin client option in PXE boot menu"
echo "-h, --hosts IP_LIST Instead of all DRBL clients, assign the clients by IP address, like: -h \"192.168.0.1 192.168.0.2\" NOTE!!! You must put \" \" before and after the IP_LIST!"
echo " -v, --verbose prints out verbose information"
}
# Parse command-line options
while [ $# -gt 0 ]; do
case "$1" in
-t|--time)
shift;
if [ -z "$(echo $1 |grep ^-.)" ]; then
# skip the -xx option, in case
timeout="$1"
fi
shift ;;
-e|--enable-thin-client)
shift; thinclient="on"
;;
-d|--disable-thin-client)
shift; thinclient="off"
;;
-h|--hosts)
shift;
LIST_HOST="on"
if [ -z "$(echo $1 |grep ^-.)" ]; then
# skip the -xx option, in case
IP_LIST="$1"
fi
shift ;;
-v|--verbose)
shift; VERBOSE="on"
;;
-*) echo "${0}: ${1}: invalid option" >&2
usage >& 2
exit 2 ;;
*) break ;;
esac
done
# get the switch
switch=$1
[ -z "$switch" ] && usage && exit 0
#
if [ -n "$IP_LIST" ]; then
# copy the skeleton file
PXE_CONF="$PXELINUX_DIR/default_skeleton"
cp -f $PXELINUX_DIR/default $PXE_CONF
else
PXE_CONF="$PXELINUX_DIR/default"
# Clean all the previous saved config file.
# These files maybe look like: 01-MAC address, something like C0A8XXXX (only for 192.168.x), default_skeleton
echo -n "Clean all the previous saved config file if they exist..."
for ifile in $PXELINUX_DIR/*; do
[ "$ifile" != "$PXE_CONF" -a -f "$ifile" ] && rm -f $ifile
done
echo "done!"
fi
#
case "$switch" in
on)
echo -n "Turn on the boot prompt for PXE client..."
[ -z "$timeout" ] && timeout=$DEFAULT_PXE_TIMEOUT
timeout_sub="s/^timeout.*/timeout $timeout/"
[ -n "$VERBOSE" ] && echo "mode = $switch"
[ -n "$VERBOSE" ] && echo "timeout = $timeout"
perl -pi -e "$timeout_sub" $PXE_CONF
# force prompt to always be 0, we need this for simple menu
perl -pi -e 's/^(#|[[:space:]])*prompt.*/prompt 0/i' $PXE_CONF
# reveal some menus
for i in $IMG_SHOW_IN_MENU; do
[ -n "$VERBOSE" ] && echo "Reveal image $i"
hide_reveal_pxe_img $i reveal $PXE_CONF
done
echo "done!"
;;
off)
echo -n "Turn off the boot prompt for PXE client..."
# we just prompt 0.5 sec for that image... the only one image
timeout=5
timeout_sub="s/^timeout.*/timeout $timeout/"
[ -n "$VERBOSE" ] && echo "mode = $switch"
[ -n "$VERBOSE" ] && echo "timeout = $timeout"
perl -pi -e "$timeout_sub" $PXE_CONF
perl -pi -e 's/^prompt.*/prompt 0/' $PXE_CONF
# hide some menus, but at least we will reveal one "drbl", otherwise
# client will have problem "boot: EL entries found in configuration file!"
for i in $IMG_SHOW_IN_MENU; do
if [ "$i" != "drbl" ]; then
[ -n "$VERBOSE" ] && echo "Hide image $i"
hide_reveal_pxe_img $i hide $PXE_CONF
else
[ -n "$VERBOSE" ] && echo "Reveal image $i"
hide_reveal_pxe_img $i reveal $PXE_CONF
fi
done
echo "done!"
;;
esac
case "$thinclient" in
"on")
echo -n "Turn on the thin client option in PXE menu..."
hide_reveal_pxe_img drbl-terminal reveal $PXE_CONF
echo "done!"
;;
"off")
echo -n "Turn off the thin client option in PXE boot menu..."
hide_reveal_pxe_img drbl-terminal hide $PXE_CONF
echo "done!"
;;
esac
# specify the nodes if assigned by user
[ "$LIST_HOST" = "on" ] && set_specific_host_pxe_conf $IP_LIST
|