slitaz-dev-tools view mirror-tools/rootfs/usr/bin/rolling.sh @ rev 94

mirror-tools: new style & 2G+ file support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon May 30 13:29:45 2011 +0200 (2011-05-30)
parents 026420a06f32
children bb83a9345648
line source
1 #!/bin/sh
3 # Current root of web server
4 rootwww=/var/www/slitaz/mirror
5 packages=$rootwww/packages/cooking
7 # Location of slitaz rolling release
8 rolling=$rootwww/iso/rolling
10 flavor=core
12 # We use the last build as build environment
13 system=$rolling/slitaz-*.iso
14 [ -s $system ] || system=$rootwww/iso/cooking/slitaz-cooking.iso
16 # Build the rolling release if something is new on mirror
17 if [ $packages/$flavor.flavor -nt $system -o \
18 $packages/packages.list -nt $system ]; then
19 [ -d $rolling ] || mkdir -p $rolling
20 TMP=/tmp/rolling$$
21 mkdir -p $TMP/iso $TMP/fs/home/slitaz/cooking/packages
22 ln $packages/* $TMP/fs/home/slitaz/cooking/packages
23 mount -o loop,ro $system $TMP/iso
24 for i in $TMP/iso/boot/rootfs*.gz ; do
25 unlzma -c $i | ( cd $TMP/fs ; cpio -id )
26 done
27 umount -d $TMP/iso
28 cat > $TMP/fs/root/build.sh <<EOT
29 #!/bin/sh
31 tazlito get-flavor $flavor
32 echo -e "\n" | tazlito gen-distro
33 EOT
34 cat > $TMP/fs/BUILD <<EOT
35 #!/bin/sh
37 DIR=\$(dirname \$0)
38 MOUNTS="/proc /sys /dev/pts /dev/shm"
39 [ -s /etc/resolv.conf ] && cp /etc/resolv.conf \$DIR/etc
40 if [ ! -d \$DIR/proc/1 ]; then
41 for i in \$MOUNTS; do
42 [ -d \$i ] && mount --bind \$i \$DIR/\$i
43 done
44 mount --bind /tmp \$DIR/tmp || mount -t tmpfs tmpfs \$DIR/tmp
45 fi
46 script -c "SHELL=/bin/sh chroot \$DIR /bin/sh -x /root/build.sh" $TMP/slitaz-$flavor.log
47 umount \$DIR/tmp
48 for i in \$MOUNTS; do
49 umount \$DIR/\$i
50 done
51 EOT
52 sh $TMP/fs/BUILD
53 mv -f $TMP/fs/home/slitaz/cooking/distro/slitaz-$flavor.* $rolling/
54 mv -f $TMP/slitaz-$flavor.log $rolling/
55 rm -rf $TMP
56 fi