makedist-recordvm: better check on repository ISO version and added a view only mode

This commit is contained in:
Silvan Calarco 2012-11-29 12:24:13 +01:00
parent 4504980fdc
commit a0111bad1c

View File

@ -45,6 +45,17 @@ ISO_NAME=`basename $ISO_PATH`
exit 1 exit 1
} }
if [ -e $ISO_DIR/latest-is-milestone*.txt ]; then
ISO_VERSION=`ls $ISO_DIR/latest-is-milestone[0-9]*-*.txt 2>/dev/null| sed "s/.*latest-is-milestone[0-9]*-\(.*\)\.txt/\1/"`
elif [ -e $ISO_DIR/latest-is-*.txt ]; then
ISO_VERSION=`ls $ISO_DIR/latest-is-*.txt 2>/dev/null| sed "s/.*latest-is-\(.*\)\.txt/\1/"`
fi
[ "$ISO_VERSION" ] || {
echo "makedist-recordvm: ERROR: unable to find latest version file in $ISO_DIR; running in view mode only."
VIEWMODE=1
}
if [ ! "$RECREATE_IMAGES" ]; then if [ ! "$RECREATE_IMAGES" ]; then
echo "Preparing ISO image $ISO_PATH" echo "Preparing ISO image $ISO_PATH"
ln -sf $ISO_PATH $RECORDVM_DATA/recordvm.iso ln -sf $ISO_PATH $RECORDVM_DATA/recordvm.iso
@ -90,23 +101,17 @@ if [ ! "$RECREATE_IMAGES" ]; then
echo "Windowid is: $WINID" echo "Windowid is: $WINID"
echo "Capturing window output" if [ ! "$VIEWMODE" ]; then
mkdir -p $ISO_DIR/preview/ echo "Capturing window output"
DBUS_SESSION_BUS_ADDRESS= HOME=$RECORDVM_DATA DISPLAY=$VBOX_DISPLAY xvidcap \ mkdir -p $ISO_DIR/preview/
--cap_geometry 1024x768+0+0 \ DBUS_SESSION_BUS_ADDRESS= HOME=$RECORDVM_DATA DISPLAY=$VBOX_DISPLAY xvidcap \
--verbose 2 --gui no --audio no \ --cap_geometry 1024x768+0+0 \
--time $EXECUTION_TIME --file $ISO_DIR/preview/${ISO_NAME}${VIDEO_EXT} \ --verbose 2 --gui no --audio no \
--quality 100 >>$RECORDVM_DATA/recordvm.log --time $EXECUTION_TIME --file $ISO_DIR/preview/${ISO_NAME}${VIDEO_EXT} \
#recordmydesktop --no-frame --display $VBOX_DISPLAY --windowid $WINID -o $ISO_DIR/preview/$ISO_NAME.ogv --overwrite --no-sound --no-wm-check --fps 10 --no-cursor & --quality 100 >>$RECORDVM_DATA/recordvm.log
#echo "Sleeping $EXECUTION_TIME seconds..." else
#sleep $EXECUTION_TIME sleep $EXECUTION_TIME
fi
#killall -TERM recordmydesktop
#echo "Waiting for recordmydesktop to exit"
#while [ "`pidof recordmydesktop`" ]; do
# sleep 1
#done
echo "Powering off VM" echo "Powering off VM"
if [ "$VBOX" ]; then if [ "$VBOX" ]; then
@ -126,30 +131,34 @@ if [ ! "$RECREATE_IMAGES" ]; then
fi fi
fi fi
echo "Creating preview images" if [ ! "$VIEWMODE" ]; then
rm -f $ISO_DIR/preview/*.jpg echo "Creating preview images"
ffmpeg -y -i $ISO_DIR/preview/$ISO_NAME${VIDEO_EXT} -r 0.1 -f image2 $ISO_DIR/preview/image-%02d.jpg >/dev/null rm -f $ISO_DIR/preview/image-*.jpg
for i in `seq 22 -1 1`; do ffmpeg -y -i $ISO_DIR/preview/$ISO_NAME${VIDEO_EXT} -r 0.1 -f image2 $ISO_DIR/preview/image-%02d.jpg >/dev/null
f=`printf %02d $i` for i in `seq 22 -1 1`; do
[ -e $ISO_DIR/preview/image-$f.jpg ] && { f=`printf %02d $i`
convert -resize 320x200 $ISO_DIR/preview/image-$f.jpg $ISO_DIR/preview/preview.jpg [ -e $ISO_DIR/preview/image-$f.jpg ] && {
convert -resize 400x300 $ISO_DIR/preview/image-$f.jpg $ISO_DIR/preview/preview-400x300.jpg convert -resize 320x200 $ISO_DIR/preview/image-$f.jpg $ISO_DIR/preview/preview-$ISO_VERSION.jpg
break ln -sf preview-$ISO_VERSION.jpg $ISO_DIR/preview/preview.jpg
} convert -resize 400x300 $ISO_DIR/preview/image-$f.jpg $ISO_DIR/preview/preview-$ISO_VERSION-400x300.jpg
done ln -sf preview-$ISO_VERSION-400x300.jpg $ISO_DIR/preview/preview-400x300.jpg
break
}
done
if [ ! "$RECREATE_IMAGES" ]; then if [ ! "$RECREATE_IMAGES" ]; then
echo "Creating ${VIDEO_EXT2} video from ${VIDEO_EXT}" echo "Creating ${VIDEO_EXT2} video from ${VIDEO_EXT}"
#ffmpeg -y -i $ISO_DIR/preview/$ISO_NAME${VIDEO_EXT} $ISO_DIR/preview/$ISO_NAME${VIDEO_EXT2} >/dev/null #ffmpeg -y -i $ISO_DIR/preview/$ISO_NAME${VIDEO_EXT} $ISO_DIR/preview/$ISO_NAME${VIDEO_EXT2} >/dev/null
ffmpeg2theora -y -i $ISO_DIR/preview/$ISO_NAME${VIDEO_EXT} $ISO_DIR/preview/$ISO_NAME${VIDEO_EXT2} >/dev/null ffmpeg2theora -y -i $ISO_DIR/preview/$ISO_NAME${VIDEO_EXT} $ISO_DIR/preview/$ISO_NAME${VIDEO_EXT2} >/dev/null
#cleanup old files #cleanup old files
for f in `ls $ISO_DIR/preview/*${VIDEO_EXT}`; do for f in `ls $ISO_DIR/preview/*${VIDEO_EXT}`; do
[ "$f" = "$ISO_DIR/preview/$ISO_NAME${VIDEO_EXT}" ] || rm -f $f [ "$f" = "$ISO_DIR/preview/$ISO_NAME${VIDEO_EXT}" ] || rm -f $f
done done
for f in `ls $ISO_DIR/preview/*${VIDEO_EXT2}`; do for f in `ls $ISO_DIR/preview/*${VIDEO_EXT2}`; do
[ "$f" = "$ISO_DIR/preview/$ISO_NAME${VIDEO_EXT2}" ] || rm -f $f [ "$f" = "$ISO_DIR/preview/$ISO_NAME${VIDEO_EXT2}" ] || rm -f $f
done done
fi
fi fi
echo "Done." echo "Done."