20 |
# # |
# # |
21 |
############################################################################## |
############################################################################## |
22 |
# DEBUG=true |
# DEBUG=true |
23 |
versionNumber='0.1' |
versionNumber='0.2' |
24 |
|
|
25 |
function readImage(){ |
function readImage(){ |
26 |
# set -x |
# set -x |
33 |
} |
} |
34 |
img[$count]="$(basename "$tmp")" |
img[$count]="$(basename "$tmp")" |
35 |
|
|
36 |
|
|
37 |
|
sizeInDisk[$count]=`du -hc "$(dirname "$n")" | sed -e '$!d' -e 's|[ \t].*||'`B |
38 |
|
diskModel[$count]="Disk "`head -n 1 "$(dirname "$n")"/*parted` |
39 |
[ -r "$(dirname "$n")"/disk ] && { |
[ -r "$(dirname "$n")"/disk ] && { |
40 |
hasDisk=1 |
hasDisk=1 |
41 |
type[$count]=disk |
type[$count]=disk |
44 |
partCount=$(cat "$(dirname "$n")"/parts | awk '{print NF}') |
partCount=$(cat "$(dirname "$n")"/parts | awk '{print NF}') |
45 |
tmp=$(dirname "$n") |
tmp=$(dirname "$n") |
46 |
diskSizeFromImage[$count]=$(getDiskSizeFromImage "$tmp") |
diskSizeFromImage[$count]=$(getDiskSizeFromImage "$tmp") |
47 |
id[$count]="Image: ${img[$count]}, ${type[$count]}: ${activeItem[$count]}"", size: ${diskSizeFromImage[$count]}, parts: $partCount" |
if [ -z "$EXTENDED" ];then |
48 |
|
id[$count]="Image: ${img[$count]}, ${type[$count]}: ${activeItem[$count]}"", size: ${diskSizeFromImage[$count]}, parts: $partCount" |
49 |
|
else |
50 |
|
id[$count]="Image: ${img[$count]}, image size: ${sizeInDisk[$count]}, ${type[$count]}: ${activeItem[$count]}"", size: ${diskSizeFromImage[$count]}, parts: $partCount, ${diskModel[$count]}" |
51 |
|
fi |
52 |
# scan parts |
# scan parts |
53 |
pCount=1 |
pCount=1 |
54 |
tmpImg="${img[$count]}" |
tmpImg="${img[$count]}" |
70 |
calcInputSize /"$tmp" "${activeItem[$count]}" |
calcInputSize /"$tmp" "${activeItem[$count]}" |
71 |
imagePartitionSize[$count]="$THIS_INPUT_SIZE" |
imagePartitionSize[$count]="$THIS_INPUT_SIZE" |
72 |
partitionIdName[$count]=$(getPartitionIdNameFromImage "$tmp" "${activeItem[$count]}") |
partitionIdName[$count]=$(getPartitionIdNameFromImage "$tmp" "${activeItem[$count]}") |
73 |
id[$count]="Image: ${img[$count]}, ${type[$count]}: ${activeItem[$count]}, size: ${imagePartitionSize[$count]}, type: ${partitionIdName[$count]}" |
if [ -z "$EXTENDED" ];then |
74 |
|
id[$count]="Image: ${img[$count]}, ${type[$count]}: ${activeItem[$count]}, size: ${imagePartitionSize[$count]}, type: ${partitionIdName[$count]}" |
75 |
|
else |
76 |
|
id[$count]="Image: ${img[$count]}, image size: ${sizeInDisk[$count]}, ${type[$count]}: ${activeItem[$count]}, size: ${imagePartitionSize[$count]}, type: ${partitionIdName[$count]}, ${diskModel[$count]}" |
77 |
|
fi |
78 |
} |
} |
79 |
imgCount="$count" |
imgCount="$count" |
80 |
((count++)) |
((count++)) |
254 |
|
|
255 |
function printVersion(){ |
function printVersion(){ |
256 |
echo "Clonezilla Live Image Information |
echo "Clonezilla Live Image Information |
257 |
$(basename $0) v. $versionNumber - (C) 2009 S. Georgaras <sng@hellug.gr> |
$(basename $0) v. $versionNumber - (C) 2009-2010 S. Georgaras <sng@hellug.gr> |
258 |
" |
" |
259 |
} |
} |
260 |
|
|
265 |
Available options: |
Available options: |
266 |
s Search in sub-directories too |
s Search in sub-directories too |
267 |
i [name] Pring info for image [name] |
i [name] Pring info for image [name] |
268 |
|
e Print extended info (image size and disk model) |
269 |
v Print version info and exit |
v Print version info and exit |
270 |
h Print this screen and exit" |
h Print this screen and exit" |
271 |
|
|
277 |
# |
# |
278 |
# |
# |
279 |
# set -x |
# set -x |
280 |
while getopts hvdsi: opt |
while getopts hvdsei: opt |
281 |
do |
do |
282 |
case "$opt" in |
case "$opt" in |
283 |
i) |
i) |
299 |
h) |
h) |
300 |
printHelp |
printHelp |
301 |
exit;; |
exit;; |
302 |
|
e) |
303 |
|
EXTENDED=y;; |
304 |
esac |
esac |
305 |
done |
done |
306 |
shift $(( OPTIND - 1 )) |
shift $(( OPTIND - 1 )) |