2011-04-26 13:21:24 +02:00
|
|
|
#!/bin/bash
|
|
|
|
VERSION=0.2
|
|
|
|
MOUNTPATH="/cdrom"
|
|
|
|
CHECKFILE=/LiveOS/squashfs.img
|
|
|
|
MD5FILE=/LiveOS/squashfs.img.MD5
|
|
|
|
TEXTDOMAIN=installer
|
|
|
|
TEXTDOMAINDIR=/opt/kde3/share/locale/
|
|
|
|
|
|
|
|
[ -e $MOUNTPATH/$CHECKFILE ] || {
|
|
|
|
# this is only intended for debugging reason in development environment
|
|
|
|
MOUNTPATH="/media/openmamba livecd"
|
|
|
|
}
|
|
|
|
|
|
|
|
function progress_parser() {
|
|
|
|
while read -d "left" line; do
|
2013-04-14 19:50:39 +02:00
|
|
|
line=${line/*$CHECKFILE /}
|
2011-04-26 13:21:24 +02:00
|
|
|
line=${line/MB done*/}
|
|
|
|
elapsed=${line/MB*/}
|
|
|
|
total=${line/* of /}
|
|
|
|
percent=`expr \( $elapsed \* 100 \) \/ $total`
|
|
|
|
dcop $DCOPID KommanderIf setText md5ProgressBar $percent || exit 1
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
DCOPID=$1
|
|
|
|
|
|
|
|
echo $"\
|
|
|
|
openmamba md5 media check - version $VERSION
|
|
|
|
Copyright (c) 2007-2010 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
|
|
|
"
|
|
|
|
|
|
|
|
[ $DCOPID ] || {
|
|
|
|
echo $"Error: this program must be launched by mamba installer; aborting."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ -e "$MOUNTPATH/$CHECKFILE" -a -e "$MOUNTPATH/$MD5FILE" ]; then
|
|
|
|
|
|
|
|
md5check=`cat "$MOUNTPATH/$MD5FILE" | sed "s|\([[:alnum:]]*\).*|\1|"`
|
|
|
|
tmpfile=`tempfile 2>/dev/null` || tmpfile="/tmp/md5progress"
|
2013-04-14 19:50:39 +02:00
|
|
|
md5deep -e "$MOUNTPATH/$CHECKFILE" 2>&1 1>$tmpfile| progress_parser
|
2011-04-26 13:21:24 +02:00
|
|
|
md5calc=`cat $tmpfile | sed "s|[^[:alnum:]]*\([[:alnum:]]*\).*|\1|g"`
|
|
|
|
rm -f $tmpfile
|
|
|
|
|
|
|
|
[ $md5calc = $md5check ] && {
|
|
|
|
dcop $DCOPID KommanderIf setText integrityCheckLabel $"Medium check OK. Press next to proceed with installation."
|
|
|
|
dcop $DCOPID KommanderIf setEnabled next true
|
|
|
|
} || dcop $DCOPID KommanderIf setText integrityCheckLabel $"<font color=red>ERROR: medium has errors; please try with another medium.</font>"
|
|
|
|
|
|
|
|
else
|
|
|
|
dcop $DCOPID KommanderIf setText integrityCheckLabel $"<font color=red>ERROR: this program must be run from live medium.</font>"
|
|
|
|
fi
|
|
|
|
|
|
|
|
dcop $DCOPID KommanderIf setVisible md5ProgressBar false
|
|
|
|
dcop $DCOPID KommanderIf setVisible skipButton false
|
|
|
|
|
|
|
|
exit 0
|