File build.sh of Package Image-Acer

#!/bin/bash -x

# set variables which are used in this script and in do_it.sh
set -a
IMAGE_DIR=/data/image
PHYS_DIR=/data
RESCUE_DVD_SCRIPT_DIR=/home/gekker/src/preload/trunk/rescue-dvd/rescue-dvd-script
RESCUE_DIR=/data/rescue
set +a

# cleanup physical extension
echo "Cleanup physical extension..."
rm -rf $PHYS_DIR/phys
rm -f $PHYS_DIR/phys.*.sc*
rm -f $PHYS_DIR/phys.log_run*

# create physical extension
echo "Creating physical extension..."
if ( ! kiwi -p . -r $PHYS_DIR/phys ) ; then
    echo "    Image preparation failed!\n"
    exit;
fi

# save log from creation of the physical extension
echo "Saving log to phys.log_run_1 ..."
mv $PHYS_DIR/phys.log $PHYS_DIR/phys.log_run_1

# removed old images
echo "Removing old images... (background)"
rm -f $IMAGE_DIR/*.BCK &
rm -f $IMAGE_DIR/suse*.raw.gz &

# create (raw) kiwi image
echo "Creating image"
if ( ! kiwi -c $PHYS_DIR/phys -d $IMAGE_DIR/ ); then
    echo "    Image creation failed!\n"
    exit;
fi

# save log from creation of image
echo "Saving log to phys.log_run_2 ..."
mv $PHYS_DIR/phys.log $PHYS_DIR/phys.log_run_2

# create md5 checksum and compress the image
(
	cd $IMAGE_DIR
	IMAGE=`ls *raw`

	echo "Creating md5-sum..."
	md5sum $IMAGE > ${IMAGE}.md5

	echo "Using pigz to gzip the raw image..."
	pigz -c $IMAGE > ${IMAGE}.gz

	echo "Saving the raw image..."
	mv $IMAGE ${IMAGE}.BCK
)

# exec do_it.sh from rescue-dvd-script
echo "Starting the iso creation in 10sec ..."
sleep 10

cd $RESCUE_DVD_SCRIPT_DIR
./do_it.sh
openSUSE Build Service is sponsored by