Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/contrib/packager.sh
blob: c1bf7523a9f0249b47c7411c11ad7e1f831d7e17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/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!