2013-08-17 22:28:49 -04:00
|
|
|
#!/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
|
2013-08-18 23:57:37 -04:00
|
|
|
mkdir -p $(dirname ${ORIG})
|
2013-08-17 22:28:49 -04:00
|
|
|
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}
|
2016-06-25 16:39:02 -04:00
|
|
|
sudo chown -R ${NONPRIV_UID} ${ISO}
|
2013-08-17 22:28:49 -04:00
|
|
|
chmod -R u+w ${ISO}
|
|
|
|
|
|
|
|
# copy squashfs
|
|
|
|
sudo unsquashfs -d ${FS} ${MNT}/casper/filesystem.squashfs
|
2013-08-18 00:22:35 -04:00
|
|
|
|
|
|
|
sudo umount ${MNT}
|