# HG changeset patch # User Pascal Bellard # Date 1227090778 0 # Node ID 93d00c99a42718f806986a974dbba528f8abd6b2 # Parent 245d1bc622b8d55b6569c1145717d1f9ade0f8ed Add mirror-tools diff -r 245d1bc622b8 -r 93d00c99a427 mirror-tools/receipt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/receipt Wed Nov 19 10:32:58 2008 +0000 @@ -0,0 +1,15 @@ +# SliTaz package receipt. + +PACKAGE="mirror-tools" +VERSION="1.0" +CATEGORY="extra" +SHORT_DESC="Mirrors toolset." +MAINTAINER="pascal.bellard@slitaz.org" +WEB_SITE="http://www.slitaz.org/" + +# Rules to gen a SliTaz package suitable for Tazpkg. +genpkg_rules() +{ + cp -a stuff/* $fs +} + diff -r 245d1bc622b8 -r 93d00c99a427 mirror-tools/stuff/etc/rsyncd.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/stuff/etc/rsyncd.conf Wed Nov 19 10:32:58 2008 +0000 @@ -0,0 +1,25 @@ +# rsynd configuration for SliTaz mirror +# +motd file=/etc/rsyncd.motd +log file=/var/log/rsyncd +pid file=/var/run/rsyncd.pid + + +[slitaz] + + comment = SliTaz GNU/Linux mirror + path = /var/www/slitaz/mirror + use chroot = yes + max connections = 5 + lock file = /var/lock/rsyncd + read only = yes + list = yes + uid = nobody + gid = nogroup + strict modes = yes + ignore errors = no + ignore nonreadable = yes + transfer logging = no + timeout = 600 + refuse options = checksum dry-run + dont compress = *.gz *.tgz *.zip *.iso *.bz2 *.tazpkg diff -r 245d1bc622b8 -r 93d00c99a427 mirror-tools/stuff/etc/rsyncd.motd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/stuff/etc/rsyncd.motd Wed Nov 19 10:32:58 2008 +0000 @@ -0,0 +1,12 @@ +=============================================================================== + + SliTaz GNU/Linux mirror - http://www.slitaz.org/ + +=============================================================================== + +modules: + + * slitaz --> ISO, packages, boot... all stuff + +=============================================================================== + diff -r 245d1bc622b8 -r 93d00c99a427 mirror-tools/stuff/etc/tazwok.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/stuff/etc/tazwok.conf Wed Nov 19 10:32:58 2008 +0000 @@ -0,0 +1,31 @@ +# tazwok.conf: Tazwok configuration file. +# + +# Wok directory/tree to find receipts and build packages. +# By default on SliTaz the directory is /home/slitaz/wok. +WOK="/slitaz/home/slitaz/wok" + +# The path to the sources tarballs of the binaries packages. +SOURCES_REPOSITORY="/slitaz/home/slitaz/src" + +# This path set the binaries packages repository. It's where all +# the gen *.tazpkg will be stored when using gen-repository command. +PACKAGES_REPOSITORY="/var/www/slitaz/mirror/packages/cooking" + +# Default arguments for GNU configure. +CONFIGURE_ARGS="--build=i486-pc-linux-gnu --host=i486-pc-linux-gnu" + +# Translation files to include in packages, note that you can specifiy +# several locale. +LOCALE="fr" + +# Mirrors URLs. To downloads source next from your location. +# GNU mirror : +# +GNU_MIRROR="ftp://sunsite.cnlab-switch.ch/mirror/gnu" +# SourceForge mirror : +# +SF_MIRROR="http://switch.dl.sourceforge.net/sourceforge" +# Xorg mirror : +# +XORG_MIRROR="ftp://ftp.solnet.ch/mirror/x.org/pub/individual" diff -r 245d1bc622b8 -r 93d00c99a427 mirror-tools/stuff/slitaz/INSTALL --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/stuff/slitaz/INSTALL Wed Nov 19 10:32:58 2008 +0000 @@ -0,0 +1,14 @@ +#!/bin/sh +DIR=$(dirname $0) +MOUNTS="/proc /sys /dev/pts /dev/shm" +cp /etc/resolv.conf etc +for i in $MOUNTS; do + [ -d $i ] && mount --bind $i $DIR/$i +done +#mount --bind /var/tmp tmp +mount --bind /tmp tmp || mount -t tmpfs tmpfs tmp +SHELL=/bin/ash chroot $DIR /bin/ash - +umount tmp +for i in $MOUNTS; do + umount $DIR/$i +done diff -r 245d1bc622b8 -r 93d00c99a427 mirror-tools/stuff/usr/bin/mkpkgiso --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mirror-tools/stuff/usr/bin/mkpkgiso Wed Nov 19 10:32:58 2008 +0000 @@ -0,0 +1,204 @@ +#!/bin/sh +# mkpkgiso, build packages ISO image. +# (C) 2007-TODAY SliTaz - GNU General Public License v3. +# +# Authors : Eric Joseph-Alexandre +# Pascal Bellard + +VERSION=0.2 + +ROOT=/home/slitaz/iso +TEMP_DIR=${ROOT}/_iso.$$ +PKG_VER=$1 +shift +OPTIONS=$@ +PKG_DIR=$TEMP_DIR/packages/$PKG_VER +REPOS=/var/www/slitaz/mirror/packages/$PKG_VER +ISO_DIR=/var/www/slitaz/mirror/iso/$PKG_VER +LOG=$PWD/$(basename $0).log + +# +VOLUME_ID="packages-${PKG_VER}" +PUBLISHER="SliTaz http://www.slitaz.org/" +IMAGE="packages-${PKG_VER}.iso" +OUTPUT="$ROOT/$IMAGE" + +# Check command line option. +if [ -z $PKG_VER ]; then + echo "Usage: $(basename $0) [--boot|--webboot][--filter]" + exit 1 +fi + +# Check if we provide a valide version +if [ ! -d $REPOS ]; then + echo "Boooh! $PKG_VER is not a valid version." + exit 1 +fi + +# Status function. +status() +{ + local CHECK=$? + echo -en "\\033[70G[ " + if [ $CHECK = 0 ]; then + echo -en "\\033[1;33mOK" + else + echo -en "\\033[1;31mFailed" + fi + echo -e "\\033[0;39m ]" +} + +# Create temp directory +mkdir -p $TEMP_DIR/packages/$PKG_VER + +# Prepare evrything for ISO + +echo "" +echo "Building ISO for packages $PKG_VER" +echo "===============================================================================" +echo -n "Creating working dir $(basename $TEMP_DIR)" +status +echo -n "Creating symlink" +status + +# Link every packages to temp dir +cd $PKG_DIR +for i in $REPOS/* +do + ln -s $i >> $LOG 2>&1 +done + +echo -n "Creating install script" +# Create install script as suggested by Pascal. +cat >$TEMP_DIR/install.sh< /var/lib/tazpkg/mirror +ln -fs \$DIR/packages/*/*.tazpkg /var/cache/tazpkg/ +ln -fs \$DIR/packages/*/packages.* /var/lib/tazpkg +EOF +[ -e files.list.lzma ] && cat >>$TEMP_DIR/install.sh<>$TEMP_DIR/install.sh< /dev/null) +[ -f "$f" ] || return 1 +[ -d $TEMP_DIR/boot ] || mkdir $TEMP_DIR/boot +( cd $TEMP_DIR/boot ; cpio -i fs.cpio.gz < $f 2> /dev/null ) +( cd $TEMP_DIR/boot ; zcat fs.cpio.gz | cpio -id 2> /dev/null ) +mv $TEMP_DIR/boot/fs/boot/* $TEMP_DIR/boot +rm -rf $TEMP_DIR/boot/fs.cpio.gz $TEMP_DIR/boot/fs +return 0 +} + +# Gen boot part +BOOT_OPT="" +iso=$ISO_DIR/slitaz-$PKG_VER.iso +case " $OPTIONS " in +*\ --boot\ *) + echo -n "Creating boot tree" + isoinfo -R -l -i $iso | awk '/^Directory/ { path=$4 } /^-/ { print path$12 }' | while read file; do + [ "$file" = "/boot/isolinux/boot.cat" ] && continue + [ -d "$(dirname $TEMP_DIR/$file)" ] || + mkdir -p "$(dirname $TEMP_DIR/$file)" + isoinfo -R -x "$file" -i $iso > "$TEMP_DIR/$file" + done + status + BOOT_OPT="-b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \ +-no-emul-boot -boot-load-size 4 -boot-info-table" + ;; +*\ --webboot\ *) + if extract_boot gpxe; then + echo -n "Creating web boot tree" + mkdir $TEMP_DIR/boot/isolinux/ + isoinfo -x "/BOOT/ISOLINUX/ISOLINUX.BIN;1" -i $iso > \ + $TEMP_DIR/boot/isolinux/isolinux.bin + mv $TEMP_DIR/boot/gpxe $TEMP_DIR/boot/isolinux + cat > $TEMP_DIR/boot/isolinux/isolinux.cfg < $(basename $IMAGE .iso).md5 +status + +echo -n "Moving file to mirror" +mv $IMAGE $ISO_DIR +mv $(basename $IMAGE .iso).md5 $ISO_DIR +status + + +# Cleaning temp files +rm -rf $TEMP_DIR +