#!/bin/bash ROOT=$PWD ISO_PATH=$ROOT/iso ISO=soas-strawberry.iso WORKDIR=$ROOT/work # needs to match python on the packaged SoaS PYTHON='python2.6' DO_TESTS=false if [ -d $ISO_PATH ]; then true; else echo echo ISO_PATH not found. Are you in the right path? exit -1; fi if [ $UID = 0 ]; then echo echo good! we can mount devs! else echo echo not root? sudoing self... sudo $0 $* exit 0 fi echo echo cleaning work dir... if [ -e $WORKDIR/soas ];then umount $WORKDIR/soas fi if [ -e $WORKDIR/iso ];then umount $WORKDIR/iso rm -rf $WORKDIR/* fi mkdir $WORKDIR/iso mount -o loop $ISO $WORKDIR/iso if ls $ISO_PATH/* >/dev/null;then rm -r $ISO_PATH/* fi cp -r $WORKDIR/iso/* $ISO_PATH umount $WORKDIR/iso echo echo extracting squashfs... mkdir $WORKDIR/squashfs pushd $WORKDIR/squashfs unsquashfs $ISO_PATH/LiveOS/squashfs.img || exit -1 popd echo echo mounting SoaS... mkdir $WORKDIR/soas mount -o loop -t ext3 $WORKDIR/squashfs/squashfs-root/LiveOS/ext3fs.img \ $WORKDIR/soas || exit -1 echo echo exporting current tutorius... if [ -d tutorius ];then pushd tutorius git pull origin master popd else git clone git://git.sugarlabs.org/tutorius/mainline.git tutorius fi echo echo installing tutorius to work path... pushd tutorius quoted_path=`echo "$WORKDIR/soas/usr" | sed -e "s/\\//\\\\\\\\\\//g"` sed -i -e "s/prefix=.*/prefix=$quoted_path/" setup.cfg || exit -1 $PYTHON setup.py install || exit -1 # fix icon cache for livecd LD_LIBRARY_PATH=$WORKDIR/soas/usr/lib $WORKDIR/soas/usr/bin/gtk-update-icon-cache $WORKDIR/soas/usr/share/icons/sugar/ if $DO_TESTS; then echo echo running unit tests... $PYTHON setup.py test else echo echo skipping unit testing fi popd echo echo unmounting SoaS if [ -e $WORKDIR/soas ];then umount $WORKDIR/soas rmdir $WORKDIR/soas fi echo echo repacking squashfs... mksquashfs $WORKDIR/squashfs/squashfs-root $ISO_PATH/LiveOS/squashfs.img -noappend || exit -1 rm -rf $WORKDIR/* echo echo repacking iso... if [ -e tutorius.iso ];then rm tutorius.iso fi lbl=`egrep -o "CDLABEL=\S*" $ISO_PATH/isolinux/isolinux.cfg | head -n 1 | cut -d = -f 2` mkisofs -b isolinux/isolinux.bin -c isolinux/boot.cat -o tutorius.iso -no-emul-boot -boot-load-size 4 -boot-info-table -V $lbl -J -r -hide-rr-moved iso/ mv tutorius.iso /var/www/isos/tutorius-`date +%Y%m%d`.iso ln -sf /var/www/isos/tutorius-`date +%Y%m%d`.iso /var/www/isos/current.iso chown a+r /var/www/isos/tutorius-`date +%Y%m%d`.iso md5sum /var/www/isos/tutorius-`date +%Y%m%d`.iso > /var/www/isos/tutorius-`date +%Y%m%d`.md5 shasum /var/www/isos/tutorius-`date +%Y%m%d`.iso > /var/www/isos/tutorius-`date +%Y%m%d`.sha echo echo All done!