tazwok rev 315
Move tazwok-related chroot scripts from tazchroot to tazwok sources
author | Antoine Bodin <gokhlayeh@slitaz.org> |
---|---|
date | Fri Feb 18 18:13:38 2011 +0100 (2011-02-18) |
parents | c50ed39ebbc8 |
children | 3271becd1c47 |
files | chroot-scripts/clean-chroot chroot-scripts/cook-toolchain chroot-scripts/gen-iso chroot-scripts/tank-bot |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/chroot-scripts/clean-chroot Fri Feb 18 18:13:38 2011 +0100 1.3 @@ -0,0 +1,8 @@ 1.4 +#!/bin/sh 1.5 + 1.6 +# Remove packages which was not in the chroot at creation time. 1.7 +for pkg in $(ls /var/lib/tazpkg/installed); do 1.8 + [ -d /var/lib/tazpkg/installed/$pkg ] || continue 1.9 + [ "$(grep ^$pkg$ /var/lib/tazpkg/chroot-pkgs)" ] || tazpkg remove $pkg --auto 1.10 +done 1.11 +exit 0
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/chroot-scripts/cook-toolchain Fri Feb 18 18:13:38 2011 +0100 2.3 @@ -0,0 +1,173 @@ 2.4 +#!/bin/bash 2.5 +# 2.6 +# An attempt to cook a new toolchain from scratch. 2.7 + 2.8 +# Important settings and variables. 2.9 +source /usr/lib/slitaz/libtaz 2.10 +source /etc/slitaz/tazwok.conf 2.11 +source_lib report 2.12 +report start 2.13 + 2.14 +report step "Cooking temporary toolchain" 2.15 +report open-bloc 2.16 + 2.17 +report step "Initializing tools & environment" 2.18 + 2.19 +# Theses fours packages will be needed later. 2.20 +for p in libtaz tazwok-experimental slitaz-base-files tazpkg; do 2.21 + tazwok cook $p 2.22 +done 2.23 + 2.24 +set +h 2.25 +umask 022 2.26 +PS1='\u:\w\$ ' 2.27 +LANG=POSIX 2.28 +LC_ALL=POSIX 2.29 + 2.30 +# Set BUILD_HOST to something like $ARCH-tmp-linux-gnu to enable 2.31 +# of the temporary toolchain. 2.32 +BUILD_HOST=$(echo $BUILD_HOST | sed 's/\(.*\)-\(.*\)-linux-gnu/\1-tmp-linux-gnu/') 2.33 + 2.34 +PATH=/tools/bin:/tools/usr/bin:/tools/sbin:/tools/usr/sbin:/bin:/usr/bin:/sbin:/usr/sbin 2.35 +CONFIG_SITE="/etc/config.site.tmptoolchain" 2.36 +echo 'prefix=/tools' > /etc/config.site.tmptoolchain 2.37 + 2.38 +export LANG LC_ALL PATH PS1 MAKEFLAGS CONFIG_SITE 2.39 +unset CC CXX CPP CFLAGS CXXFLAGS LD_LIBRARY_PATH LD_PRELOAD DESTDIR 2.40 + 2.41 +# Create the dir for the temporary toolchain and link in root of host 2.42 +# system. 2.43 +[ -d /tools ] && rm -r /tools 2.44 +mkdir /tools 2.45 + 2.46 +# Use some tweaked code from tazwok. 2.47 +prepare_package() 2.48 +{ 2.49 + tazwok clean $PACKAGE 2.50 + tazwok get-src $PACKAGE 2.51 + unset SOURCE VERSION EXTRAVERSION CATEGORY SHORT_DESC \ 2.52 + MAINTAINER WEB_SITE WGET_URL DEPENDS BUILD_DEPENDS WANTED 2.53 + . $WOK/$PACKAGE/receipt 2.54 + src=$WOK/$PACKAGE/$PACKAGE-$VERSION 2.55 + cd $WOK/$PACKAGE 2.56 +} 2.57 +LOCAL_REPOSITORY=$SLITAZ_DIR/$SLITAZ_VERSION 2.58 +[ "$undigest" ] && LOCAL_REPOSITORY=$SLITAZ_DIR/$undigest 2.59 +WOK=$LOCAL_REPOSITORY/wok 2.60 + 2.61 +report end-step 2.62 + 2.63 +# Binutils and gcc need to be compiled twice. 2.64 +for PACKAGE in binutils gcc; do 2.65 + rm $LOCAL_REPOSITORY/log/tmp-toolchain-$PACKAGE-firstpass.html 2>/dev/null 2.66 + report sublog $LOCAL_REPOSITORY/log/tmp-toolchain-$PACKAGE-firstpass.html 2.67 + report step "Compiling $PACKAGE, first pass" 2.68 + report open-bloc 2.69 + prepare_package 2.70 + report step "Running compilation rules" 2.71 + precook_tmp_toolchain 2.72 + report end-step || exit 1 2.73 + report close-bloc 2.74 + report end-sublog 2.75 +done 2.76 + 2.77 +# Compile temporary toolchain using the $TOOLCHAIN variable. 2.78 +for PACKAGE in $SLITAZ_TOOLCHAIN; do 2.79 + rm $LOCAL_REPOSITORY/log/tmp-toolchain-$PACKAGE.html 2>/dev/null 2.80 + report sublog $LOCAL_REPOSITORY/log/tmp-toolchain-$PACKAGE.html 2.81 + report step "Compiling $PACKAGE" 2.82 + report open-bloc 2.83 + prepare_package 2.84 + report step "Running compilation rules" 2.85 + 2.86 + # Use compile_rules if there's not function cook_tmp_toolchain in 2.87 + # the receipt. Works well if both functions are the same, as 2.88 + # cook-toolchain use it's own config.site to set different defaults 2.89 + # pathes. 2.90 + if grep -q ^cook_tmp_toolchain\(\)$ $WOK/$PACKAGE/receipt; then 2.91 + cook_tmp_toolchain 2.92 + else 2.93 + compile_rules 2.94 + fi 2.95 + 2.96 + report end-step || exit 1 2.97 + report close-bloc 2.98 + report end-sublog 2.99 +done 2.100 + 2.101 +# Now we erase previous chroot tools and we switch to temporary 2.102 +# toolchain. 2.103 + 2.104 +report step "Setting up temporary toolchain environnment" 2.105 + 2.106 +PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin:/tools/usr/bin:/tools/sbin:/tools/usr/sbin 2.107 +export PATH 2.108 + 2.109 +# Ajout manuel de libtaz et tazwok dans ce chroot. 2.110 +cp -a /etc/slitaz/tazpkg.conf /tmp/tazpkg.conf 2.111 +mkdir -p /tmp/backup/var/lib/tazpkg 2.112 +cp -a /var/lib/tazpkg/* /tmp/backup/var/lib/tazpkg 2.113 +sed 's/^AUTO_INSTALL_DEPS="yes"/AUTO_INSTALL_DEPS="no"/' -i \ 2.114 + /etc/slitaz/tazpkg.conf 2.115 +BASE_PKGS="tazpkg tazwok-experimental slitaz-base-files libtaz" 2.116 +for i in $BASE_PKGS; do 2.117 + echo N | tazpkg get-install $i --root=/tmp/backup --forced 2.118 +done 2.119 +mkdir -p /tmp/backup/var/log/slitaz /tmp/backup/etc/slitaz 2.120 +if [ -d /var/log/slitaz ]; then 2.121 + cp -a /var/log/slitaz/* /tmp/backup/var/log/slitaz 2.122 +fi 2.123 +cp -a /etc/slitaz/* /tmp/backup/etc/slitaz 2.124 +cp -a /tmp/tazpkg.conf /tmp/backup/etc/slitaz 2.125 +cp -a /etc/resolv.conf /tmp/backup/etc 2.126 +# make sure that if /bin/sh link is not delete we use bash in tools for sh 2.127 +# otherwise you may get sigment fail 2.128 +mkdir -p /tmp/backup/bin 2.129 +ln -s /tools/bin/bash /tmp/backup/bin/sh 2.130 + 2.131 +rm -r /bin /etc /lib /sbin /usr /var 2.132 +cp -a /tmp/backup/* / 2.133 +#rm -r /tmp/backup 2.134 + 2.135 +case $ARCH in 2.136 + x86_64) ln -sv lib /lib64 && ln -sv lib /usr/lib64 ;; 2.137 +esac 2.138 + 2.139 +mkdir -p /bin /usr/bin /usr/lib 2.140 +# doing a loop so we don't get {bash,cat,echo,pwd,stty} softlink 2.141 +BASIC_APPS="bash cat echo pwd stty" 2.142 +for i in $BASIC_APPS; do 2.143 + ln -s /tools/bin/$i /bin/$i 2.144 +done 2.145 +BASIC_LIBS="libgcc_s.so libgcc_s.so.1 libstdc++.so libstdc++.so.6" 2.146 +for i in $BASIC_LIBS; do 2.147 + ln -sf /tools/lib/$i /usr/lib/$i 2.148 +done 2.149 + 2.150 +ln -s /tools/bin/perl /usr/bin 2.151 +ln -s /tools/bin/gettext.sh /usr/bin 2.152 + 2.153 +report end-step 2.154 + 2.155 +# Finally, cook final* version of the toolchain packages. 2.156 +# * : recook toolchain against itself minus linux-api-headers 2.157 +# glibc binutils & gcc can be a good idea to make things 2.158 +# more robust & stable; in some cases it solves dependencies 2.159 +# loops. 2.160 + 2.161 +# Incoming packages as the only source for packages. 2.162 +rm -r /var/lib/tazpkg/undigest 2.163 +tazpkg setup-mirror $SLITAZ_DIR/${undigest:-$SLITAZ_VERSION}/packages-incoming 2.164 +tazpkg recharge 2.165 + 2.166 +# Get toolchain cooklist. 2.167 +tazwok gen-cooklist ${undigest:+--undigest=$undigest} > /tmp/toolchain.list 2.168 + 2.169 +# Next cook packages one by one. 2.170 +# Cooking the list doesn't works because sh wouldn't take care 2.171 +# of the presence of new executables even if they're first in 2.172 +# $PATH. 2.173 + 2.174 +cat /tmp/toolchain.list | while read PACKAGE; do 2.175 + tazwok cook $PACKAGE || exit 1 2.176 +done
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/chroot-scripts/gen-iso Fri Feb 18 18:13:38 2011 +0100 3.3 @@ -0,0 +1,31 @@ 3.4 +#!/bin/sh 3.5 +# Little script to cook flavor in tazwok-experimental' chroot waiting 3.6 +# for something more consistent into tazlito. 3.7 + 3.8 +[ "$1" ] || { echo "Usage: gen-iso flavorname [gzip]" >&2; exit 1; } 3.9 +source /usr/lib/slitaz/libtaz 3.10 + 3.11 +[ -d "$SLITAZ_DIR/flavors" ] || ln -s $LOCAL_REPOSITORY/flavors $SLITAZ_DIR 3.12 +if [ -d "$SLITAZ_DIR/flavors/$1" ]; then 3.13 + source_lib report 3.14 + export log_opt=$LOCAL_REPOSITORY/log/iso-$1.html 3.15 + rm -f $log_opt 3.16 + report start 3.17 + if ! [ -x /usr/bin/tazlito ]; then 3.18 + report step "Installing tazlito" 3.19 + tazpkg get-install tazlito || report exit "Installation of tazlito failed." 3.20 + fi 3.21 + [ -d "$SLITAZ_DIR/distro" ] && rm -r $SLITAZ_DIR/distro 3.22 + report step "Generating ISO $1" 3.23 + cd $tmp 3.24 + tazlito get-flavor $1 || report exit "Get flavor failed" 3.25 + sed "/^ISO_NAME/ s/$1/$SLITAZ_VERSION-$1/" -i tazlito.conf 3.26 + [ "$2" = gzip ] && echo "COMPRESSION=gzip" >> tazlito.conf 3.27 + echo -e "\n" | tazlito gen-distro || report exit "Generation of iso failed" 3.28 + cp $SLITAZ_DIR/distro/*.iso $SLITAZ_DIR/distro/*.md5 $LOCAL_REPOSITORY/iso 3.29 + clean-chroot 3.30 + report stop 3.31 +else 3.32 + echo "$SLITAZ_DIR/flavors/$1 doesn't exists." >&2 3.33 + exit 1 3.34 +fi
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/chroot-scripts/tank-bot Fri Feb 18 18:13:38 2011 +0100 4.3 @@ -0,0 +1,15 @@ 4.4 +#!/bin/sh 4.5 +# Automate common management tasks. 4.6 + 4.7 +# Update repositories 4.8 +tazpkg get-install mercurial 4.9 +tazwok update-wok 4.10 +source /etc/slitaz/slitaz.conf 4.11 +source /etc/slitaz/tazwok.conf 4.12 +LOCAL_REPOSITORY="SLITAZ_DIR/${undigest:-SLITAZ_VERSION}" 4.13 +cd $LOCAL_REPOSITORY/flavors 4.14 +hg pull -u 4.15 +clean-chroot 4.16 + 4.17 +tazwok cook-commit --missing 4.18 +tazwok check-incoming