/usr/sbin/ocs-srv-live is in clonezilla 3.10.11-3.
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 | #!/bin/bash
# Author: Steven Shiau <steven _at_ nchc org tw>
# License: GPL
# Description: Program to start Clonezilla SE on DRBL live.
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
. /etc/drbl/drbl-ocs.conf
. $DRBL_SCRIPT_PATH/sbin/ocs-functions
# Load the config in ocs-live.conf. This is specially for DRBL/Clonezilla live. It will overwrite some settings of /etc/drbl/drbl-ocs.conf, such as $DIA...
[ -e "/etc/ocs/ocs-live.conf" ] && . /etc/ocs/ocs-live.conf
# Settings
# try IP from 192.168."100".254
private_IP_alias_eth_def="100"
# functions
USAGE() {
echo "To start, restart or stop Clonezilla server edition service in DRBL Live environment."
echo "Usage:"
echo "$0 {start|stop|restart} [MODE]"
echo "start Start Clonezilla server edition service now"
echo "stop Stop Clonezilla server edition service service now"
echo "restart Restart Clonezilla server edition service service now"
echo "MODE could be one of the following:"
echo "save-disk: Clonezilla save disk mode"
echo "restore-disk: Clonezilla restore disk Mode"
echo "save-parts: Clonezilla save partitions mode"
echo "restore-parts: Clonezilla restore partitions mode"
echo "select-in-client: Select mode in client"
echo "Example: To start Clonezilla server edition service service in this DRBL Live server"
echo "$0 start"
}
#
start_ocs_srv() {
# start drbl live first, which will setup drbl environment
echo "Checking if DRBL related sevices are started or not..."
# dhcpd is for isc-dhcp-server (from Squeeze), dhcpd3 is for dhcp3-server (< squeeze).
dhcpd_pid="$(LC_ALL=C pidof dhcpd || LC_ALL=C pidof dhcpd3)"
tftpd_pid="$(LC_ALL=C pidof in.tftpd)"
unfsd_pid="$(LC_ALL=C pidof unfsd)"
nfsd_pid="$(LC_ALL=C pidof nfsd)"
if [ -z "$dhcpd_pid" -o -z "$tftpd_pid" ] || [ -z "$unfsd_pid" -a -z "$nfsd_pid" ]; then
# Not configured yet or DRBL service is not started, either
if [ "$ocs_batch_mode" = "on" ]; then
echo "$msg_delimiter_star_line"
echo "$msg_drbl_env_is_not_ready_now_config"
echo $msg_this_might_take_several_minutes
echo -n $msg_press_enter_to_continue
read
echo "$msg_delimiter_star_line"
fi
# Check if $ocsroot is a mountpoint or not, if not, we have to mount it.
prepare_ocsroot_opt=""
if ! mountpoint $ocsroot &>/dev/null; then
echo "Directory $ocsroot is not a mount point. Will try to mount $ocsroot..."
prepare_ocsroot_opt="--prepare-ocsroot"
fi
drbl-live $prepare_ocsroot_opt --skip-pause-in-the-end --no-prompt-drbl-live start
else
# DRBL service has been started. Therefore for Clonezilla SE we need to mount $ocsroot
# Check if $ocsroot is a mountpoint or not, if not, we have to mount it.
if ! mountpoint $ocsroot &>/dev/null; then
echo "Directory $ocsroot is not a mount point. Will try to mount $ocsroot..."
prep-ocsroot
fi
fi
# disable the DRBL in pxelinux menu
hide_reveal_pxe_img drbl hide $pxecfg_pd/pxelinux.cfg/default
# set local as default
set-default-pxe-img -i local -c $pxecfg_pd/pxelinux.cfg/default
echo "$msg_delimiter_star_line"
echo "$msg_drbl_env_is_ready"
echo "$msg_delimiter_star_line"
sleep 1
dcs clonezilla-start $mode
echo "$msg_delimiter_star_line"
[ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
if [ "$ocs_prompt_mode" = "tui" ]; then
$DIA --title "$msg_nchc_free_software_labs" --clear \
--msgbox "$msg_do_not_close_window_until_clone_finish" 0 0
else
echo -e "$msg_do_not_close_window_until_clone_finish"
fi
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
/bin/bash
} # end of start_ocs_srv
#
stop_ocs_srv() {
drbl-ocs stop
echo "$msg_delimiter_star_line"
echo -n $msg_press_enter_to_continue
read < /dev/stdin
} # end of stop_ocs_srv
#################
##### MAIN ######
#################
check_if_root
#
ask_and_load_lang_set
switch="$1"
mode="$2"
#
if [ -z "$switch" ]; then
USAGE
exit 1
fi
#
if ! is_boot_from_live; then
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
echo "This command $0 is used in DRBL Live environment only!"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo "$msg_program_stop"
exit 1
fi
case "$switch" in
"start"|"restart") start_ocs_srv ;;
"stop") stop_ocs_srv ;;
esac
|