wok-6.x rev 3757
mirror-tools/mkpkgiso: fix sort weights
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Jul 24 11:41:10 2009 +0200 (2009-07-24) |
parents | f060e21dde4c |
children | ca7105738738 |
files | mirror-tools/stuff/usr/bin/mkpkgiso |
line diff
1.1 --- a/mirror-tools/stuff/usr/bin/mkpkgiso Thu Jul 23 15:51:49 2009 +0000 1.2 +++ b/mirror-tools/stuff/usr/bin/mkpkgiso Fri Jul 24 11:41:10 2009 +0200 1.3 @@ -8,7 +8,8 @@ 1.4 VERSION=0.5 1.5 1.6 ROOT=/home/slitaz/iso 1.7 -TEMP_DIR=${ROOT}/_iso.$$ 1.8 +SORT_DIR=_iso.$$ 1.9 +TEMP_DIR=${ROOT}/$SORT_DIR 1.10 SORT_FILE=${ROOT}/_sort.$$ 1.11 PKG_VER=$1 1.12 shift 1.13 @@ -54,6 +55,15 @@ 1.14 echo -e "\\033[0;39m ]" 1.15 } 1.16 1.17 +add_sort() 1.18 +{ 1.19 + if true; then 1.20 + echo "$1 $2" 1.21 + else 1.22 + ( cd $ROOT ; find $1 | awk "{ printf \"%s $2\\n\",\$0 }" ) 1.23 + fi 1.24 +} 1.25 + 1.26 # Create temp directory 1.27 mkdir -p $TEMP_DIR/packages/$PKG_VER 1.28 1.29 @@ -128,15 +138,18 @@ 1.30 1.31 status 1.32 cat > $SORT_FILE <<EOT 1.33 -install.sh 8 1.34 -README 8 1.35 -index.html 8 1.36 -md5sum 8 1.37 -style.css 8 1.38 -images/header.png 8 1.39 +$SORT_DIR/install.sh -4000 1.40 +$SORT_DIR/README -4000 1.41 +$SORT_DIR/index.html -4000 1.42 +$SORT_DIR/md5sum -4000 1.43 +$SORT_DIR/style.css -4000 1.44 +$SORT_DIR/images/header.png -4000 1.45 +$SORT_DIR/boot/bzImage 2 1.46 +$SORT_DIR/boot/rootfs.gz 1 1.47 +$SORT_DIR/packages -9000 1.48 EOT 1.49 -( cd $TEMP_DIR ; ls packages/*/packages* packages/*/files.list.lzma ) | \ 1.50 - awk '{ printf "%s 4\n",$0 }' >> $SORT_FILE 1.51 +( cd $ROOT; ls $SORT_DIR/packages/*/packages* $SORT_DIR/packages/*/files.list.lzma ) | \ 1.52 + awk '{ printf "%s -7000\n",$0 }' >> $SORT_FILE 1.53 chmod 755 $TEMP_DIR/install.sh 1.54 1.55 case " $OPTIONS " in 1.56 @@ -185,8 +198,7 @@ 1.57 echo "=> Wok (cooking) is in \$DIR/wok" 1.58 EOF 1.59 if get_from_hg wok "wok (cooking)"; then 1.60 - ( cd $TEMP_DIR ; find wok -not -type d ) | \ 1.61 - awk '{ printf "%s 2\n",$0 }' >> $SORT_FILE 1.62 + add_sort $SORT_DIR/wok -8000 >> $SORT_FILE 1.63 fi;; 1.64 --wok-stable) 1.65 cat >>$TEMP_DIR/install.sh<<EOF 1.66 @@ -194,13 +206,11 @@ 1.67 EOF 1.68 if get_from_hg wok-stable "wok (stable)"; then 1.69 mv $TEMP_DIR/wok-stable $TEMP_DIR/wok 1.70 - ( cd $TEMP_DIR ; find wok -not -type d ) | \ 1.71 - awk '{ printf "%s 2\n",$0 }' >> $SORT_FILE 1.72 + add_sort $SORT_DIR/wok -8000 >> $SORT_FILE 1.73 fi;; 1.74 --website) 1.75 if get_from_hg website "web site"; then 1.76 - ( cd $TEMP_DIR ; find website -not -type d ) | \ 1.77 - awk '{ printf "%s 5\n",$0 }' >> $SORT_FILE 1.78 + add_sort $SORT_DIR/website -6000 >> $SORT_FILE 1.79 cat >>$TEMP_DIR/install.sh<<EOF 1.80 [ -d /var/www ] || mkdir -p /var/www 1.81 ln -s \$DIR/website /var/www 1.82 @@ -238,9 +248,13 @@ 1.83 mkdir -p "$(dirname $TEMP_DIR/$file)" 1.84 isoinfo -R -x "$file" -i $iso > "$TEMP_DIR/$file" 1.85 done 1.86 + if [ -f "$(echo $TEMP_DIR/boot/vmlinuz*)" ]; then 1.87 + rm -f $TEMP_DIR/boot/bzImage 1.88 + ln $TEMP_DIR/boot/vmlinuz* $TEMP_DIR/boot/bzImage 1.89 + fi 1.90 status 1.91 - BOOT_OPT="-b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \ 1.92 --no-emul-boot -boot-load-size 4 -boot-info-table -sort $SORT_FILE" 1.93 + BOOT_OPT="-sort $SORT_FILE -b boot/isolinux/isolinux.bin \ 1.94 +-c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table" 1.95 case " $OPTIONS " in 1.96 *\ --auto-install\ *) 1.97 echo -n "Enable auto install" 1.98 @@ -257,7 +271,7 @@ 1.99 echo -n "Enable loram autodetection" 1.100 cp $PXE_DIR/ifmem.c32 "$TEMP_DIR/boot/isolinux" 1.101 isoinfo -R -x "/usr.sqfs" -i $isoloram > "$TEMP_DIR/usr.sqfs" 1.102 - echo 'usr.sqfs 8' >> $SORT_FILE 1.103 + add_sort $SORT_DIR/usr.sqfs -5000 >> $SORT_FILE 1.104 isoinfo -R -x "/boot/rootfs.gz" -i $isoloram > \ 1.105 "$TEMP_DIR/boot/loram.gz" 1.106 sed -i -e 's|kernel /boot/bzImage|kernel /boot/isolinux/ifmem.c32\n\tappend 160768 core loram\n|' \ 1.107 @@ -266,8 +280,7 @@ 1.108 status 1.109 ;; 1.110 esac 1.111 - ( cd $TEMP_DIR ; find boot -not -type d ) | \ 1.112 - awk '{ printf "%s 9\n",$0 }' >> $SORT_FILE 1.113 + add_sort $SORT_DIR/boot 0 >> $SORT_FILE 1.114 ;; 1.115 *\ --webboot\ *) 1.116 if extract_boot gpxe; then 1.117 @@ -276,15 +289,14 @@ 1.118 isoinfo -x "/BOOT/ISOLINUX/ISOLINUX.BIN;1" -i $iso > \ 1.119 $TEMP_DIR/boot/isolinux/isolinux.bin 1.120 mv $TEMP_DIR/boot/gpxe $TEMP_DIR/boot/isolinux 1.121 - ( cd $TEMP_DIR ; find boot -not -type d ) | \ 1.122 - awk '{ printf "%s 9\n",$0 }' >> $SORT_FILE 1.123 + add_sort $SORT_DIR/boot 0 >> $SORT_FILE 1.124 cat > $TEMP_DIR/boot/isolinux/isolinux.cfg <<EOT 1.125 default gpxe 1.126 append http://mirror.slitaz.org/pxe/pxelinux.0 1.127 EOT 1.128 status 1.129 - BOOT_OPT="-b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \ 1.130 --no-emul-boot -boot-load-size 4 -boot-info-table -sort $SORT_FILE" 1.131 + BOOT_OPT="-sort $SORT_FILE -b boot/isolinux/isolinux.bin \ 1.132 +-c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table" 1.133 fi 1.134 ;; 1.135 esac 1.136 @@ -294,6 +306,8 @@ 1.137 tail -1 | awk '{ print $1 }') used by boot." 1.138 fi 1.139 1.140 +sort -r -k 2 $SORT_FILE > $SORT_FILE.$$ 1.141 +mv $SORT_FILE.$$ $SORT_FILE 1.142 case " $OPTIONS " in 1.143 *\ --dry-run\ *) 1.144 echo "Please check and remove $TEMP_DIR and $SORT_FILE"