File: ocs-live

package info (click to toggle)
clonezilla 5.14.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,168 kB
  • sloc: sh: 41,203; perl: 193; python: 59; makefile: 26
file content (102 lines) | stat: -rwxr-xr-x 2,852 bytes parent folder | download | duplicates (3)
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
#!/bin/bash
# License: GPL 
# Author: Steven Shiau <steven _at_ clonezilla org>

# Load DRBL setting and functions
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 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

#
USAGE() {
    echo "Usage:"
    echo "To run clonezilla live:"
    echo "$ocs [OPTION]"
    echo " Options:"
    language_help_prompt_by_idx_no
    echo " -p, --postaction [choose|poweroff|reboot|command|CMD]     When save/restoration finishs, choose action in the client, poweroff, reboot (default), in command prompt or run CMD"
    echo " -s, --skip-ocs-prep-repo  Skip preparing the clonezilla image home directory (assume it's ready)."
}
#
start-ocs-prep-repo() {
  ocs-prep-repo $lang_opt
  rc="$?"
  if [ "$rc" -gt 0 ]; then
    [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
    echo "$msg_unable_to_mnt_ocsroot."
    echo "$msg_are_u_sure_u_want_to_continue"
    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
    echo -n "[y/N] "
    read continue_without_mnt
    case "$continue_without_mnt" in
      y|Y|[yY][eE][sS])
         echo "$msg_ok_let_do_it"
         ;;
      *)
         echo "$msg_program_stop"
         exit 1
         ;;
    esac
  fi
} # end of start-ocs-prep-repo
#
check_if_root

# default setting
do_prep_ocsroot="yes"
#
while [ $# -gt 0 ]; do
  case "$1" in
    -l|--language)
            shift
            if [ -z "$(echo $1 |grep ^-.)" ]; then
              # skip the -xx option, in case 
	      ocs_lang="$1"
              shift
            fi
	    [ -z "$ocs_lang" ] && USAGE && exit 1
	    ;;
    -p|--postaction)  
            shift
            if [ -z "$(echo $1 |grep ^-.)" ]; then
              # skip the -xx option, in case 
	      postaction="$1"
              shift
            fi
	    [ -z "$postaction" ] && USAGE && exit 1
            ;;
    -s|--skip-ocs-prep-repo)  
            shift
            if [ -z "$(echo $1 |grep ^-.)" ]; then
              # skip the -xx option, in case 
	      do_prep_ocsroot="no"
              shift
            fi
	    [ -z "$do_prep_ocsroot" ] && USAGE && exit 1
            ;;
    -*)     echo "${0}: ${1}: invalid option" >&2
            USAGE >& 2
            exit 2 ;;
    *)      break ;;
  esac
done

# ocs_lang is loaded from /etc/ocs/ocs-live.conf
[ -z "$ocs_lang" ] && ocs_lang=en_US
ask_and_load_lang_set $ocs_lang
[ -n "$ocs_lang" ] && lang_opt="-l $ocs_lang"
[ -n "$postaction" ] && postaction_opt="-p $postaction"
# 1. ocs-prep-repo
if [ "$do_prep_ocsroot" = "yes" ]; then
  start-ocs-prep-repo
fi

# 2. ocs-sr -x
ocs-sr -x $lang_opt $postaction_opt
rc=$?
exit $rc