tiny-slitaz annotate helper @ rev 32

Do not suggest packages twice
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Sep 26 13:55:40 2019 +0200 (2019-09-26)
parents 26423b57df46
children 798a84e27cc9
rev   line source
pascal@0 1 #!/bin/sh
pascal@0 2 # $0 kernel size [initrd]
pascal@0 3
pascal@1 4 init()
pascal@1 5 {
pascal@23 6 [ "$(ls -t pkgs | sed q)" = "files.list.lzma" ] ||
pascal@2 7 for i in pkgs/*/receipt ; do
pascal@2 8 . $i
pascal@2 9 sed "s/^/$PACKAGE: /" $(dirname $i)/files.list
pascal@2 10 done | lzma e pkgs/files.list.lzma -si
pascal@1 11 }
pascal@1 12
pascal@6 13
pascal@6 14
pascal@6 15
pascal@0 16 list_pkgs()
pascal@0 17 {
pascal@0 18 TMPDIR=$2
pascal@0 19 shift 2
pascal@0 20 cat <<EOT
pascal@6 21 <div class="large">
pascal@0 22 <table>
pascal@6 23 <thead>
pascal@6 24 <tr>
pascal@6 25 <th> </th>
pascal@6 26 <th>Package</th>
pascal@6 27 <th>Version</th>
pascal@6 28 <th>Description</th>
pascal@6 29 <th>Disk</th>
pascal@6 30 <th>Memory</th>
pascal@6 31 <th> </th>
pascal@6 32 </tr>
pascal@6 33 </thead>
pascal@6 34 <tbody>
pascal@0 35 EOT
pascal@26 36 unlzma < $TMPDIR/pkgs/linux-[2-9]*/fs.cpio.lzma | \
pascal@26 37 ( cd $TMPDIR/fs ; cpio -idmu boot/config-busybox )
pascal@6 38 for i in $TMPDIR/pkgs/*/receipt pkgs/*/receipt; do
pascal@0 39 [ -s $i ] || continue
pascal@0 40 case "$i" in
pascal@6 41 pkgs/kernel-*/receipt) continue;;
pascal@6 42 pkgs/module-*/receipt) continue;;
pascal@0 43 esac
pascal@6 44 AUTO_SELECTION=''
pascal@6 45 UNPACKED_SIZE='-'
pascal@6 46 PACKED_SIZE='-'
pascal@6 47 checked=''; hidden_var=''
pascal@27 48 GROUP=
pascal@27 49 CATEGORY=
pascal@0 50 . $i
pascal@27 51 [ "$GROUP" ] || GROUP="$CATEGORY"
pascal@0 52 case " $@ " in
pascal@6 53 *\ $PACKAGE\ *) checked='checked="checked"';;
pascal@6 54 *) [ -n "$2" ] && checked="";;
pascal@0 55 esac
pascal@0 56 grep -qs "^$PACKAGE " $TMPDIR/uploadconf &&
pascal@0 57 checked='checked="checked"'
pascal@5 58 case "$AUTO_SELECTION" in
pascal@26 59 never)
pascal@26 60 continue;;
pascal@26 61 always)
pascal@26 62 checked='checked="checked" disabled'
pascal@26 63 hidden_var="<input type=\"hidden\" name=\"selected[]\" value=\"$PACKAGE\" />";;
pascal@26 64 CONF*)
pascal@26 65 grep -qs "^$AUTO_SELECTION=y$" $TMPDIR/fs/boot/config-busybox ||
pascal@26 66 checked='disabled';;
pascal@5 67 esac
pascal@0 68 cat <<EOT
pascal@27 69 <!-- $GROUP -->
pascal@6 70 <tr>
pascal@6 71 <td>$hidden_var
pascal@6 72 <input type="checkbox" name="selected[]" value="$PACKAGE" $checked /></td>
pascal@6 73 <td><a href="?dl=$PACKAGE-$VERSION&amp;tmp=$TMPDIR">$PACKAGE</a></td>
pascal@6 74 <td>$VERSION</td>
pascal@6 75 <td>$SHORT_DESC</td>
pascal@6 76 <td>$PACKED_SIZE</td>
pascal@6 77 <td>$UNPACKED_SIZE</td>
pascal@6 78 <td>$(grep -qs ^config_form $i && echo '&raquo;')</td>
pascal@6 79 </tr>
pascal@0 80 EOT
pascal@0 81 done
pascal@0 82 cat <<EOT
pascal@6 83 </tbody>
pascal@0 84 </table>
pascal@6 85 </div>
pascal@0 86 EOT
pascal@0 87 exit
pascal@0 88 }
pascal@0 89
pascal@6 90
pascal@6 91
pascal@6 92
pascal@0 93 list_kernels()
pascal@0 94 {
pascal@0 95 TMPDIR=$2
pascal@0 96 shift 2
pascal@0 97 cat <<EOT
pascal@6 98 <div class="large">
pascal@0 99 <table>
pascal@6 100 <thead>
pascal@6 101 <tr>
pascal@6 102 <th> </th>
pascal@6 103 <th>Kernel</th>
pascal@6 104 <th>Version</th>
pascal@6 105 <th>Description</th>
pascal@6 106 <!-- th>Size</th -->
pascal@6 107 </tr>
pascal@6 108 </thead>
pascal@6 109 <tbody>
pascal@0 110 EOT
pascal@0 111 checked='checked="checked"'
pascal@0 112 for i in $TMPDIR/pkgs/*/receipt pkgs/*/receipt ; do
pascal@0 113 [ -s $i ] || continue
pascal@0 114 case "$i" in
pascal@6 115 pkgs/kernel-*/receipt);;
pascal@6 116 *) continue;;
pascal@0 117 esac
pascal@0 118 UNPACKED_SIZE="-"
pascal@0 119 . $i
pascal@0 120 case " $@ " in
pascal@6 121 *\ $PACKAGE\ *) checked='checked="checked"' ;;
pascal@6 122 *) [ -n "$2" ] && checked="";;
pascal@0 123 esac
pascal@0 124 cat <<EOT
pascal@6 125 <tr>
pascal@6 126 <td><input type="radio" name="kernel" value="$PACKAGE" $checked/></td>
pascal@6 127 <td>${PACKAGE#kernel-}</td>
pascal@6 128 <td>$VERSION</td>
pascal@6 129 <td>$SHORT_DESC</td>
pascal@6 130 <!-- td>$UNPACKED_SIZE</td -->
pascal@6 131 </tr>
pascal@0 132 EOT
pascal@0 133 checked=""
pascal@0 134 done
pascal@0 135 cat <<EOT
pascal@6 136 </tbody>
pascal@0 137 </table>
pascal@6 138 </div>
pascal@0 139 EOT
pascal@0 140 exit
pascal@0 141 }
pascal@0 142
pascal@6 143
pascal@6 144
pascal@6 145
pascal@0 146 list_modules()
pascal@0 147 {
pascal@0 148 TMPDIR=$2
pascal@0 149 shift 2
pascal@0 150 cat <<EOT
pascal@6 151 <input type="hidden" name="selected[]" value="" />
pascal@6 152 <div class="large">
pascal@0 153 <table>
pascal@6 154 <thead>
pascal@6 155 <tr>
pascal@6 156 <th> </th>
pascal@6 157 <th>Module</th>
pascal@6 158 <th>Version</th>
pascal@6 159 <th>Description</th>
pascal@13 160 <th>Disk</th>
pascal@13 161 <th>Memory</th>
pascal@6 162 <th> </th>
pascal@6 163 </tr>
pascal@6 164 </thead>
pascal@6 165 <tbody>
pascal@0 166 EOT
pascal@0 167 for i in $TMPDIR/pkgs/*/receipt pkgs/*/receipt ; do
pascal@0 168 [ -s $i ] || continue
pascal@0 169 case "$i" in
pascal@6 170 pkgs/module-*/receipt);;
pascal@6 171 *) continue;;
pascal@0 172 esac
pascal@27 173 GROUP=
pascal@27 174 CATEGORY=
pascal@6 175 UNPACKED_SIZE='-'
pascal@0 176 . $i
pascal@27 177 [ "$GROUP" ] || GROUP="$CATEGORY"
pascal@6 178 checked=''
pascal@0 179 case " $@ " in
pascal@6 180 *\ $PACKAGE\ *) checked='checked="checked"' ;;
pascal@0 181 esac
pascal@0 182 grep -qs "^$PACKAGE " $TMPDIR/uploadconf &&
pascal@0 183 checked='checked="checked"'
pascal@0 184 cat <<EOT
pascal@27 185 <!-- $GROUP -->
pascal@6 186 <tr>
pascal@6 187 <td><input type="checkbox" name="selected[]" value="$PACKAGE" $checked/></td>
pascal@27 188 <td><a href="?dl=$PACKAGE-$VERSION&amp;tmp=$TMPDIR">${PACKAGE#module-}</a></td>
pascal@6 189 <td>$VERSION</td>
pascal@6 190 <td>$SHORT_DESC</td>
pascal@13 191 <td>$PACKED_SIZE</td>
pascal@6 192 <td>$UNPACKED_SIZE</td>
pascal@6 193 <td>$(grep -qs ^config_form $i && echo '&raquo;')</td>
pascal@6 194 </tr>
pascal@0 195 EOT
pascal@0 196 done
pascal@0 197 cat <<EOT
pascal@6 198 </tbody>
pascal@0 199 </table>
pascal@6 200 </div>
pascal@0 201 EOT
pascal@0 202 exit
pascal@0 203 }
pascal@0 204
pascal@6 205
pascal@6 206
pascal@6 207
pascal@0 208 get_receipt()
pascal@0 209 {
pascal@0 210 grep -l "PACKAGE=\"$1\"" $2/pkgs/*/receipt pkgs/*/receipt | head -1
pascal@0 211 }
pascal@0 212
pascal@6 213
pascal@6 214
pascal@6 215
pascal@29 216 list_suggested()
pascal@7 217 {
pascal@7 218 local pkg
pascal@7 219 pkg=pkgs/$1/receipt
pascal@29 220 TMPDIR=$2
pascal@29 221 [ -s $pkg ] || pkg=$TMPDIR/pkgs/$1/receipt
pascal@7 222 [ -s $pkg ] || pkg=$(get_receipt $@)
pascal@29 223 SUGGESTED=
pascal@7 224 . $pkg
pascal@29 225 SUGG=
pascal@29 226 for i in $SUGGESTED; do
pascal@29 227 case " $@ " in
pascal@29 228 *\ $i\ *);;
pascal@29 229 *) SUGG="$SUGG $i";;
pascal@29 230 esac
pascal@29 231 done
pascal@29 232 if [ "$SUGG" ]; then
pascal@29 233 cat <<EOT
pascal@29 234 <hr />
pascal@29 235 <p>
pascal@29 236 You may want to install the following package(s) too:
pascal@29 237 </p>
pascal@31 238 <input type="hidden" name="EXTRA_SUGGESTED" value="$SUGG" />
pascal@29 239 <div class="large">
pascal@29 240 <table>
pascal@29 241 <thead>
pascal@29 242 <tr>
pascal@29 243 <th> </th>
pascal@29 244 <th>Package</th>
pascal@29 245 <th>Version</th>
pascal@29 246 <th>Description</th>
pascal@29 247 <th>Disk</th>
pascal@29 248 <th>Memory</th>
pascal@29 249 <th> </th>
pascal@29 250 </tr>
pascal@29 251 </thead>
pascal@29 252 <tbody>
pascal@29 253 EOT
pascal@29 254 checked='checked="checked" '
pascal@29 255 [ $TMPDIR/uploadconf ] && checked=
pascal@29 256 for i in $SUGG; do
pascal@29 257 i=$(grep -l "PACKAGE=\"$i\"" pkgs/*/receipt)
pascal@29 258 . $i
pascal@29 259 cat <<EOT
pascal@29 260 <!-- $GROUP -->
pascal@29 261 <tr>
pascal@29 262 <td><input type="checkbox" name="suggested[]" value="$PACKAGE" $checked /></td>
pascal@29 263 <td><a href="?dl=$PACKAGE-$VERSION&amp;tmp=$TMPDIR">$PACKAGE</a></td>
pascal@29 264 <td>$VERSION</td>
pascal@29 265 <td>$SHORT_DESC</td>
pascal@29 266 <td>$PACKED_SIZE</td>
pascal@29 267 <td>$UNPACKED_SIZE</td>
pascal@29 268 <td>$(grep -qs ^config_form $i && echo '&raquo;')</td>
pascal@29 269 </tr>
pascal@29 270 EOT
pascal@29 271 done
pascal@29 272 cat <<EOT
pascal@29 273 </tbody>
pascal@29 274 </table>
pascal@29 275 </div>
pascal@29 276 EOT
pascal@29 277 fi
pascal@7 278 }
pascal@7 279
pascal@7 280
pascal@7 281
pascal@7 282
pascal@0 283 get_package()
pascal@0 284 {
pascal@0 285 local pkg
pascal@0 286 pkg=pkgs/$1/receipt
pascal@0 287 [ -s $pkg ] || pkg=$2/pkgs/$1/receipt
pascal@0 288 [ -s $pkg ] || pkg=$(get_receipt $@)
pascal@0 289 . $pkg
pascal@0 290 cd $(dirname $pkg)
pascal@0 291 pkg=$2$PACKAGE-$VERSION.tazpkg
pascal@0 292 find * | cpio -o -H newc > $pkg
pascal@0 293 echo -n $pkg
pascal@0 294 }
pascal@0 295
pascal@6 296
pascal@6 297
pascal@6 298
pascal@0 299 get_note()
pascal@0 300 {
pascal@0 301 pkg=$(get_receipt $1 $2)
pascal@0 302 [ -n "$pkg" ] || exit
pascal@0 303 grep -qs ^config_note $pkg || exit
pascal@0 304 . $pkg
pascal@0 305 config_note
pascal@0 306 }
pascal@0 307
pascal@6 308
pascal@6 309
pascal@6 310
pascal@0 311 get_form()
pascal@0 312 {
pascal@0 313 pkg=$(get_receipt $1 $2)
pascal@0 314 [ -n "$pkg" ] || exit
pascal@0 315 grep -qs ^config_form $pkg || exit
pascal@0 316 . $pkg
pascal@0 317 if [ -s $2/uploadconf ]; then
pascal@0 318 awk "{
pascal@0 319 if (found) {
pascal@0 320 if (/^ /) print;
pascal@0 321 else exit;
pascal@0 322 }
pascal@0 323 if (/^$PACKAGE /) found=1
pascal@0 324 }" < $2/uploadconf | sed -e 's/ //' -e 's/ \([A-Z_0-9]*=\)/export \1/' > $2/vars
pascal@0 325 . $2/vars
pascal@0 326 fi
pascal@0 327 config_form $2/fs
pascal@0 328 exit
pascal@0 329 }
pascal@0 330
pascal@6 331
pascal@6 332
pascal@6 333
pascal@0 334 do_pre_install()
pascal@0 335 {
pascal@0 336 pkg=$(get_receipt $1 $2)
pascal@0 337 [ -n "$pkg" ] || exit
pascal@0 338 CONFIG_FILES=""
pascal@0 339 . $pkg
pascal@0 340 grep -qs ^pre_install $pkg && pre_install $2/fs
pascal@0 341 [ -n "$CONFIG_FILES" ] && for i in $CONFIG_FILES; do echo $i >> $2/config_files; done
pascal@26 342 unlzma < $(dirname $pkg)/fs.cpio.lzma | ( cd $2 ; cpio -idmu )
pascal@0 343 exit
pascal@0 344 }
pascal@0 345
pascal@6 346
pascal@6 347
pascal@6 348
pascal@0 349 do_post_install()
pascal@0 350 {
pascal@0 351 pkg=$(get_receipt $1 $2)
pascal@0 352 [ -n "$pkg" ] || exit
pascal@0 353 . $pkg
pascal@0 354 echo "$1 $VERSION $(md5sum $(dirname $pkg)/fs.cpio.lzma | awk '{ print $1 }')" >> $2/fs/etc/packages.conf
pascal@0 355 if grep -qs ^post_install $pkg; then
pascal@5 356 [ -s $2/vars ] && . $2/vars
pascal@0 357 echo "=== $pkg: $(date) ===" >> $2/post_install.log 2>&1
pascal@0 358 post_install $2/fs >> $2/post_install.log 2>&1
pascal@14 359 sed -e 's/^export/ /' -e 's/^/ /' -e '/^ suggested=/d' \
pascal@14 360 < $2/vars >> $2/fs/etc/packages.conf
pascal@0 361 fi
pascal@0 362 rm -f $2/vars
pascal@0 363 exit
pascal@0 364 }
pascal@0 365
pascal@6 366
pascal@6 367
pascal@6 368
pascal@0 369 scan_depends()
pascal@0 370 {
pascal@0 371 local pkg
pascal@0 372 for pkg in $@ ; do
pascal@0 373 case " $OUTPUT " in
pascal@0 374 *\ $pkg\ *) continue ;;
pascal@0 375 esac
pascal@0 376 DEPENDS=""
pascal@0 377 . $(get_receipt $pkg $TMPDIR)
pascal@0 378 scan_depends $DEPENDS
pascal@0 379 case " $OUTPUT " in
pascal@0 380 *\ $pkg\ *) continue ;;
pascal@0 381 esac
pascal@0 382 OUTPUT="$OUTPUT $pkg"
pascal@0 383 done
pascal@0 384 }
pascal@0 385
pascal@6 386
pascal@6 387
pascal@6 388
pascal@0 389 get_depends()
pascal@0 390 {
pascal@0 391 TMPDIR=$2
pascal@0 392 shift 2
pascal@0 393 OUTPUT=""
pascal@0 394 scan_depends $@
pascal@0 395 echo -n $OUTPUT
pascal@0 396 exit
pascal@0 397 }
pascal@0 398
pascal@6 399
pascal@6 400
pascal@6 401
pascal@0 402 pkgs_extract()
pascal@0 403 {
pascal@0 404 cd $2
pascal@0 405 mkdir pkgs
pascal@0 406 if cpio -t < $1 | grep -q receipt; then
pascal@0 407 mv $1 pkgs
pascal@0 408 elif tar tf $1 | grep -q tazpkg; then
pascal@0 409 tar xf $1 -C pkgs
pascal@0 410 elif tar tzf $1 | grep -q tazpkg; then
pascal@0 411 tar xzf $1 -C pkgs
pascal@0 412 elif tar tjf $1 | grep -q tazpkg; then
pascal@0 413 tar xjf $1 -C pkgs
pascal@0 414 else
pascal@0 415 rm -rf $1 pkgs
pascal@0 416 exit
pascal@0 417 fi
pascal@0 418 cd pkgs
pascal@0 419 for i in *; do
pascal@0 420 mkdir tmp
pascal@0 421 cd tmp
pascal@0 422 cpio -i < ../$i
pascal@0 423 . ./receipt
pascal@0 424 cd ..
pascal@0 425 mv tmp $PACKAGE-$VERSION
pascal@0 426 done
pascal@0 427 exit
pascal@0 428 }
pascal@0 429
pascal@6 430
pascal@29 431 boot_files()
pascal@29 432 {
pascal@29 433 [ -s $1/fs/boot/bootmenu ] && while read bin button text; do
pascal@29 434 cat <<EOT
pascal@29 435 <input name="download" value="${button%%,*} ($(du -h \
pascal@31 436 $1/fs/boot/$bin | awk '{ printf "%s",$1 }'))" type="submit" title="$text" />
pascal@29 437 EOT
pascal@29 438 done < $1/fs/boot/bootmenu
pascal@29 439 }
pascal@6 440
pascal@6 441
pascal@0 442 lzma_set_size()
pascal@0 443 {
pascal@26 444 n=$(unlzma < $1 | wc -c)
pascal@0 445 for i in $(seq 1 8); do
pascal@0 446 printf '\\\\x%02X' $(($n & 255))
pascal@0 447 n=$(($n >> 8))
pascal@0 448 done | xargs echo -en | dd of=$1 conv=notrunc bs=1 seek=5 2> /dev/null
pascal@0 449 }
pascal@0 450
pascal@6 451
pascal@27 452 compressto()
pascal@27 453 {
pascal@27 454 [ "$(which zopfli 2> /dev/null)" ] &&
pascal@27 455 zopfli --i100 -c /dev/stdin > $1 || gzip -9 > $1
pascal@27 456 [ "$(which advdef 2> /dev/null)" ] && advdef -z4 $1 > /dev/null
pascal@27 457 }
pascal@6 458
pascal@6 459
pascal@0 460 case "$1" in
pascal@29 461 --list-modules) list_modules $@ ;;
pascal@29 462 --list-kernels) list_kernels $@ ;;
pascal@29 463 --list-pkgs) list_pkgs $@ ;;
pascal@6 464 --get-form) get_form $2 $3 ;;
pascal@6 465 --get-note) get_note $2 $3 ;;
pascal@29 466 --pre-install) do_pre_install $2 $3 ;;
pascal@29 467 --post-install) do_post_install $2 $3 ;;
pascal@6 468 --depends) get_depends $@ ;;
pascal@29 469 --pkgs-extract) pkgs_extract $2 $3 ;;
pascal@6 470 --remove) rm -rf $2; exit ;;
pascal@6 471 --get-pkg) get_package $2 $3 ;;
pascal@29 472 --list-suggested) list_suggested $2 $3 $@ ;;
pascal@6 473 --init) init ;;
pascal@29 474 --boot-files) boot_files $2 ;;
pascal@0 475 esac
pascal@0 476
pascal@6 477
pascal@6 478
pascal@6 479
pascal@23 480 if [ "x$1" = "x--mkrootfs" ]; then
pascal@0 481 tmp=$2
pascal@0 482 cd $tmp/fs
pascal@25 483 [ -s boot/mkrootfs.pre_exec ] && sh boot/mkrootfs.pre_exec
pascal@0 484 if [ ! -d boot -a -s ../kernel ]; then # custom kernel
pascal@0 485 mkdir boot
pascal@0 486 cp ../kernel boot/bzImage
pascal@0 487 fi
pascal@0 488 find -user bellard -exec chown root.root {} \;
pascal@27 489 find | grep -v ^./boot | cpio -o -H newc | compressto ../rootfs.gz
pascal@0 490 fi
pascal@23 491 if [ "x$1" = "x--mkiso" ]; then
pascal@0 492 tmp=$2
pascal@0 493 mkdir -p $tmp/iso/boot/isolinux $tmp/iso/data
pascal@27 494 cat $tmp/fs/boot/System.map | compressto $tmp/iso/data/sysmap.gz
pascal@27 495 cat $tmp/fs/boot/config | compressto $tmp/iso/data/linconf.gz
pascal@27 496 cat $tmp/fs/boot/config-busybox | compressto $tmp/iso/data/bbconf.gz
pascal@5 497 cp $tmp/fs/boot/bundle $tmp/iso/data/bundle.sh
pascal@27 498 cat $tmp/post_install.log | compressto $tmp/iso/data/log.gz
pascal@0 499 cp $tmp/config_files $tmp/iso/data/files.cnf
pascal@0 500 cp $tmp/fs/etc/packages.conf $tmp/iso/data/packages.cnf
pascal@7 501 [ -s wok/busybox/receipt ] && tar czf $tmp/iso/data/wok.tgz wok/*
pascal@7 502 [ -s www/index.php ] && tar czf $tmp/iso/data/www.tgz www/*
pascal@0 503 cp $tmp/fs/boot/bzImage $tmp/iso/boot/bzImage
pascal@0 504 cp $tmp/rootfs.gz $tmp/iso/boot/rootfs
pascal@0 505 cp /boot/isolinux/isolinux.bin $tmp/iso/boot/isolinux
pascal@0 506 cat > $tmp/iso/boot/isolinux/isolinux.cfg <<EOT
pascal@27 507 label slitaz slitqw
pascal@0 508 kernel /boot/bzImage
pascal@0 509 append initrd=/boot/rootfs rw root=/dev/null vga=normal
pascal@27 510
pascal@27 511 EOT
pascal@29 512 [ -s $tmp/fs/boot/bootmenu ] && while read bin keys text; do
pascal@29 513 keys=${keys#*,}
pascal@29 514 KEY="$KEY ${keys%%,*}"
pascal@29 515 cp $tmp/fs/boot/$bin $tmp/iso/boot/$bin
pascal@27 516 cat >> $tmp/iso/boot/isolinux/isolinux.cfg <<EOT
pascal@29 517 label ${keys//,/ } $bin
pascal@27 518 kernel /boot/$bin
pascal@27 519
pascal@27 520 EOT
pascal@29 521 done < $tmp/fs/boot/bootmenu
pascal@27 522 [ "$KEY" ] && echo "say You can boot: slitaz (default)$KEY" >> \
pascal@27 523 $tmp/iso/boot/isolinux/isolinux.cfg
pascal@27 524 cat >> $tmp/iso/boot/isolinux/isolinux.cfg <<EOT
pascal@0 525 default slitaz
pascal@0 526 implicit 0
pascal@0 527 prompt 1
pascal@0 528 timeout 50
pascal@0 529 EOT
pascal@0 530 genisoimage -o $tmp/slitaz.iso -b boot/isolinux/isolinux.bin \
pascal@0 531 -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 \
pascal@0 532 -V "Tiny SliTaz" -p "www.slitaz.org" -input-charset iso8859-1 \
pascal@0 533 -boot-info-table $tmp/iso > /dev/null 2>&1
pascal@0 534 [ -x /usr/bin/isohybrid ] &&
pascal@0 535 /usr/bin/isohybrid $tmp/slitaz.iso 2> /dev/null
pascal@6 536 [ -x /usr/bin/iso2exe ] &&
pascal@6 537 /usr/bin/iso2exe $tmp/slitaz.iso 2> /dev/null
pascal@0 538 fi
pascal@23 539 if [ "x$1" = "x--mkexe" ]; then
pascal@5 540 tmp=$2
pascal@5 541 cd $tmp
pascal@5 542 cp fs/boot/bzImage slitaz.exe
pascal@7 543 sh fs/boot/bundle slitaz.exe rootfs.gz
pascal@5 544 fi
pascal@23 545 if [ "x$1" = "x--mkimg" ]; then
pascal@0 546 tmp=$2
pascal@0 547 cd $tmp
pascal@27 548 if [ ! -s out ]; then
pascal@27 549 cp fs/boot/bzImage slitaz.img
pascal@27 550 sh fs/boot/bundle slitaz.img rootfs.gz
pascal@29 551 if [ -s fs/boot/bootmenu ]; then
pascal@29 552 echo -n "sh fs/boot/bundle out ' SliTaz boot menu'"
pascal@29 553 echo -n " slitaz.img 'Tiny SliTaz'"
pascal@29 554 while read bin button text; do
pascal@31 555 echo -n " fs/boot/$bin '${text% (*}'"
pascal@29 556 done < fs/boot/bootmenu
pascal@29 557 fi | sh
pascal@29 558 [ -s out ] || mv slitaz.img out
pascal@12 559 fi
pascal@27 560 rm -f xa* 2> /dev/null
pascal@27 561 split -b ${3:-1474560} out
pascal@27 562 A="-abcdefghijklmnopqrstuvwxyz"
pascal@27 563 mv xa${A:${4:-1}:1} floppy$4.img || mv xaa floppy1.img
pascal@27 564 [ $(stat -c %s floppy${4:-1}.img) -lt ${3:-1474560} ] &&
pascal@27 565 dd of=floppy${4:-1}.img bs=1 seek=${3:-1474560} count=0 2> /dev/null
pascal@0 566 fi
pascal@23 567 if [ "x$1" = "x--mkcfg" ]; then
pascal@0 568 tmp=$2
pascal@0 569 cd $tmp/fs
pascal@0 570 for i in $(sed 's#^/##' < ../config_files); do find $i; done | \
pascal@27 571 sort | uniq | cpio -o -H newc | compressto ../config_files.cpio.gz
pascal@0 572 fi
pascal@23 573 if [ "x$1" = "x--chkdist" ]; then
pascal@5 574 if [ pkgs/busybox-*/fs.cpio.lzma -nt dist/rootfs.cpio ]; then
pascal@5 575 cat pkgs/busybox-*/fs.cpio.lzma | unlzma | ( cd dist ; cpio -idmu )
pascal@5 576 mv -f dist/fs/* dist/
pascal@5 577 rmdir dist/fs
pascal@5 578 touch dist/*
pascal@5 579 fi
pascal@5 580 fi