tiny-slitaz annotate helper @ rev 38

helper: don't build slitaz.iso twice (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Sep 26 19:36:25 2023 +0000 (14 months ago)
parents db2cc84a8917
children
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@36 224 TARGET=i486
pascal@7 225 . $pkg
pascal@29 226 SUGG=
pascal@29 227 for i in $SUGGESTED; do
pascal@29 228 case " $@ " in
pascal@29 229 *\ $i\ *);;
pascal@29 230 *) SUGG="$SUGG $i";;
pascal@29 231 esac
pascal@29 232 done
pascal@29 233 if [ "$SUGG" ]; then
pascal@29 234 cat <<EOT
pascal@29 235 <hr />
pascal@29 236 <p>
pascal@29 237 You may want to install the following package(s) too:
pascal@29 238 </p>
pascal@31 239 <input type="hidden" name="EXTRA_SUGGESTED" value="$SUGG" />
pascal@29 240 <div class="large">
pascal@29 241 <table>
pascal@29 242 <thead>
pascal@29 243 <tr>
pascal@29 244 <th> </th>
pascal@29 245 <th>Package</th>
pascal@29 246 <th>Version</th>
pascal@29 247 <th>Description</th>
pascal@29 248 <th>Disk</th>
pascal@29 249 <th>Memory</th>
pascal@29 250 <th> </th>
pascal@29 251 </tr>
pascal@29 252 </thead>
pascal@29 253 <tbody>
pascal@29 254 EOT
pascal@29 255 checked='checked="checked" '
pascal@29 256 [ $TMPDIR/uploadconf ] && checked=
pascal@29 257 for i in $SUGG; do
pascal@29 258 i=$(grep -l "PACKAGE=\"$i\"" pkgs/*/receipt)
pascal@29 259 . $i
pascal@29 260 cat <<EOT
pascal@29 261 <!-- $GROUP -->
pascal@29 262 <tr>
pascal@29 263 <td><input type="checkbox" name="suggested[]" value="$PACKAGE" $checked /></td>
pascal@29 264 <td><a href="?dl=$PACKAGE-$VERSION&amp;tmp=$TMPDIR">$PACKAGE</a></td>
pascal@29 265 <td>$VERSION</td>
pascal@29 266 <td>$SHORT_DESC</td>
pascal@29 267 <td>$PACKED_SIZE</td>
pascal@29 268 <td>$UNPACKED_SIZE</td>
pascal@29 269 <td>$(grep -qs ^config_form $i && echo '&raquo;')</td>
pascal@29 270 </tr>
pascal@29 271 EOT
pascal@29 272 done
pascal@29 273 cat <<EOT
pascal@29 274 </tbody>
pascal@29 275 </table>
pascal@29 276 </div>
pascal@29 277 EOT
pascal@29 278 fi
pascal@7 279 }
pascal@7 280
pascal@7 281
pascal@7 282
pascal@7 283
pascal@0 284 get_package()
pascal@0 285 {
pascal@0 286 local pkg
pascal@0 287 pkg=pkgs/$1/receipt
pascal@0 288 [ -s $pkg ] || pkg=$2/pkgs/$1/receipt
pascal@0 289 [ -s $pkg ] || pkg=$(get_receipt $@)
pascal@0 290 . $pkg
pascal@0 291 cd $(dirname $pkg)
pascal@0 292 pkg=$2$PACKAGE-$VERSION.tazpkg
pascal@0 293 find * | cpio -o -H newc > $pkg
pascal@0 294 echo -n $pkg
pascal@0 295 }
pascal@0 296
pascal@6 297
pascal@6 298
pascal@6 299
pascal@0 300 get_note()
pascal@0 301 {
pascal@0 302 pkg=$(get_receipt $1 $2)
pascal@0 303 [ -n "$pkg" ] || exit
pascal@0 304 grep -qs ^config_note $pkg || exit
pascal@0 305 . $pkg
pascal@0 306 config_note
pascal@0 307 }
pascal@0 308
pascal@6 309
pascal@6 310
pascal@6 311
pascal@0 312 get_form()
pascal@0 313 {
pascal@0 314 pkg=$(get_receipt $1 $2)
pascal@0 315 [ -n "$pkg" ] || exit
pascal@0 316 grep -qs ^config_form $pkg || exit
pascal@0 317 . $pkg
pascal@0 318 if [ -s $2/uploadconf ]; then
pascal@0 319 awk "{
pascal@0 320 if (found) {
pascal@0 321 if (/^ /) print;
pascal@0 322 else exit;
pascal@0 323 }
pascal@0 324 if (/^$PACKAGE /) found=1
pascal@0 325 }" < $2/uploadconf | sed -e 's/ //' -e 's/ \([A-Z_0-9]*=\)/export \1/' > $2/vars
pascal@0 326 . $2/vars
pascal@0 327 fi
pascal@0 328 config_form $2/fs
pascal@0 329 exit
pascal@0 330 }
pascal@0 331
pascal@6 332
pascal@6 333
pascal@6 334
pascal@0 335 do_pre_install()
pascal@0 336 {
pascal@0 337 pkg=$(get_receipt $1 $2)
pascal@0 338 [ -n "$pkg" ] || exit
pascal@0 339 CONFIG_FILES=""
pascal@0 340 . $pkg
pascal@0 341 grep -qs ^pre_install $pkg && pre_install $2/fs
pascal@0 342 [ -n "$CONFIG_FILES" ] && for i in $CONFIG_FILES; do echo $i >> $2/config_files; done
pascal@26 343 unlzma < $(dirname $pkg)/fs.cpio.lzma | ( cd $2 ; cpio -idmu )
pascal@0 344 exit
pascal@0 345 }
pascal@0 346
pascal@6 347
pascal@6 348
pascal@6 349
pascal@0 350 do_post_install()
pascal@0 351 {
pascal@0 352 pkg=$(get_receipt $1 $2)
pascal@0 353 [ -n "$pkg" ] || exit
pascal@0 354 . $pkg
pascal@35 355 [ -d $2/fs/etc ] || mkdir -p $2/fs/etc
pascal@0 356 echo "$1 $VERSION $(md5sum $(dirname $pkg)/fs.cpio.lzma | awk '{ print $1 }')" >> $2/fs/etc/packages.conf
pascal@0 357 if grep -qs ^post_install $pkg; then
pascal@5 358 [ -s $2/vars ] && . $2/vars
pascal@0 359 echo "=== $pkg: $(date) ===" >> $2/post_install.log 2>&1
pascal@0 360 post_install $2/fs >> $2/post_install.log 2>&1
pascal@35 361 sed -e 's/^export/ /' -e 's/^/ /' -e '/^ suggested=/d' -e '/EXTRA_SUGGESTED=/d' \
pascal@14 362 < $2/vars >> $2/fs/etc/packages.conf
pascal@0 363 fi
pascal@0 364 rm -f $2/vars
pascal@0 365 exit
pascal@0 366 }
pascal@0 367
pascal@6 368
pascal@6 369
pascal@6 370
pascal@0 371 scan_depends()
pascal@0 372 {
pascal@0 373 local pkg
pascal@0 374 for pkg in $@ ; do
pascal@0 375 case " $OUTPUT " in
pascal@0 376 *\ $pkg\ *) continue ;;
pascal@0 377 esac
pascal@0 378 DEPENDS=""
pascal@0 379 . $(get_receipt $pkg $TMPDIR)
pascal@0 380 scan_depends $DEPENDS
pascal@0 381 case " $OUTPUT " in
pascal@0 382 *\ $pkg\ *) continue ;;
pascal@0 383 esac
pascal@0 384 OUTPUT="$OUTPUT $pkg"
pascal@0 385 done
pascal@0 386 }
pascal@0 387
pascal@6 388
pascal@6 389
pascal@6 390
pascal@0 391 get_depends()
pascal@0 392 {
pascal@0 393 TMPDIR=$2
pascal@0 394 shift 2
pascal@0 395 OUTPUT=""
pascal@0 396 scan_depends $@
pascal@0 397 echo -n $OUTPUT
pascal@0 398 exit
pascal@0 399 }
pascal@0 400
pascal@6 401
pascal@6 402
pascal@6 403
pascal@0 404 pkgs_extract()
pascal@0 405 {
pascal@0 406 cd $2
pascal@0 407 mkdir pkgs
pascal@0 408 if cpio -t < $1 | grep -q receipt; then
pascal@0 409 mv $1 pkgs
pascal@0 410 elif tar tf $1 | grep -q tazpkg; then
pascal@0 411 tar xf $1 -C pkgs
pascal@0 412 elif tar tzf $1 | grep -q tazpkg; then
pascal@0 413 tar xzf $1 -C pkgs
pascal@0 414 elif tar tjf $1 | grep -q tazpkg; then
pascal@0 415 tar xjf $1 -C pkgs
pascal@0 416 else
pascal@0 417 rm -rf $1 pkgs
pascal@0 418 exit
pascal@0 419 fi
pascal@0 420 cd pkgs
pascal@0 421 for i in *; do
pascal@0 422 mkdir tmp
pascal@0 423 cd tmp
pascal@0 424 cpio -i < ../$i
pascal@0 425 . ./receipt
pascal@0 426 cd ..
pascal@0 427 mv tmp $PACKAGE-$VERSION
pascal@0 428 done
pascal@0 429 exit
pascal@0 430 }
pascal@0 431
pascal@6 432
pascal@29 433 boot_files()
pascal@29 434 {
pascal@29 435 [ -s $1/fs/boot/bootmenu ] && while read bin button text; do
pascal@29 436 cat <<EOT
pascal@29 437 <input name="download" value="${button%%,*} ($(du -h \
pascal@31 438 $1/fs/boot/$bin | awk '{ printf "%s",$1 }'))" type="submit" title="$text" />
pascal@29 439 EOT
pascal@29 440 done < $1/fs/boot/bootmenu
pascal@29 441 }
pascal@6 442
pascal@6 443
pascal@0 444 lzma_set_size()
pascal@0 445 {
pascal@26 446 n=$(unlzma < $1 | wc -c)
pascal@0 447 for i in $(seq 1 8); do
pascal@36 448 printf '\\\\x%02X' $((n & 255))
pascal@36 449 n=$((n >> 8))
pascal@0 450 done | xargs echo -en | dd of=$1 conv=notrunc bs=1 seek=5 2> /dev/null
pascal@0 451 }
pascal@0 452
pascal@6 453
pascal@27 454 compressto()
pascal@27 455 {
pascal@36 456 [ "$2" == "rootfs" ] && [ -s $tmp/fs/boot/compress_rootfs ] &&
pascal@36 457 sh $tmp/fs/boot/compress_rootfs $1 && return
pascal@27 458 [ "$(which zopfli 2> /dev/null)" ] &&
pascal@27 459 zopfli --i100 -c /dev/stdin > $1 || gzip -9 > $1
pascal@27 460 [ "$(which advdef 2> /dev/null)" ] && advdef -z4 $1 > /dev/null
pascal@27 461 }
pascal@6 462
pascal@6 463
pascal@0 464 case "$1" in
pascal@29 465 --list-modules) list_modules $@ ;;
pascal@29 466 --list-kernels) list_kernels $@ ;;
pascal@29 467 --list-pkgs) list_pkgs $@ ;;
pascal@6 468 --get-form) get_form $2 $3 ;;
pascal@6 469 --get-note) get_note $2 $3 ;;
pascal@29 470 --pre-install) do_pre_install $2 $3 ;;
pascal@29 471 --post-install) do_post_install $2 $3 ;;
pascal@6 472 --depends) get_depends $@ ;;
pascal@29 473 --pkgs-extract) pkgs_extract $2 $3 ;;
pascal@6 474 --remove) rm -rf $2; exit ;;
pascal@6 475 --get-pkg) get_package $2 $3 ;;
pascal@29 476 --list-suggested) list_suggested $2 $3 $@ ;;
pascal@6 477 --init) init ;;
pascal@29 478 --boot-files) boot_files $2 ;;
pascal@0 479 esac
pascal@0 480
pascal@6 481
pascal@6 482
pascal@6 483
pascal@23 484 if [ "x$1" = "x--mkrootfs" ]; then
pascal@0 485 tmp=$2
pascal@0 486 cd $tmp/fs
pascal@25 487 [ -s boot/mkrootfs.pre_exec ] && sh boot/mkrootfs.pre_exec
pascal@36 488 if [ ! -d boot ] && [ -s ../kernel ]; then # custom kernel
pascal@0 489 mkdir boot
pascal@0 490 cp ../kernel boot/bzImage
pascal@0 491 fi
pascal@36 492 find . -user bellard -exec chown root.root {} \;
pascal@36 493 find . -exec touch {} \;
pascal@36 494 find . | grep -v ^./boot | cpio -o -H newc | compressto ../rootfs.gz rootfs
pascal@0 495 fi
pascal@23 496 if [ "x$1" = "x--mkiso" ]; then
pascal@38 497 tmp=$2
pascal@37 498 [ -s $tmp/slitaz.iso ] && exit 0
pascal@0 499 mkdir -p $tmp/iso/boot/isolinux $tmp/iso/data
pascal@36 500 compressto $tmp/iso/data/sysmap.gz < $tmp/fs/boot/System.map
pascal@36 501 compressto $tmp/iso/data/linconf.gz < $tmp/fs/boot/config
pascal@36 502 compressto $tmp/iso/data/bbconf.gz < $tmp/fs/boot/config-busybox
pascal@5 503 cp $tmp/fs/boot/bundle $tmp/iso/data/bundle.sh
pascal@36 504 compressto $tmp/iso/data/log.gz < $tmp/post_install.log
pascal@0 505 cp $tmp/config_files $tmp/iso/data/files.cnf
pascal@0 506 cp $tmp/fs/etc/packages.conf $tmp/iso/data/packages.cnf
pascal@7 507 [ -s wok/busybox/receipt ] && tar czf $tmp/iso/data/wok.tgz wok/*
pascal@7 508 [ -s www/index.php ] && tar czf $tmp/iso/data/www.tgz www/*
pascal@0 509 cp $tmp/fs/boot/bzImage $tmp/iso/boot/bzImage
pascal@0 510 cp $tmp/rootfs.gz $tmp/iso/boot/rootfs
pascal@0 511 cp /boot/isolinux/isolinux.bin $tmp/iso/boot/isolinux
pascal@0 512 cat > $tmp/iso/boot/isolinux/isolinux.cfg <<EOT
pascal@27 513 label slitaz slitqw
pascal@0 514 kernel /boot/bzImage
pascal@0 515 append initrd=/boot/rootfs rw root=/dev/null vga=normal
pascal@27 516
pascal@27 517 EOT
pascal@29 518 [ -s $tmp/fs/boot/bootmenu ] && while read bin keys text; do
pascal@29 519 keys=${keys#*,}
pascal@29 520 KEY="$KEY ${keys%%,*}"
pascal@29 521 cp $tmp/fs/boot/$bin $tmp/iso/boot/$bin
pascal@36 522 kernel=kernel
pascal@36 523 [ $(stat -c %s $tmp/fs/boot/$bin) -eq 512 ] && kernel=boot
pascal@27 524 cat >> $tmp/iso/boot/isolinux/isolinux.cfg <<EOT
pascal@29 525 label ${keys//,/ } $bin
pascal@36 526 $kernel /boot/$bin
pascal@27 527
pascal@27 528 EOT
pascal@29 529 done < $tmp/fs/boot/bootmenu
pascal@27 530 [ "$KEY" ] && echo "say You can boot: slitaz (default)$KEY" >> \
pascal@27 531 $tmp/iso/boot/isolinux/isolinux.cfg
pascal@27 532 cat >> $tmp/iso/boot/isolinux/isolinux.cfg <<EOT
pascal@0 533 default slitaz
pascal@0 534 implicit 0
pascal@0 535 prompt 1
pascal@0 536 timeout 50
pascal@0 537 EOT
pascal@37 538 genisoimage -o $tmp/slitaz.iso$$ -b boot/isolinux/isolinux.bin \
pascal@0 539 -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 \
pascal@0 540 -V "Tiny SliTaz" -p "www.slitaz.org" -input-charset iso8859-1 \
pascal@0 541 -boot-info-table $tmp/iso > /dev/null 2>&1
pascal@0 542 [ -x /usr/bin/isohybrid ] &&
pascal@37 543 /usr/bin/isohybrid $tmp/slitaz.iso$$ 2> /dev/null
pascal@6 544 [ -x /usr/bin/iso2exe ] &&
pascal@37 545 /usr/bin/iso2exe $tmp/slitaz.iso$$ 2> /dev/null
pascal@37 546 mv $tmp/slitaz.iso$$ $tmp/slitaz.iso
pascal@0 547 fi
pascal@23 548 if [ "x$1" = "x--mkexe" ]; then
pascal@5 549 tmp=$2
pascal@5 550 cd $tmp
pascal@5 551 cp fs/boot/bzImage slitaz.exe
pascal@7 552 sh fs/boot/bundle slitaz.exe rootfs.gz
pascal@5 553 fi
pascal@23 554 if [ "x$1" = "x--mkimg" ]; then
pascal@0 555 tmp=$2
pascal@0 556 cd $tmp
pascal@27 557 if [ ! -s out ]; then
pascal@27 558 cp fs/boot/bzImage slitaz.img
pascal@27 559 sh fs/boot/bundle slitaz.img rootfs.gz
pascal@29 560 if [ -s fs/boot/bootmenu ]; then
pascal@37 561 echo -n "sh fs/boot/bundle out ' Boot menu'"
pascal@29 562 echo -n " slitaz.img 'Tiny SliTaz'"
pascal@29 563 while read bin button text; do
pascal@31 564 echo -n " fs/boot/$bin '${text% (*}'"
pascal@29 565 done < fs/boot/bootmenu
pascal@29 566 fi | sh
pascal@29 567 [ -s out ] || mv slitaz.img out
pascal@12 568 fi
pascal@27 569 rm -f xa* 2> /dev/null
pascal@27 570 split -b ${3:-1474560} out
pascal@27 571 A="-abcdefghijklmnopqrstuvwxyz"
pascal@27 572 mv xa${A:${4:-1}:1} floppy$4.img || mv xaa floppy1.img
pascal@27 573 [ $(stat -c %s floppy${4:-1}.img) -lt ${3:-1474560} ] &&
pascal@27 574 dd of=floppy${4:-1}.img bs=1 seek=${3:-1474560} count=0 2> /dev/null
pascal@0 575 fi
pascal@23 576 if [ "x$1" = "x--mkcfg" ]; then
pascal@0 577 tmp=$2
pascal@0 578 cd $tmp/fs
pascal@0 579 for i in $(sed 's#^/##' < ../config_files); do find $i; done | \
pascal@27 580 sort | uniq | cpio -o -H newc | compressto ../config_files.cpio.gz
pascal@0 581 fi
pascal@23 582 if [ "x$1" = "x--chkdist" ]; then
pascal@5 583 if [ pkgs/busybox-*/fs.cpio.lzma -nt dist/rootfs.cpio ]; then
pascal@5 584 cat pkgs/busybox-*/fs.cpio.lzma | unlzma | ( cd dist ; cpio -idmu )
pascal@5 585 mv -f dist/fs/* dist/
pascal@5 586 rmdir dist/fs
pascal@5 587 touch dist/*
pascal@5 588 fi
pascal@5 589 fi