tazpkg rev 74
add add-flavor, install-flavor and set-release
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Apr 28 11:04:49 2008 +0000 (2008-04-28) |
parents | 680ec3abef92 |
children | d11eb5165891 |
files | tazpkg |
line diff
1.1 --- a/tazpkg Fri Apr 25 18:17:53 2008 +0000 1.2 +++ b/tazpkg Mon Apr 28 11:04:49 2008 +0000 1.3 @@ -109,6 +109,9 @@ 1.4 get-install Download and install a package from the mirror. 1.5 get-install-list Download and install a list of packages from the mirror. 1.6 check Verify installed packages concistancy. 1.7 + add-flavor Install the flavor list of packages. 1.8 + install-flavor Install the flavor list of packages and remove other ones. 1.9 + set-release Change release and update packages 1.10 clean-cache Clean all packages downloaded in cache directory. 1.11 setup-mirror Change the mirror url configuration. 1.12 reconfigure Replay post install script from package." 1.13 @@ -490,6 +493,41 @@ 1.14 fi 1.15 } 1.16 1.17 +# Install package-list from a flavor 1.18 +install_flavor() 1.19 +{ 1.20 + check_root 1.21 + FLAVOR=$1 1.22 + ARG=$2 1.23 + mkdir -p $TMP_DIR 1.24 + [ -f $FLAVOR.flavor ] && cp $FLAVOR.flavor $TMP_DIR 1.25 + cd $TMP_DIR 1.26 + if [ -f $FLAVOR.flavor ] || download $FLAVOR.flavor; then 1.27 + zcat $FLAVOR.flavor | cpio -i 2>/dev/null 1.28 + while read file; do 1.29 + for pkg in $(ls -d $INSTALLED/${file%%-*}*); do 1.30 + . $pkg/receipt 1.31 + [ "$PACKAGE-$VERSION" = "$file" ] && break 1.32 + done 1.33 + [ "$PACKAGE-$VERSION" = "$file" ] && continue 1.34 + cd $CACHE_DIR 1.35 + download $file.tazpkg 1.36 + cd $TMP_DIR 1.37 + tazpkg install $CACHE_DIR/$file.tazpkg --forced 1.38 + done < $FLAVOR.pkglist 1.39 + [ "$ARG" == "--purge" ] && for pkg in $(ls $INSTALLED); do 1.40 + [ -d $INSTALLED/$pkg ] || continue 1.41 + . $INSTALLED/$pkg/receipt 1.42 + grep -q ^$PACKAGE-$VERSION$ $FLAVOR.pkglist && continue 1.43 + tazpkg remove $PACKAGE 1.44 + done 1.45 + else 1.46 + echo "Can't find flavor $FLAVOR Abort." 1.47 + fi 1.48 + cd $TOP_DIR 1.49 + rm -rf $TMP_DIR 1.50 +} 1.51 + 1.52 ################### 1.53 # Tazpkg commands # 1.54 ################### 1.55 @@ -815,6 +853,24 @@ 1.56 fi 1.57 done 1.58 ;; 1.59 + add-flavor) 1.60 + # Install a set of packages from a flavor. 1.61 + # 1.62 + install_flavor $2 1.63 + ;; 1.64 + install-flavor) 1.65 + # Install a set of packages from a flavor and purge other ones. 1.66 + # 1.67 + install_flavor $2 --purge 1.68 + ;; 1.69 + set-release) 1.70 + # Change curent release and upgrade packages. 1.71 + # 1.72 + RELEASE=$2 1.73 + rm /var/lib/tazpkg/mirror 1.74 + echo "$RELEASE" > /etc/slitaz-release 1.75 + tazpkg recharge && tazpkg upgrade 1.76 + ;; 1.77 remove) 1.78 # Remove packages. 1.79 # 1.80 @@ -938,7 +994,6 @@ 1.81 echo -e "$MISSING" 1.82 exit 1 1.83 fi 1.84 - HERE=`pwd` 1.85 mkdir -p $TMP_DIR && cd $TMP_DIR 1.86 FILES="fs.cpio.gz\n" 1.87 for i in $(ls $INSTALLED/$PACKAGE) ; do 1.88 @@ -951,8 +1006,8 @@ 1.89 mv tmp/rootfs fs 1.90 find fs | cpio -o -H newc 2> /dev/null | gzip -9 > fs.cpio.gz 1.91 echo -e "$FILES" | cpio -o -H newc 2> /dev/null > \ 1.92 - $HERE/$PACKAGE-$VERSION.tazpkg 1.93 - cd $HERE 1.94 + $TOP_DIR/$PACKAGE-$VERSION.tazpkg 1.95 + cd $TOP_DIR 1.96 \rm -R $TMP_DIR 1.97 echo "Package $PACKAGE repacked successfully." 1.98 echo "Size : `du -sh $PACKAGE-$VERSION.tazpkg`"