This file is indexed.

/usr/share/drbl/samples/custom-ocs is in clonezilla 3.21.13-1.

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
#!/bin/bash
# Author: Steven Shiau <steven _at_ nchc org tw>
# License: GPL
# Ref: http://sourceforge.net/forum/forum.php?thread_id=1759263&forum_id=394751
# In this example, it will allow your user to use clonezilla live to choose 
# (1) backup the image of /dev/hda1 (or /dev/sda1) to /dev/hda5 (or /dev/sda5)
# (2) restore image in /dev/hda5 (or /dev/sda5) to /dev/hda1 (or /dev/sda1)

# When this script is ready, you can run
# ocs-iso -g en_US.UTF-8 -k NONE -s -m ./custom-ocs
# to create the iso file for CD/DVD. or
# ocs-live-dev -g en_US.UTF-8 -k NONE -s -c -m ./custom-ocs
# to create the zip file for USB flash drive.

# Begin of the scripts:
# 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 setting for clonezilla live.
[ -e /etc/ocs/ocs-live.conf ] && . /etc/ocs/ocs-live.conf
# Load language files. For English, use "en_US.UTF-8".
ask_and_load_lang_set en_US.UTF-8

# The above is almost necessary, it is recommended to include them in your own custom-ocs.
# From here, you can write your own scripts.

# functions
decide_sda_or_hda() {
  if [ -n "$(grep -Ew sda1 /proc/partitions)" -a -n "$(grep -Ew sda5 /proc/partitions)" ]; then
   disk=sda
  elif [ -n "$(grep -Ew hda1 /proc/partitions)" -a -n "$(grep -Ew hda5 /proc/partitions)" ]; then
   disk=hda
  else
    [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
    echo "/dev/hda1 and /dev/hda5 do not exist or /dev/sda1 and /dev/sda5 do not exist!"
    echo "Program terminated!"
    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  fi
  # src_part: hda1 or sda1, tgt_part: hda5 or sda5
  src_part=${disk}1
  tgt_part=${disk}5
}
action_backup() {
  mkdir -p $ocsroot
  part_fs="$(LANG=C ocs-get-part-info /dev/$tgt_part filesystem)"
  case "$part_fs" in
    ntfs) ntfs-3g /dev/$tgt_part $ocsroot 
          RETV=$? ;;
    *) mount /dev/$tgt_part $ocsroot
       RETV=$? ;;
  esac
  if [ "$RETV" -eq 0 ]; then
    # If you want to run it in batch mode, add option "-b" in the ocs-sr command
    # For more options about ocs-sr, run "ocs-sr -h"
    ocs-sr -q2 -c -j2 -z1p -i 2000 -p true saveparts "backup" "$src_part"
  else
    [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
    echo "Fail to mount /dev/$tgt_part as $ocsroot!"
    echo "Program terminated!"
    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  fi
  umount $ocsroot &>/dev/null
}
 
action_restore() {
  mkdir -p $ocsroot
  if ! mountpoint $ocsroot &>/dev/null; then
    part_fs="$(LANG=C ocs-get-part-info /dev/$tgt_part filesystem)"
    case "$part_fs" in
      ntfs) ntfs-3g /dev/$tgt_part $ocsroot ;;
      *) mount /dev/$tgt_part $ocsroot ;;
    esac
  fi
  if mountpoint $ocsroot &>/dev/null; then
    # If you want to run it in batch mode, add option "-b" in the ocs-sr command
    # For more options about ocs-sr, run "ocs-sr -h"
    ocs-sr -e1 auto -e2 -c -r --no-fdisk --no-restore-mbr -p true restoreparts "backup" "$src_part"
  else
    [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
    echo "Fail to mount /dev/$tgt_part as $ocsroot!"
    echo "Program terminated!"
    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  fi
  umount $ocsroot &>/dev/null
} 

##################
###### MAIN ######
##################
# Find the device and partition
decide_sda_or_hda

TMP="$(mktemp /tmp/menu.XXXXXX)"
trap "[ -f "$TMP" ] && rm -f $TMP" HUP INT QUIT TERM EXIT
$DIA --backtitle "$msg_nchc_free_software_labs" --title  \
"$msg_nchc_clonezilla" --menu "$msg_choose_mode:" \
0 0 0 \
"Backup"  "Backup $src_part to $tgt_part" \
"Restore" "Restore the image in $tgt_part to $src_part" \
2> $TMP
mode="$(cat $TMP)"
[ -f "$TMP" ] && rm -f $TMP

#
case "$mode" in
  Backup)
    action_backup;;
  Restore)
    action_restore;;
  *)
    [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
    echo "Program terminated!"
    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
    exit 1
esac