#!/bin/bash # build the iso . config || exit 0 if [ "$1" != "ok" ]; then if [ -e ${ISO} ] || [ -e ${FS} ]; then echo "remove \"${ISO}\" and \"${FS}\" dirs first," echo "or pass \"ok\" as an argument to remove them" exit 0 fi fi set -x set -e # download it if it doesn't exist if ! [ -e ${ORIG} ] ; then mkdir -p $(dirname ${ORIG}) wget -O "${ORIG}" "${ORIGURL}" fi # mount it sudo umount ${MNT} || true sudo rm -rf ${MNT} ${ISO} ${FS} sudo mkdir ${MNT} sudo mount -o loop,ro "$ORIG" ${MNT} # copy data sudo mkdir ${ISO} sudo rsync --exclude=/casper/filesystem.squashfs -a ${MNT}/ ${ISO} sudo chown -R ${NONPRIV_UID} ${ISO} chmod -R u+w ${ISO} # copy squashfs sudo unsquashfs -d ${FS} ${MNT}/casper/filesystem.squashfs sudo umount ${MNT}