This file is indexed.

/usr/sbin/ocs-match-checksum is in clonezilla 3.27.16-2.

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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/bin/bash
# License: GPL 
# Author: Steven Shiau <steven _at_ stevenshiau org>
# Description: Program to inspect the checksum in the image and the files in the block device

#
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

# Settings
ocs_parallel_mode="no"

#
USAGE() {
    echo "$ocs - To inspect the checksum in the image and the files in the block device"
    echo "Usage:"
    echo "To run $ocs:"
    echo "$ocs IMAGE DEVICE"
    echo "Options:"
    echo "-p, --parallel  Run the checksum inspection in parallel. The inspection for all partitions in a disk will be run in parallel. Maybe it's not a good idea if too many partitions and it might casue too many I/Os then less effiency."
    echo "IMAGE is the image name, e.g. Debian-Jessie. It must be saved by the option -gmf"
    echo "Device is the block device name. It can be a disk name or partition name, e.g. sda, sdc1"
    echo "Ex:"
    echo "To inspect the checksum in the image \"Debian-Jessie\" with the external disk \"/dev/sdc\", run"
    echo "   $ocs Debian-Jessie /dev/sdc"
    echo
} # end of USAGE
#

####################
### Main program ###
####################

ocs_file="$0"
ocs=`basename $ocs_file`
#
while [ $# -gt 0 ]; do
 case "$1" in
   -p|--parallel) ocs_parallel_mode="yes"; shift;;
   -*)     echo "${0}: ${1}: invalid option" >&2
           USAGE >& 2
           exit 2 ;;
   *)      break ;;
 esac
done

ocs_chk_img_name="$1"
shift
ocs_chk_dev="$*"

#
check_if_root
ask_and_load_lang_set

#
# imagedir is a variable which ask_user related function need
imagedir="$ocsroot"
[ -z "$ocs_chk_img_name" ] && ocs_chk_img_name="ask_user"
[ -z "$ocs_chk_dev" ] && ocs_chk_dev="ask_user"
if [ "$ocs_chk_img_name" = "ask_user" ]; then
  get_target_dir_name_when_checking_img_checksum # output: target_dir
  ocs_chk_img_name="$target_dir"
fi
[ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
echo "$msg_the_image_to_be_cheked: $ocs_chk_img_name"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL

if [ "$ocs_chk_dev" = "ask_user" ]; then
  # To get $target_hd
  get_target_hd_name_from_local_machine "$msg_local_source_disk_for_checksum_inspect \n$msg_linux_disk_naming $msg_press_space_to_mark_selection"
  ocs_chk_dev="$(select_VG "$target_hd")"
elif [ "$ocs_chk_dev" = "all" ]; then
  get_not_busy_disks_or_parts harddisk "" ""  # we will get dev_list
  ocs_chk_dev="$dev_list"
fi
# check if the device exists
ANS_TMP=`mktemp /tmp/ocs_chkdev.XXXXXX`
trap "[ -f "$ANS_TMP" ] && rm -f $ANS_TMP" HUP INT QUIT TERM EXIT
check_if_input_device_exist $ANS_TMP $ocs_chk_dev 
ocs_chk_dev="$(cat $ANS_TMP | tr -d \")"
[ -f "$ANS_TMP" ] && rm -f $ANS_TMP

#
if [ -z "$ocs_chk_img_name" ]; then
  [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
  echo "No image name is assigned!"
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo "$msg_program_stop!"
  exit 1
fi
if [ ! -d "$ocsroot/$ocs_chk_img_name" ]; then
  [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
  echo "Image $ocs_chk_img_name not found in $ocsroot!"
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo "$msg_program_stop!"
  exit 1
fi
if [ -z "$ocs_chk_dev" ]; then
  [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
  echo "No destination device is assigned!"
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo "$msg_program_stop!"
  exit 1
fi
# Check if the block device exists
for idev in $ocs_chk_dev; do
  if [ ! -b "/dev/$idev" ]; then
    [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
    echo "This block device was not found: $idev"
    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
    echo "$msg_program_stop!"
    exit 1
  fi
done

#
case "$ocs_parallel_mode" in
  yes) go_bg="&";;
  *)   go_bg="";;
esac
  

#
src_disk="$(cat $ocsroot/$ocs_chk_img_name/disk)"

#
target_disks=""
target_parts=""
# Check if ocs_chk_dev a disk or partition
for idev in $ocs_chk_dev; do
  if is_whole_disk $idev; then
    # Disk
    # Get all the partitions
    BACKUP_DEVS=""
    echo "Searching for data partition(s)..." | tee -a /var/log/${ocs}-${idev}.log
    get_known_partition_proc_format $idev data
    target_parts="$BACKUP_DEVS"
    if [ "$idev" != "$src_disk" ]; then
      create-ocs-tmp-img -t /tmp $ocs_chk_img_name ${ocs_chk_img_name}_cnvt_${idev} $src_disk ${idev} | tee -a /var/log/${ocs}-${idev}.log
      target_dir_fullpath="/tmp/${ocs_chk_img_name}_cnvt_${idev}"
    else
      target_dir_fullpath="$ocsroot/$ocs_chk_img_name"
    fi
    for ipartition in $target_parts; do
      echo $msg_delimiter_star_line | tee -a /var/log/${ocs}-${idev}.log
      inspect_cmd="inspect_chksum_for_files_in_dev /dev/$ipartition "$target_dir_fullpath" |  tee -a /var/log/${ocs}-${idev}.log $go_bg"
      eval $inspect_cmd
      echo $msg_delimiter_star_line | tee -a /var/log/${ocs}-${idev}.log
    done
  else
    # Partition
    thd_tmp="$(get_diskname $idev)"
    if [ "$thd_tmp" != "$src_disk" ]; then
      create-ocs-tmp-img -t /tmp $ocs_chk_img_name ${ocs_chk_img_name}_cnvt_${thd_tmp} $src_disk ${thd_tmp} | tee -a /var/log/${ocs}-${idev}.log
      target_dir_fullpath="/tmp/${ocs_chk_img_name}_cnvt_${thd_tmp}"
    else
      target_dir_fullpath="$ocsroot/$ocs_chk_img_name"
    fi
    echo $msg_delimiter_star_line | tee -a /var/log/${ocs}-${idev}.log
    inspect_chksum_for_files_in_dev /dev/$idev "$target_dir_fullpath" | tee -a /var/log/${ocs}-${idev}.log &
    echo $msg_delimiter_star_line | tee -a /var/log/${ocs}-${idev}.log
  fi
done

# wait for all processes to finish before exit
wait 

# Clean the temp dir.
for i in $target_disks; do
  if [ -e "/tmp/${image_name}_cnvt_${i}/converted-not-portable" ]; then
    rm -f /tmp/${image_name}_cnvt_${i}/*
    rmdir /tmp/${image_name}_cnvt_${i}
  fi
done
my_ocs_exit 1