# HG changeset patch # User Pascal Bellard # Date 1434378534 -7200 # Node ID 490951fbd6fd2b7d59abde021bdf33f430b2f6a3 # Parent f3e78a86c67b13e10f9ea19c59d6f748ae0142b7 syslinux/taziso: add floppyset diff -r f3e78a86c67b -r 490951fbd6fd chkrootkit/stuff/chkrootkit.u --- a/chkrootkit/stuff/chkrootkit.u Mon Jun 15 09:25:34 2015 +0200 +++ b/chkrootkit/stuff/chkrootkit.u Mon Jun 15 16:28:54 2015 +0200 @@ -1,5 +1,5 @@ ---- chkrootkit-0.48/chkrootkit -+++ chkrootkit-0.48/chkrootkit +--- chkrootkit-0.50/chkrootkit ++++ chkrootkit-0.50/chkrootkit @@ -591,8 +591,13 @@ if [ ! -z "${SHELL}" -a ! -z "${HOME}" ]; then expertmode_output "${find} ${ROOTDIR}${HOME} ${findargs} -name .*history \ @@ -15,7 +15,7 @@ fi return 5 -@@ -991,7 +996,9 @@ +@@ -986,7 +991,9 @@ ### Suckit if [ -f ${ROOTDIR}sbin/init ]; then if [ "${QUIET}" != "t" ];then printn "Searching for Suckit rootkit... "; fi @@ -26,7 +26,7 @@ cat ${ROOTDIR}/proc/1/maps | ${egrep} "init." ) >/dev/null 2>&1 then echo "Warning: ${ROOTDIR}sbin/init INFECTED" -@@ -1190,7 +1195,12 @@ +@@ -1190,7 +1197,12 @@ files=`${find} ${ROOTDIR}${HOME} ${findargs} -name '.*history' -size 0` [ ! -z "${files}" ] && \ echo "Warning: \`${files}' file size is zero" @@ -38,9 +38,9 @@ + fi + files1=`eval ${find} ${ROOTDIR}${HOME} ${findargs} -name '.*history' $files1` [ ! -z "${files1}" ] && \ - echo "Warning: \`${files}' is linked to another file" + echo "Warning: \`${files1}' is linked to another file" fi -@@ -1600,6 +1610,9 @@ +@@ -1600,6 +1612,9 @@ chk_netstat () { STATUS=${NOT_INFECTED} NETSTAT_I_L="/dev/hdl0/dev/xdta|/dev/ttyoa|/dev/pty[pqrsx]|/dev/cui|/dev/hdn0|/dev/cui221|/dev/dszy|/dev/ddth3|/dev/caca|^/prof|/dev/tux|grep|addr\.h|__bzero" diff -r f3e78a86c67b -r 490951fbd6fd syslinux/stuff/iso2exe/Makefile --- a/syslinux/stuff/iso2exe/Makefile Mon Jun 15 09:25:34 2015 +0200 +++ b/syslinux/stuff/iso2exe/Makefile Mon Jun 15 16:28:54 2015 +0200 @@ -2,7 +2,11 @@ BCC=bcc -ansi -O -0 -C-t BCCFLAGS=-D__MSDOS__ -Md -all: isohybrid.exe iso2exe meminfo.exe tazboot.exe +all: isohybrid.exe iso2exe meminfo.exe tazboot.exe taziso.built + +taziso.built: bootloader.bin + ./taziso --build + touch taziso.built meminfo.exe: meminfo.S cc -o meminfo.o -Wa,-a=meminfo.lst -c meminfo.S diff -r f3e78a86c67b -r 490951fbd6fd syslinux/stuff/iso2exe/bootloader.S --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/syslinux/stuff/iso2exe/bootloader.S Mon Jun 15 16:28:54 2015 +0200 @@ -0,0 +1,514 @@ +BOOTSEG = 0x07C0 /* original address of boot-sector */ +SYSSEG = 0x1000 /* historical load address >> 4 */ +INITSEG = 0x9000 /* boot address >> 4 */ +SETUPSEG = 0x9020 /* setup address >> 4 */ +ASK_VGA = -3 + +#ifndef SVGA_MODE +#define SVGA_MODE ASK_VGA +#endif + +#ifndef RAMDISK +#define RAMDISK 0 +#endif + +#ifndef ROOT_RDONLY +#define ROOT_RDONLY 1 +#endif + +/* some extra features */ +#define CMDLINE kernel >= 2.4 +#define OLDCMDLINE kernel < 2.4 +#define HELP display version for ? argument +#define MORETHAN16M up to 4Gb RAM, not 16Mb +#define KEYBOARDLESS_SUPPORT scan floppy swap each 5 seconds + +#define EDIT_CMDLINE +#define CMDLINE_SUPPORT +#define MOVE_CMDLINE +#define INITRD_SUPPORT +#define INITRD_AUTOADDR +#define MULTI_INITRD many in one support + + .code16 + .org 0 + +bootsect_start: + +cur_initrd_size_ofs = 494 +ramdisk_image_ofs = 0x218 +ramdisk_image = bootsect_start+ramdisk_image_ofs +ramdisk_size_ofs = 0x21C +ramdisk_size = bootsect_start+ramdisk_size_ofs +cmd_line_ptr_ofs = 0x228 +cmd_line_ptr = bootsect_start+cmd_line_ptr_ofs +setup_sects = bootsect_start+497 +syssize = bootsect_start+500 +boot_flag_ofs = 510 +boot_flag = bootsect_start+boot_flag_ofs + + +stacktop = 0x9E00 # in 0x8000 .. 0xA000 +zeroed = 48+10 # gdt + zeroed registers +.macro INIT_REGS + movw $stacktop-zeroed, %di # stacktop is an arbitrary value >= + # length of bootsect + length of + # setup + room for stack; + # 12 is disk parm size. + pushw $INITSEG + popw %ss # %ss contain INITSEG + movw %di, %sp # put stack at INITSEG:stacktop-... + pushw %ss + popw %es # %es = %ss = INITSEG + xorw %ax, %ax # %ax = 0 +#if defined(CMDLINE) + movw $zeroed+1, %cx # clear gdt + offset, %ds, limits, cmdline="" + rep # don't worry about cld + stosb # already done above + decw %di +#else + movw $zeroed/2, %cx # clear gdt + offset, %ds, limits + rep # don't worry about cld + stosw # already done above +#endif + popw %bx # offset = 0 +.endm + +LOADSEG = 0x8000 # 0x1000 multiple, up to 512K zImage +LOADSZ = 0x10000 + +# bootsect_start: + INIT_REGS + popw %ds # %ds = 0 + movb setup_sects+0x7C00, %al # read bootsector + setup + incw %ax # %ax = setup_sects+bootsect + popw %fs # %fs = 0 + +# Many BIOS's default disk parameter tables will not recognize +# multi-sector reads beyond the maximum sector number specified +# in the default diskette parameter tables - this may mean 7 +# sectors in some cases. +# +# Since single sector reads are slow and out of the question, +# we must take care of this by creating new parameter tables +# (for the first disk) in RAM. We can set the maximum sector +# count to 36 - the most we will encounter on an ED 2.88. +# +# High doesn't hurt. Low does. Let's use the max: 63 + + ldsw 0x78(%bx), %si # %ds:%bx+0x78 is parameter table address + popw %di + pushw %es + pushw %di +#ifdef CMDLINE_SUPPORT + movw $0, %bp # patched by installer (7C22) +skipcmdline: +#define cmd_line_ptr 0x22 +#endif + movb $6, %cl # copy 12 bytes + rep # don't worry about cld + movsw # already done above + pushw %ss + popw %ds # now %ds = %es = %ss = INITSEG + popl %fs:0x78(%bx) # update parameter table address + movb $63, 0x4-12(%di) # patch sector count, %di = stacktop + cli + + xchg %ax, %di # sector count + popw %ax # limits = 0 + incw %cx # cylinder 0, sector 1, clear Z + call read_first_sectors # read setup +loadsys: + movw $0x200,%si +type_of_loader = 0x10 +loadflags = 0x11 +heap_end_ptr = 0x24 + orw $0x8020, type_of_loader(%si) # loader type = 0x20 = bootsect-loader + movb $(stacktop-0x300)/256, heap_end_ptr+1(%si) + call puts_version # show which kernel we are loading + +#ifdef CMDLINE_SUPPORT +# The cmdline can be entered and modifed at boot time. +# Only characters before the cursor are passed to the kernel. + + xorw %si, %si + orw cmd_line_ptr-7(%bx), %si + jz nocmdline +#ifdef OLDCMDLINE + movw $0xA33F, cmd_line_ptr-2-7(%bx) +#endif + call puts +#if defined(MOVE_CMDLINE) || (defined(EDIT_CMDLINE) && defined(KEYBOARDLESS_SUPPORT)) + pushw %di +#endif +#ifdef EDIT_CMDLINE +cmdlp: + movb $0x20, %al # clear end of line +cmdlpz: + call putc # with Space + subb $0x18, %al # and BackSpace + jnc cmdlpz + decw %si +cmdget: +#ifdef KEYBOARDLESS_SUPPORT + call wait4key +#else + int $0x16 +#endif + cbw # %ah = 0, get keyboard character + cmpb $8, %al # BackSpace ? + je cmdbs + movb %al, (%si) # store char + lodsw # %si += 2 +cmdbs: + cmpw %si, cmd_line_ptr-7(%bx) + je cmdget + call putc + cmpb $10, %al # Enter/linefeed ? + jne cmdlp + movb %bh,-2(%si) # set end of string and remove CR +endcmdline: +#endif +#ifdef MOVE_CMDLINE + pushw %ss + popw %es + movw $0x8000, %di + movw %di, %si + xchgw %si, cmd_line_ptr-7(%bx) + movb $0x2, %ch + rep + movsb +#endif +#if defined(EDIT_CMDLINE) || (defined(MOVE_CMDLINE) && defined(KEYBOARD_TIMEOUT)) + popw %di +#endif +nocmdline: +#endif + +# This routine loads the system at address LOADSEG, making sure +# no 64kB boundaries are crossed. We try to load it as fast as +# possible, loading whole tracks whenever we can. + +.macro autoaddr base +#ifdef INITRD_AUTOADDR + movb $0x88, %ah + int $0x15 + //jc NeedMoreRAM # error code 80 or 86 + cmpw $0xC000, %ax # more than 49M ? + jb NeedMoreRAM + movb %ch, bootsect_dst_base_hi(%si) # initramfs @ 32M + movb %ch, ramdisk_image_ofs+3-\base +NeedMoreRAM: +#endif +.endm + +bootsect_src_limit = 16 +bootsect_dst_limit = 24 +bootsect_src_base = 18 +bootsect_dst_base = 26 # bits 0..23 +bootsect_dst_base_hi = 31 # bits 24..31 + popw %bx # clear %bx + movw %sp, %si # for bootsect_gdt +init_gdt: + decw bootsect_src_limit(%bx,%si) # max 64Kb + movw $0x9300+(LOADSEG/0x1000), bootsect_src_base+2(%bx,%si) + xorb $bootsect_dst_limit-bootsect_src_limit, %bl + jne init_gdt +#ifdef INITRD_SUPPORT + movw $syssize, %bx + movb $5, %cl +code32_start = 0x214 + movw code32_start+1, %ax # destination = 0x00100000 or 0x00010000 +initrdlp: + movl (%bx), %ebx + decl %ebx + shrl %cl, %ebx +#else +code32_start = 0x214 + movw code32_start+1, %ax # destination = 0x00100000 or 0x00010000 + movl syssize, %ebx + decl %ebx + shrl $5, %ebx +#endif +#ifdef MORETHAN16M + incl %ebx +#else + incw %bx +#endif +syslp: + movw %ax, bootsect_dst_base+1(%si) +#ifdef MORETHAN16M + movl $LOADSZ/512, %edi # size in sectors + subl %edi, %ebx +#else + movw $LOADSZ/512, %di # size in sectors + subw %di, %bx +#endif + pushf + jnc not_last + addw %bx, %di +not_last: +#ifdef MULTI_INITRD + pushw %di +#endif + pushw %ax + pushw %bx + pushw %si + xorw %bx,%bx + pushw $LOADSEG + popw %es +patchcall: + call read_sectors # update %bp + popw %si + popw %bx + movw %es, %cx # word count = LOADSZ/2 (= LOADSEG) + movb $0x87, %ah + pushw %ss + popw %es # restore es + int $0x15 # max 16M, maybe more... + popw %ax +#ifdef MULTI_INITRD + popw %di + shlw $1,%di # sectors to pages + addw %di, %ax +#ifdef MORETHAN16M + adcb %cl, bootsect_dst_base_hi(%si) # breaks 16M limit ? +#endif +#else +#ifdef MORETHAN16M + addw $0x100, %ax # next dest (ax+=LOADSZ/256) + adcb %cl, bootsect_dst_base_hi(%si) # breaks 16M limit ? +#else + incb %ah # next dest (ax+=LOADSZ/256) +#endif +#endif + popf + ja syslp +#ifdef INITRD_SUPPORT +initrdlp2: +#ifdef INITRD_AUTOADDR + movw $0x209, %cx +#else + movb $9, %cl +#endif +#ifdef MULTI_INITRD + movw $cur_initrd_size_ofs, %di + movw (%di), %bx + addw $4, (%di) + shrw %cl, boot_flag_ofs-cur_initrd_size_ofs(%di) + je nextInitrd + orw %bx, %bx + je bootit # no initrd + autoaddr cur_initrd_size_ofs(%di) + movw ramdisk_image+1,%ax + jmp initrdlp +nextInitrd: + pushw %bx + movl -4(%bx), %ebx + addl %ebx, ramdisk_size_ofs-cur_initrd_size_ofs(%di) + popw %bx + cmpb 2(%di), %bl + jb initrdlp +#else + movw $ramdisk_size, %bx + autoaddr ramdisk_size_ofs(%bx) + movw ramdisk_image+1,%ax +#ifdef MORETHAN16M + cmpb %cl, ramdisk_image+2-ramdisk_size(%bx) + jb bootit + shrw %cl, boot_flag-ramdisk_size(%bx) + jne initrdlp +#else + cmpw %ax, bootsect_dst_base+1(%si) + jb initrdlp +#endif +#endif +#endif +#ifdef MULTI_INITRD +bootit: + jcxz read_sectorslp +#endif + +# This procedure turns off the floppy drive motor, so +# that we enter the kernel in a known state, and +# don't have to worry about it later. + +kill_motor: + xchgw %ax, %di # reset FDC (%di < 128) + int $0x13 + +# After that (everything loaded), we jump to the setup-routine +# loaded directly after the bootblock: +# Segments are as follows: %ds = %ss = INITSEG + + ljmp $SETUPSEG, $0 + +# read_sectors reads %di sectors into %es:0 buffer. +# %es:0 is updated to the next memory location. +# First, sectors are read sector by sector until +# sector per track count is known. Then they are +# read track by track. +# Assume no error on first track. + +#define FLOPPY_CYLINDERS 80 +#define FLOPPY_HEADS 2 + +check_limits: + popw %dx + cmpb %al, %cl # max sector known ? + ja next_head # no -> store it + pushaw + int $0x13 # reset controler + stc + call putcdot # print '-' +read_sectorslp: + popaw +bdendlp: + pushw %dx # some bios break dx... + pushw %ax # limits + subb %cl, %al # sectors remaining in track + ja tolastsect + movb $1, %al # 1 sector mini +tolastsect: + cmpw %di, %ax + jb more1trk + movw %di, %ax # sectors to read +more1trk: + pushw %ax # save context + movb $2, %ah # cmd: read chs + int $0x13 + popw %dx # save %ax + popw %ax # limits + jc check_limits + xchgw %ax, %bp + addw %dx,%cx # next sector + movw %cx, %gs + addb %dl,%bh + addb %dl,%bh # next location + subw %dx,%di # update sector counter + popw %dx + jz putcdot +read_sectors: + movw %gs, %cx +# al is last sector+1 +# ah is 0 + xchgw %ax, %bp + cmpb %al,%cl # reach sector limit ? + jne bdendlp +next_head: + movb %cl,%al + movb $1, %cl # first sector +inc_head: + xorb %cl, %dh # next head + jne bdendlp # reach head limit ? + incb %ch # next cylinder +read_first_sectors: + cmpb $FLOPPY_CYLINDERS,%ch # reach cylinder limit ? + jne bdendlp +next_floppy: + movb $0,%ch # first cylinder + pushaw + movw $swap_floppy,%si +#ifdef KEYBOARDLESS_SUPPORT + pushw %bx + call puts + popw %bx + movw %si, %bp +waitfloppy: + call wait + jne waitfloppydone +#ifdef MULTI_INITRD + decb (%si) # max_timeouts + jz gobootit +#endif + pushw %dx # some bios break dx... + cbw + int $0x13 # reset FDC + movw $0x201,%ax + int $0x13 # read first sector + popw %dx + rclb $1,%ah # floppy changed 06=>0D no error 00 + cmpb -2(%bp), %ah # 0D then 00 + jne waitfloppy # no => try again + incw %bp + decw %ax # was 0001 ? + jne waitfloppy +waitfloppydone: +#else + call puts + cbw # %ah = 0, get keyboard character + int $0x16 +#endif +#ifdef MULTI_INITRD + orb $0x20, %al + cmp $'b', %al + jnz read_sectorslp +gobootit: + //movw ramdisk_size+2-max_timeouts(%si), %cx + .byte 0x8B, 0x4C, ramdisk_size+2-max_timeouts + jmp bootit +#else + jmp read_sectorslp +#endif + +putcdot: + movb $'.'+3, %al // . = success, - = failure +putclf: + sbbb $3, %al +putc: + movb $0xe, %ah + movw $7, %bx # one dot each 64k + int $0x10 + cmp $0xd, %al # CR ? + je putclf + ret + +#ifdef KEYBOARDLESS_SUPPORT +clock = 0x46C +wait: +wait4key: + movw $clock, %di +#define DELAY 5 + movb $257-(DELAY*182)/10, %fs:(%di) +waitkbd: + movw $0x10D, %ax # test keyboard, timeout => CR + cmpb %fs:(%di),%ah + je waitdone + int $0x16 + jz waitkbd + cbw + int $0x16 # eat char + movw %di, %fs # disable timeout + incw %di # clear Z +waitdone: + ret +#endif + +#define kernel_version_offset 0xE +puts_version: + addw kernel_version_offset(%si),%si # starting protocol 2.00, Kernel 1.3.73 +puts: + movb $0xd, %al # CR +putcs: + call putc + lodsb + cmpb $0, %al # end of string is any byte <= 0 + jg putcs + ret + +swap_floppy: +#ifdef MULTI_INITRD + .ascii "B or " +#endif + .ascii "Next!" + .byte 7,13,0 # swap detection needs 13, 0 +#ifdef MULTI_INITRD +max_timeouts: + .byte 20 +table: + .org cur_initrd_size_ofs +cur_initrd_size: + .word table + .byte table+4-256 +#endif + .org 0x1F1 diff -r f3e78a86c67b -r 490951fbd6fd syslinux/stuff/iso2exe/taziso --- a/syslinux/stuff/iso2exe/taziso Mon Jun 15 09:25:34 2015 +0200 +++ b/syslinux/stuff/iso2exe/taziso Mon Jun 15 16:28:54 2015 +0200 @@ -32,18 +32,14 @@ gettazboot() { echo "Creating $(basename $1) ..." - if [ $(get 0 "$ISO") -eq 23117 ]; then - O=$(($(get 64 "$ISO") - 0xC0)) - L=$(($(get 20 "$ISO") - 0xC0 - $(get 24 "$ISO") - $O)) - S=$((32+$L)) - P=$((($S+511)/512)) - E=$((4096-(32*$P))) - words2bin 0x5A4D $(($S%512)) $P 0 2 $E -1 $((${2:-0}-16)) \ - -2 0 256 -16 28 0x6C53 0x5469 0x7A61 > $1 - ddq bs=1 count=$L skip=$(echo $O) if="$ISO" >> $1 - else - wget -O $1 http://mirror.slitaz.org/boot/tazboot.exe - fi + O=$(($(get 64 $ISO) - 0xC0)) + L=$(($(get 20 $ISO) - 0xC0 - $(get 24 $ISO) - $O)) + S=$((32+$L)) + P=$((($S+511)/512)) + E=$((4096-(32*$P))) + words2bin 0x5A4D $(($S%512)) $P 0 2 $E -1 $((${2:-0}-16)) \ + -2 0 256 -16 28 0x6C53 0x5469 0x7A61 > $1 + ddq bs=1 count=$L skip=$(echo $O) if=$ISO >> $1 } uncpio() @@ -415,7 +411,9 @@ mnt=/tmp/mnt$$ mkdir -p $mnt $1 $2 || return - wget -O $mnt/slitaz/boot/grldr http://mirror.slitaz.org/boot/grldr + for i in bootlace.com grubinst.exe grldr ; do + wget -O $mnt/slitaz/boot/$i http://mirror.slitaz.org/boot/$i + done readtazbootconf cat > $mnt/slitaz/boot/menu.lst < attrib +r +h +s boot.ini See http://diddy.boot-land.net/grub4dos/files/README_GRUB4DOS.txt +and http://xpt.sourceforge.net/techdocs/nix/disk/boot/boot07-GrubForDosInfo/ar01s03.html EOT - ( cd $mnt ; zip -r9 $(basename "$ISO" .iso).zip slitaz ) + ( cd $mnt ; echo 'See \slitaz\boot\install.txt to launch SliTaz.' | \ + zip -zr9 $(basename $ISO .iso).zip slitaz ) [ "$(which advzip)" ] && advzip -z4 $mnt/*.zip mv $mnt/*.zip . - ls -l $PWD/$(basename "$ISO" .iso).zip + ls -l $PWD/$(basename $ISO .iso).zip umount $mnt rm -rf $mnt } @@ -805,17 +805,22 @@ ishybrid() { - [ $(get 510 "$ISO") -eq 43605 ] || return - C=$((2048*$(get $(((17*2048) + 71)) "$ISO" 4))) - [ $(get $C "$ISO" 4) -eq 1 ] || return - [ $(get $(($C+30)) "$ISO" 4) -eq $((0x88AA55)) ] || return - C=$((2048*$(get $(($C+40)) "$ISO" 4))) - [ $(get $(($C+64)) "$ISO" 4) -eq 1886961915 ] && menuitem "$@" + [ $(get 510 $ISO) -eq 43605 ] || return + C=$((2048*$(get $(((17*2048) + 71)) $ISO 4))) + [ $(get $C $ISO 4) -eq 1 ] || return + [ $(get $(($C+30)) $ISO 4) -eq $((0x88AA55)) ] || return + C=$((2048*$(get $(($C+40)) $ISO 4))) + [ $(get $(($C+64)) $ISO 4) -eq 1886961915 ] && menuitem "$@" } isiso() { - [ $(get 32769 "$ISO" 4) -eq 808469571 ] && menuitem "$@" + [ $(get 32769 $ISO 4) -eq 808469571 ] && menuitem "$@" +} + +hastazboot() +{ + [ $(get 0 $ISO) -eq 23117 ] && menuitem "$@" } burnable() @@ -842,22 +847,22 @@ gotisomd5() { [ "$(which md5sum 2> /dev/null)" ] && - [ $(get 0 "$ISO") -eq 23117 ] && - [ $(get 18 "$ISO") -ne 0 ] && menuitem "$@" + [ $(get 0 $ISO) -eq 23117 ] && + [ $(get 18 $ISO) -ne 0 ] && menuitem "$@" } isomd5() { dotwait "Checking iso image" - [ "$(ddq if="$ISO" bs=2k skip=16 \ - count=$(echo $(get 32848 "$ISO" 4)) | md5sum)" == \ - "$(ddq if="$ISO" bs=16 count=1 skip=2047 | od -N 16 -t x1 -An | \ + [ "$(ddq if=$ISO bs=2k skip=16 \ + count=$(echo $(get 32848 $ISO 4)) | md5sum)" == \ + "$(ddq if=$ISO bs=16 count=1 skip=2047 | od -N 16 -t x1 -An | \ sed 's/ //g') -" ] && echo "OK" || echo "ERROR" echo -en "\rChecking iso hybrid boot..." - n=$(($(get 2 "$ISO")-1+($(get 4 "$ISO")-1)*512)) + n=$(($(get 2 $ISO)-1+($(get 4 $ISO)-1)*512)) if [ $n -lt 40000 -a $n -gt 32768 ]; then - s=$(get 0 "$ISO" 2 $n | awk '{ i+= $0 } END { print i }') - [ $(((1+$s+$(get $(($n+1)) "$ISO" 1)) % 65536)) -eq 0 ] && + s=$(get 0 $ISO 2 $n | awk '{ i+= $0 } END { print i }') + [ $(((1+$s+$(get $(($n+1)) $ISO 1)) % 65536)) -eq 0 ] && echo "OK" || echo "ERROR" fi rm -f /tmp/wait @@ -921,8 +926,8 @@ usbdev || return # perform dd in progress bar - max=$(($(stat -c %s "$ISO")/2048)) - i=0; ddq if="$ISO" bs=1024k | ( + max=$(($(stat -c %s $ISO)/2048)) + i=0; ddq if=$ISO bs=1024k | ( while ddq bs=1024k count=1 ; do i=$(($i + 1)) [ $i -gt $max ] && break @@ -992,7 +997,7 @@ exec 3>&- [ $retval -eq 0 ] || return [ "$format" != "none" ] && tazusb format $device "SliTaz" $format - tazusb gen-iso2usb "$ISO" $device + tazusb gen-iso2usb $ISO $device } dokexec() @@ -1014,8 +1019,8 @@ flavdata() { - [ $(get 512 "$ISO") -eq 35615 ] && n=1 || n=$((1+$(get 417 "$ISO" 1))) - dd if="$ISO" bs=512 skip=$n count=20 2>/dev/null | zcat 2>/dev/null + [ $(get 1024 $ISO) -eq 35615 ] && n=2 || n=$((1+$(get 417 $ISO 1))) + dd if=$ISO bs=512 skip=$n count=20 2>/dev/null | zcat 2>/dev/null } hasflavinfo() @@ -1044,6 +1049,135 @@ rm -rf /tmp/data } +if [ "$1" == "--build" ]; then #install-begin + uuencode -m - < bootloader.bin | sed -e '/^bootloader$/r/dev/stdin' \ + -e '/^bootloader$/d' -e '/install-begin$/,/install-end$/d' -i $0 + exit +fi #install-end +parse_isolinux() +{ + awk 'BEGIN { IGNORECASE=1 } +{ + if ($1 == "LABEL") { + label=$2 + if (auto == "") auto=label + } + if ($1 == "KERNEL" || $1 == "COM32") kernel[label]=$2 + if ($1 == "INITRD") initrd[label]=$2 + if ($1 == "APPEND") { + i=2 + if (kernel[label] ~ "ifmem.c32") { + auto=$3 + next + } + if (kernel[label] ~ "c32box.c32") { + if ($2 == "linux") { kernel[label]=$3; i=4 } + if ($2 == "ifmem") { auto=$4; next } + } + if (kernel[label] ~ "ifcpu64.c32") { auto=$4; next } + while (i <= NF) { + if ($i ~ "^initrd=") initrd[label]=substr($i,8) + else cmdline[label]=cmdline[label] " " $i + i++ + } + } +} +END { + print "KERNEL=\"" kernel[auto] "\"" + print "INITRD=\"" initrd[auto] "\"" + print "CMDLINE=\"" substr(cmdline[auto],2) "\"" +}' +} + +locase() +{ + echo "$1" | tr [A-Z] [a-z] +} + +floppyset() +{ + gotcdfile isolinux.cfg + parse_isolinux < $file > /tmp/var$$ + . /tmp/var$$ + rm -f /tmp/var$$ + [ -e /media/cdrom/$KERNEL ] || KERNEL=$(locase $KERNEL) + [ $(get 514 /media/cdrom/$KERNEL 4) -eq 1400005704 ] || return + n=$(($(get 497 /media/cdrom/$KERNEL 1)+1)) + ddq bs=512 count=$n if=/media/cdrom/$KERNEL of=/tmp/fd$$ + uudecode <> /tmp/fd$$ + bytes2bin $n | ddq conv=notrunc \ + bs=1 seek=497 count=1 of=/tmp/fd$$ + words2bin $pos | ddq conv=notrunc \ + bs=1 seek=34 count=2 of=/tmp/fd$$ + [ $(get 518 /media/cdrom/$KERNEL 4) -ge 514 ] && + words2bin $pos 9 | ddq conv=notrunc \ + bs=1 seek=552 count=4 of=/tmp/fd$$ + fi + syssize=$(echo $(get 500 /tmp/fd$$ 4)) + ddq bs=512 skip=$n if=/media/cdrom/$KERNEL | cat - /dev/zero | \ + ddq bs=512 count=$((($syssize+31)/32)) >> /tmp/fd$$ + base=$(stat -c %s /tmp/fd$$) + len= + if [ "$INITRD" ]; then + l=0 + tot=0 + for i in ${INITRD//,/ }; do + [ -e /media/cdrom/$i ] || i=$(locase $i) + ddq if=/media/cdrom/$i >> /tmp/fd$$ + l=$(($l+$(stat -c %s /media/cdrom/$i))) + r=$((4 - ($l % 4))) + if [ $r -ne 4 ]; then + ddq if=/dev/zero bs=1 count=$r >> /tmp/fd$$ + l=$(($l + $r)) + fi + [ "$i" == "rootfs.gz" ] && case "$INITRD" in + rootfs.gz,rootfs*) continue # loram + esac + len="$len $l"; l=0 + tot=$(($tot+$l)) + done + page=4096 + rdadrs=$(((($syssize*16)+0x1F0000) & -$page)) + words2bin $(($rdadrs & 0xFFFF)) $(($rdadrs >> 16)) | ddq \ + conv=notrunc bs=1 seek=536 count=4 of=/tmp/fd$$ + fi + n=$(echo $len | wc -w) + if [ $((494 - $(get 494 /tmp/fd$$))) -ge $(($n * 4)) ]; then + i=$(($(get 494 /tmp/fd$$))) + bytes2bin $(($i + ($n*4) - 256)) | ddq bs=1 conv=notrunc \ + seek=496 count=1 of=/tmp/fd$$ + else + i=$(($pos + 0x1FC - ($n*4))) + bytes2bin $(($i % 256)) $((i / 256)) 252 | ddq bs=1 \ + conv=notrunc seek=494 count=3 of=/tmp/fd$$ + fi + for r in $len ; do + words2bin $(($r & 0xFFFF)) $(($r >> 16)) | ddq conv=notrunc \ + bs=1 seek=$i count=4 of=/tmp/fd$$ + i=$(($i + 4)) + done + split -b 1440k /tmp/fd$$ fd$$ + rm -f /tmp/fd$$ + n=1; i=0; r=0 + set -- $len + ls fd$$* | while read file ; do + if [ $i -gt $(($1+$base)) ]; then + shift + r=$(($r+100)); n=0; i=0; base=0 + fi + ddq of=$file bs=18k seek=80 count=0 + i=$(($i+1474560)) + printf "mv %s fd%03d.img\n" $file $(($r+$n)) + n=$(($n+1)) + done | sh + ls fd???.img +} + quit() { umount -d /media/cdrom @@ -1052,7 +1186,7 @@ ISO="${1:-/dev/null}" [ -z "$(isiso 2> /dev/null)" ] && echo "Usage : $0 file.iso" && exit 1 -mount -o loop,ro "$ISO" /media/cdrom +mount -o loop,ro $ISO /media/cdrom if [ "$2" == "list" ]; then sed '/^\$(.*") \\/!d;s/^\$(\(.*\)").*/\1"/' $0 | while read line; do @@ -1064,9 +1198,10 @@ if grep -q "^$2()" $0; then exe=$2 shift 2 - if [ "$(eval $(grep "\"$exe\"" $0 | \ - sed '/^\$/!d;s/.(\(.*\)[\t ]*".*"[\t ]*".*/\1/'))" ]; then + if [ -n "$(eval $(grep "\"$exe\"" $0 | sed \ + '/^\$/!d;s/.(\(.*\)[\t ]*".*"[\t ]*".*/\1/'))" ]; then grep "\"$exe\"" $0 | sed '/^\$/!d;s/.*"[\t ]*"\(.*\)".*/\1/' + echo ---- $exe "$@" fi quit @@ -1091,7 +1226,8 @@ $(xfile tazusb "usbkey" "USB key read/write installation") \ $(ishybrid "usbbootkey" "USB boot key (read only)") \ $(hasflavinfo "showfavinfo" "Show flavor extra info") \ -$(menuitem "tazboot" "Get tazboot.exe Linux loader") \ +$(cdfile isolinux.cfg "floppyset" "Boot floppy set") \ +$(hastazboot "tazboot" "Get tazboot.exe Linux loader") \ $(cdexe boot/bzImage "bzimage" "Get linux DOS/EXE file") \ $(cdexe 'memtest*' "memtest" "Get Memtest86 DOS/EXE file") \ $(cdfilef 'memtest*' "fdmemtest" "Create a Memtest86 boot floppy") \ @@ -1107,6 +1243,6 @@ retval=$? exec 3>&- rm -f /tmp/dialog$$ - [ $retval -eq 0 ] || continue + [ $retval -eq 0 ] || break $value done