Serial install of DL 1.3

View: New views
2 Messages — Rating Filter:   Alert me  

Serial install of DL 1.3

by Jacob Sandin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi,

 

I was going to try installing 1.3 but I ran into a little problem.

There is no etc-modd.tar.bz2 to add when building CF.

And therefore I can not set the security settings for Serial access.

 

In /etc/inittab

Enable

S0:2345:respawn:/sbin/agetty -L 115200 ttyS0 vt102

 

 

In /etc/securetty

Add

ttyS0

ttyS1

 

I don’t know if I can use an old etc, but I can probably create one by booting on another computer.

 

Kind Regards

Jacob


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Devil-linux-discuss mailing list
Devil-linux-discuss@...
https://lists.sourceforge.net/lists/listinfo/devil-linux-discuss

Re: Serial install of DL 1.3

by Serge Leschinsky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jacob,


Jacob Sandin wrote:
> I was going to try installing 1.3 but I ran into a little problem.
>
> There is no etc-modd.tar.bz2 to add when building CF.
>
> And therefore I can not set the security settings for Serial access.

I've tried to improve install-on-usb script in DL 1.3 and make installation with
serial access smoother.

I have no possibility to test the changes and will be very grateful if you check
the modified script. By design, you should get completely configured serial
access after script execution.

Please let me know if something will be unusable or wrong.

Thank you,

--
Serge


#!/bin/bash
#
# $Source: /cvsroot/devil-linux/build/scripts/scripts/install-on-usb,v $
# $Revision: 1.25 $
# $Date: 2008/07/11 18:51:27 $
#
# http://www.devil-linux.org
#
# This script will install Devil-Linux on a USB storage DEVICE
#
#

TMPDIR="$(pwd)/tmp-install2usb"

# You should set $EDITOR or make an editor soft link if you don't like these choices
[ -z "$EDITOR" ] && EDITOR=`which editor`
[ -z "$EDITOR" ] && EDITOR=`which nano`
[ -z "$EDITOR" ] && EDITOR=`which vim`
[ -z "$EDITOR" ] && EDITOR=`which vi`
[ -z "$EDITOR" ] && { echo "Unable to find any text editor, you won't be able to customize your menus.";
                      echo "To fix this, set EDITOR to you favorite."; }

#### Pick your favorite disk part tool:
#FDISK="fdisk"
FDISK="cfdisk"

copy_iso_file ()
{
        # $1 = source device or file
        # $2 = target file path

        isosize_bin="$TMPDIR/iso-mnt/usr/bin/isosize"
        if [ -b "$1" ]; then
                [ -f $isosize_bin ] || { echo "Utility \"$isosize_bin\" not found - can not copy from a CD."; return 1; }
                echo "copying image of CD in $1 to device mounted on $2"
                iso_info=`$isosize_bin -x $1`
                nsectors=`echo $iso_info | cut -d' ' -f3 | cut -d',' -f1`
                bs=`echo $iso_info  | cut -d' ' -f6`
                nice dd bs=$bs count=$nsectors if=$1 of=$2 || return 1
                return 0
        elif [ -f "$1" ]; then
                echo "copying source file $1 to device mounted on $2"
                if [ x"$3" != x"not_save_permissions" ] ; then
                        PRESERVE="-p"
                fi
                nice cp $PRESERVE $1 $2 || return 1
                return 0
        else
                echo "$1 is not a valid source for the ISO"
                return 1
        fi
}

ask_yes_no ()
{
        ANS=""
        read -p " (y/n) " -t 60 -n 1 -rs ANS
        echo $ANS
        [ ${ANS:-n} = "y" -o ${ANS:-n} = "Y" ] && return 0
        return 1
}

## most USB parts taken from the usb-mount script from Michael Hamilton ( michael@... )
#function scsiDevFromScsiUsb {
# echo $1 | awk -F"[-/]" '{ n=$(NF-1);  print "/dev/sd" substr("abcdefghijklmnopqrstuvwxyz", n+1, 1) "1" }'
#}
#
#function allAttachedScsiUsb {
# find /proc/scsi/ -path '/proc/scsi/usb-storage*' -type f | xargs grep -l 'Attached: Yes'
#}
#
#function allDetachedScsiUsb {
# find /proc/scsi/ -path '/proc/scsi/usb-storage*' -type f | xargs grep -l 'Attached: No'
#}

install_lilo ()
{
        echo "Configuring LILO boot sector and menu"
        cat  > $TMPDIR/lilo.conf  <<-EOF
                read-only
                compact
                lba32
                timeout = 60
                # Override dangerous defaults that rewrite the partition table:
                change-rules
                reset
                default = Devil-Linux
                message = /boot/message
                disk = /dev/sda
                bios = 0x80
                # Devil-Linux Boot Line options:
                #  DL_config=/dev/discs/disc0/part1 - loads the etc.tar.bz2 form that device
                #  DL_config_no_scan - prevents scanning for etc.tar.bz2
                #  DL_device=/dev/discs/disc0/part1 - Loads CD/ISO from that device
                #  DL_device_no_scan - Prevents scannign for CD/ISO
                #
                # Note: "/dev/hda1" type devices are not supported! Use /dev/discs/... or /dev/ide/...
                # type device names.

                image  = /boot/vmlinuz
                        label  = Devil-Linux
                        append = "init=/linuxrc $RAMDISK"
                        root = /dev/ram0
                        initrd = /boot/initrd.gz

        EOF

        echo -n "Do you want to edit the lilo menu file "
        ask_yes_no && `screen $EDITOR $TMPDIR/lilo.conf`
        cp -p $TMPDIR/lilo.conf $TMPDIR/disk-mnt/boot/ > /dev/null || return 1

        cp /boot/boot.b tmp/disk-mnt/boot/ || return 1
        cp /boot/mbr.b tmp/disk-mnt/boot/ || return 1
        lilo -r $TMPDIR/disk-mnt -C /boot/lilo.conf -M $1 || return 1
        lilo -r $TMPDIR/disk-mnt -C /boot/lilo.conf -b $1 || return 1
}

install_grub ()
{
        echo "Configuring Grub boot sector and menu..."
        grub_shell=$TMPDIR/iso-mnt/sbin/grub
        device_map=grub-tmp-map
        force_lba=""
        if [ "$INITRD_TYPE" != "INITRAMFS" ]; then
                KERNEL_OPTIONS="root=/dev/ram0 init=/linuxrc $RAMDISK"
        fi
                       
        if [ ! -f "$grub_shell" ]; then
           echo "Grub not found in ISO image - was it included in the DL build?"
           umount $TMPDIR/iso-mnt #|| exit 1
           umount $TMPDIR/disk-mnt #|| exit 1
           exit 1
        fi
       
        rm -f $device_map

        if [ "$SERIAL_CONSOLE" = "true" ]; then

                cat  > $TMPDIR/grub.conf  <<-EOF
                        timeout=10
                        serial --unit=0 --speed=$SERIALSPEED --word=8 --parity=no --stop=1
                        terminal --timeout=10 serial console
                        # Devil-Linux Boot Line options:
                        #  DL_config=/dev/discs/disc0/part1 - loads the etc.tar.bz2 form that device
                        #  DL_config_no_scan - prevents scanning for etc.tar.bz2
                        #  DL_device=/dev/discs/disc0/part1 - Loads CD/ISO from that device
                        #  DL_device_no_scan - Prevents scannign for CD/ISO
                        #
                        # Note: "/dev/hda1" type devices are not supported! Use /dev/discs/... or /dev/ide/...
                        # type device names.
                        title Devil-Linux - Serial Console
                                root (hd0,$2)
                                kernel /boot/vmlinuz rw $KERNEL_OPTIONS $RAMDISK console=tty0 console=ttyS0,${SERIALSPEED}n8
                                initrd /boot/initrd.gz
                        title Devil-Linux - Standard VGA
                                root (hd0,$2)
                                kernel /boot/vmlinuz rw $KERNEL_OPTIONS
                                initrd /boot/initrd.gz
                EOF
        else
                cat  > $TMPDIR/grub.conf  <<-EOF
                        timeout=10
                        default 3
                        splashimage=(hd0,$2)/boot/grub/devil-linux.xpm.gz
                        # Devil-Linux Boot Line options:
                        #  DL_config=/dev/discs/disc0/part1 - loads the etc.tar.bz2 form that device
                        #  DL_config_no_scan - prevents scanning for etc.tar.bz2
                        #  DL_device=/dev/discs/disc0/part1 - Loads CD/ISO from that device
                        #  DL_device_no_scan - Prevents scannign for CD/ISO
                        #
                        # Note: "/dev/hda1" type devices are not supported! Use /dev/discs/... or /dev/ide/...
                        # type device names.
                        title Devil-Linux - Standard VGA
                                root (hd0,$2)
                                kernel /boot/vmlinuz rw $KERNEL_OPTIONS
                                initrd /boot/initrd.gz
                        title Devil-Linux - VESA Frame Buffer 640x480
                                root (hd0,$2)
                                kernel /boot/vmlinuz rw $KERNEL_OPTIONS vga=769
                                initrd /boot/initrd.gz
                        title Devil-Linux - VESA Frame Buffer 800x600
                                root (hd0,$2)
                                kernel /boot/vmlinuz rw $KERNEL_OPTIONS vga=771
                                initrd /boot/initrd.gz
                        title Devil-Linux - VESA Frame Buffer 1024x768
                                root (hd0,$2)
                                kernel /boot/vmlinuz rw $KERNEL_OPTIONS vga=773
                                initrd /boot/initrd.gz
                        title Devil-Linux - Other
                                root (hd0,$2)
                                kernel /boot/vmlinuz rw $KERNEL_OPTIONS vga=ask
                                initrd /boot/initrd.gz
                EOF
        fi

        if [ -f "$TMPDIR/disk-mnt/boot/memtest" ]; then
                cat >> $TMPDIR/grub.conf  <<-EOF
                        title Memtest86
                                root (hd0,$2)
                                kernel /boot/memtest
                EOF
        fi

        echo -n "Do you want to edit the grub menu file "
        ask_yes_no && `screen $EDITOR $TMPDIR/grub.conf`
        cp -p $TMPDIR/grub.conf $TMPDIR/disk-mnt/boot/grub/ > /dev/null || return 1

        pushd $TMPDIR/disk-mnt/boot/grub > /dev/null
        rm -f menu.lst
        ln -s grub.conf menu.lst
        popd > /dev/null

        $grub_shell --batch --device-map=$device_map <<-EOF > /dev/null
                quit
                EOF

        install_drive=$(grep "$1\$" $device_map|cut -f1)
        root_drive="${install_drive%%)},0)"

        $grub_shell --batch --device-map=$device_map <<-EOF > /dev/null
                root $root_drive
                setup $force_lba $install_drive
                quit
                EOF
        rm -f $device_map
}

install_dl ()
{

        if [ -d "$TMPDIR" ]; then
                # unclean exit before
                umount $TMPDIR/iso-mnt &> /dev/null
                umount $TMPDIR/disk-mnt &> /dev/null
                rm -rf $TMPDIR &> /dev/null
        fi

        mkdir -p $TMPDIR/iso-mnt || return 1
        mkdir -p $TMPDIR/disk-mnt || return 1

        echo
        read -p "Enter DL ISO source (disk file or CD device) -> " DLISO

        if [ -L "$DLISO" ]; then
                DLISO=$(readlink -fns $DLISO)
                echo " Expanding link to: $DLISO"
        fi
        if [ ! -e "$DLISO" ]; then
                echo " Cannot find file or device:  $DLISO"
                return 1
        fi

        if [ -b "$DLISO" ]; then
                mount -t iso9660 -o ro $DLISO $TMPDIR/iso-mnt || return 1
        else
                mount -o loop,ro -t iso9660 $DLISO $TMPDIR/iso-mnt || return 1
        fi
        if [ -f "$TMPDIR/iso-mnt/DEVIL-LINUX" ]; then
                dl_version=`cat $TMPDIR/iso-mnt/DEVIL-LINUX`
                echo " Devil Linux $dl_version found in ISO"
        else
                echo
                echo "$DLISO does not seem to contain Devil-Linux!"
                return 1
        fi

        echo

        read -p "Enter DEVICE name of disk device (i.e. /dev/sda) -> " DEVICE

        [ "$FDISK" = "cfdisk" ] && $FDISK -Ps $DEVICE
        [ "$FDISK" = "fdisk" ] && $FDISK -l $DEVICE

        echo
        if [ "$BOOTLOADER" = "syslinux" ]; then
  echo "Please make sure the partition type is 'FAT16' (06) "
        else
                echo "Please make sure the partition type is 'Linux' (83) "
        fi

        echo
        echo "If you wish to store the ISO and configuration on the same media, two partitions are recommended."
        echo -n "Do you want to partition the media first? "
        ask_yes_no && $FDISK $DEVICE
       
        echo
        read -p "Enter PARTITION name of disk device to put ISO file (i.e. /dev/sda1) -> " PARTITION

        if [ -L "$PARTITION" ]; then
                PARTITION=$(readlink -fns $PARTITION)
                echo " Expanding link to full partition name for devfs : $PARTITION"
        fi
        if [ ! -b "$PARTITION" ]; then
                echo " Cannot find device:  $PARTITION"
                return 1
        fi

        if [ -L "$DEVICE" ]; then
                DEVICE=$(readlink -fns $DEVICE)
                echo " Expanding link to full device name for devfs : $DEVICE"
        fi
        if [ ! -b "$DEVICE" ]; then
                echo " Cannot find device:  $DEVICE"
                return 1
        fi

        echo

        read -p "Enter seperate partition for configuration (recommended) or enter if same -> " ETC_PART
        if [ -z "$ETC_PART" ]; then
                ETC_PART=$PARTITION
        elif [ ! -b "$ETC_PART" ]; then
                echo " Can not find partition \"$ETC_PART\""
                return 1
        else

                echo;echo -n "Would you like to format $ETC_PART ? "
                if  ask_yes_no ; then
                        format_partition $ETC_PART || return 1
                else
                # Try to mount $DEVICE
                        mount -t auto $ETC_PART $TMPDIR/etc-mnt || ( echo "Unable to mount $ETC_PART"; return 1 )
                fi

        fi

        ETC_FILE=""
        read -p "Enter configuration file to preload to disk (if any) or press enter -> " ETC_FILE
        if [ -n "$ETC_FILE" ]; then
                if [ ! -f "$ETC_FILE" ]; then
                        echo " No such file: \"$ETC_FILE\""
                        return 1
                fi
        else
                if [ -f "/DEVIL-LINUX" ]; then
                        echo;echo -n "Would you like to save current configs to disk?"
                        if  ask_yes_no ; then
                                /bin/save-config -q -d $ETC_PART || echo -e "Unable to save configs to $ETC_PART \nPlease do it manually after installation.\n\t/bin/save-config -d $ETC_PART"
                        fi
                fi
        fi

        echo
        echo "This will install DL on \"$DEVICE\" using the \"$BOOTLOADER\" bootloader. "

# Check the initrd type (INITRAMFS)
        # Decompress image
        gunzip $TMPDIR/iso-mnt/boot/initrd.gz -d -c > $TMPDIR/initrd || return 1
        if file -b $TMPDIR/initrd | grep -i "cpio archive" > /dev/null 2>&1; then
                INITRD_TYPE=INITRAMFS
        fi

        if [ "$BOOTLOADER" = "syslinux" ]; then

                echo;echo -n "All data on device $PARTITION will be lost, continue ? "
                ask_yes_no || return 1
       
                echo;echo -n "Last chance, do you really want to continue ? "
                ask_yes_no || return 1

                mkdosfs $PARTITION > /dev/null || return 1

                echo "Installing syslinux MBR"
                SIZE=$(du -b $TMPDIR/iso-mnt/boot/syslinux/mbr.bin | cut -f 1 )
                dd if=$TMPDIR/iso-mnt/boot/syslinux/mbr.bin of=$DEVICE count=$SIZE || return 1
                echo installing SysLinux boot sector
                $TMPDIR/iso-mnt/boot/syslinux/syslinux $PARTITION || return 1

                mount -t vfat $PARTITION $TMPDIR/disk-mnt || return 1

                echo "copying files"
                # Warnings about not copying subdirs cause spurious eixt here so ignore status...
                # also until a better solution is found, disable -p on cp to enable iso generation...
                cp $TMPDIR/iso-mnt/boot/* $TMPDIR/disk-mnt/ &> /dev/null # || return 1
                cp $TMPDIR/iso-mnt/{DEVIL-LINUX,LICENSE} $TMPDIR/disk-mnt/ &> /dev/null || return 1
                cat $TMPDIR/iso-mnt/isolinux.cfg | sed -e s%"/boot/"%""% > $TMPDIR/disk-mnt/syslinux.cfg || return 1
                cat $TMPDIR/iso-mnt/boot/message | sed -e s%"/boot/"%""% > $TMPDIR/disk-mnt/message || return 1
                copy_iso_file $DLISO $TMPDIR/disk-mnt/bootcd.iso not_save_permissions || return 1

        elif [ "$BOOTLOADER" = "grub" ] || [ "$BOOTLOADER" = "lilo" ]; then
                echo;echo -n "Would you like to format $PARTITION ? "
                if ask_yes_no ; then
                        format_partition $PARTITION || return 1
                fi
# Try to mount $DEVICE
                mkdir -p $TMPDIR/etc-mnt
                mount -t auto $PARTITION $TMPDIR/disk-mnt || ( echo "Unable to mount $PARTITION"; return 1 )

                echo "copying files"
                cp -a $TMPDIR/iso-mnt/boot/ $TMPDIR/disk-mnt/ > /dev/null || return 1
                cp -p $TMPDIR/iso-mnt/{DEVIL-LINUX,LICENSE} $TMPDIR/disk-mnt/ > /dev/null || return 1
                copy_iso_file $DLISO $TMPDIR/disk-mnt/bootcd.iso || return 1

                if [ -f "/DEVIL-LINUX" ]; then
                        echo;echo -n "Would you like to modify initrd image (it's mandatory if you have chosen not ext2 fs)?"
                        if  ask_yes_no  ; then
                                echo "Initrd image modifying..."
                                modify_initrd && mv -f $TMPDIR/initrd.gz $TMPDIR/disk-mnt/boot || return 1
                        fi
                fi

                if [ "$BOOTLOADER" = "grub" ]; then
                        GRUBPART=$(expr $(basename ${PARTITION} | sed -e 's/^part//' -e 's/^[hs]d[a-z]//') - 1)
                        install_grub $DEVICE $GRUBPART || return 1
                elif [ "$BOOTLOADER" = "lilo" ]; then
                        install_lilo $DEVICE || return 1
                else
                        echo "Unknown Bootloader: $BOOTLOADER"
                        return 1
                fi
        else
                echo "Unknown Bootloader: $BOOTLOADER"
                return 1
        fi

        if [ -n "$ETC_FILE" ]; then
                mount -t auto $ETC_PART $TMPDIR/etc-mnt
                echo
                echo "Copying $ETC_FILE to $TMPDIR/etc-mnt/etc-mods.tar.bz2"
                cp -p $ETC_FILE $TMPDIR/etc-mnt/etc-mods.tar.bz2 > /dev/null || return 1
                sync
                umount $TMPDIR/etc-mnt > /dev/null
        fi

# To allow login via serial console
        if [ "$SERIAL_CONSOLE" = "true" ]; then
                MESSAGE="Please allow login via serial console ttyS0 manually. \nAdd the following line to /etc-mods/inittab:\n\tS0:2345:respawn:/sbin/agetty -L $SERIALSPEED ttyS0 vt102\nAdd the following line to /etc-mods/securetty:\n\tttyS0\n";
                mount -t auto $ETC_PART $TMPDIR/etc-mnt
                echo
                echo "Modifying configs to allow login via serial console..."

                tar vpfxj $TMPDIR/etc-mnt/etc-mods.tar.bz2 -C $TMPDIR/etc-for-mods > /dev/null || \
                 ( echo "Unable to unpack etc-mods.tar.bz2..."; echo -e $MESSAGE ; return 0 );
       
                if ! grep "^S0:2345:respawn:/sbin/agetty" $TMPDIR/etc-for-mods/etc-mods/inittab; then
                        echo "S0:2345:respawn:/sbin/agetty -L $SERIALSPEED ttyS0 vt102" >> $TMPDIR/etc-for-mods/etc-mods/inittab || \
                        ( echo -e "Please allow login via serial console ttyS0 manually. \nAdd the following line to /etc-mods/inittab:\n\tS0:2345:respawn:/sbin/agetty -L $SERIALSPEED ttyS0 vt102\n"; )
                fi

                if ! grep "^ttyS0" $TMPDIR/etc-for-mods/etc-mods/securetty; then
                  echo "ttyS0" >> $TMPDIR/etc-for-mods/etc-mods/securetty || \
                        ( "Please allow login via serial console ttyS0 manually. \nAdd the following line to /etc-mods/securetty:\n\tttyS0\n"; return 0)
                fi  
               
                tar -C $TMPDIR/etc-for-mods -cpjf $TMPDIR/etc-mnt/etc-mods.tar.bz2 etc-mods && return 0 || ( echo "Unable to pack modifyed configs..."; echo -e $MESSAGE ; retutn 1 )

        fi

        return 0;
}

format_partition () {
        local PARTITION=$1

        echo -e "Your system supports the following fs:\n$(ls $(which mkfs).* | sed  's,.*\.,,')"
        read -p "Enter file system format you want to use (ext2 is preferable)  -> " FORMAT
        if [ -x $(which mkfs).$FORMAT ] ; then
         
                echo;echo -n "All data on device $PARTITION will be lost, continue ? "
                ask_yes_no || return 1

                echo;echo -n "Last chance, do you really want to continue ? "
                ask_yes_no || return 1
                if echo $FORMAT | grep ext > /dev/null; then
                        local OPTION="-I 128"
                fi
                mkfs.$FORMAT $OPTION -F $PARTITION > /dev/null || return 1

        else
                echo "Unknown FS format : $FORMAT"
                return 1
        fi
}

modify_initrd () {
#===========================================================================
# echo "Modifying of the initial ramdisk (initrd) image.... "
        mkdir -p $TMPDIR/initrd-{old,new}

        # Mount old initrd
        if [ "$INITRD_TYPE" = "INITRAMFS" ]; then
                pushd $TMPDIR/initrd-old > /dev/null && ( cat $TMPDIR/initrd | cpio -ivd 2> /dev/null ) || return 1
        else
                mount $TMPDIR/initrd $TMPDIR/initrd-old -o loop || return 1
        fi

        popd > /dev/null

        # Add marker (load all ata/sata/scsi modules). N.B. it's a workaround because  
        # mdev doesn't load necessary modules :-(
        touch $TMPDIR/initrd-old/tmp/PROBE_ALL_MODULES

        cp -ar $TMPDIR/initrd-old/* $TMPDIR/initrd-new || return 1

# Intelligently add modules to initrd image
        rm -rf $TMPDIR/initrd-new/lib/modules/*/kernel/drivers/{ata,scsi,message} || return 1

        for i in $( modinfo -F filename `lsmod | awk '{ print $1}'` 2>/dev/null | grep "fs\|ata\|scsi\|message" )
        do
                if [ ! -d $TMPDIR/initrd-new/$(dirname $i) ]; then
                        mkdir -p $TMPDIR/initrd-new/$(dirname $i)
                fi
                cp -a $TMPDIR/iso-mnt/$i $TMPDIR/initrd-new/$(dirname $i)
        done

        if [ "$INITRD_TYPE" != "INITRAMFS" ]; then
                # find out how much space we need.
                ISIZE=`du -s -k $TMPDIR/initrd-new/ | awk '{print $1}'`
       
                ISIZE=`expr $ISIZE + 2048`
       
          # create a file of 4MB (4096 KB)
          dd if=/dev/zero of=$TMPDIR/ramdisk bs=1k count=$ISIZE
       
                 # make an ext2 filesystem on it. We set the amount of unused space to 0%
          # and turn down the number of inodes to save space
          yes | mkfs -t ext2 -m 0 -i 1024 $TMPDIR/ramdisk
          tune2fs -c 0 -i 0 $TMPDIR/ramdisk
       
                # unmount old initrd
                umount $TMPDIR/initrd-old || return 1
       
          # we mount it ...
          mount -t ext2 $TMPDIR/ramdisk $TMPDIR/initrd-old -o loop || ( echo "Unable to mount $TMPDIR/ramdisk " ;  return 1)
       
          # ... and delete the lost+found directory
          rm -rf $TMPDIR/initrd-old/lost+found
       
          # then we copy the contents of our initrdtree to this filesystem
          cp -ar $TMPDIR/initrd-new/* $TMPDIR/initrd-old/  || return 1
       
          # and unmount and divorce /dev/loop4
          umount $TMPDIR/initrd-old/
          #losetup -d /dev/loop4
       
                # compressing the initial ramdisk (initrd) image
                gzip -c $TMPDIR/ramdisk > $TMPDIR/initrd.gz || return 1
        else
                pushd $TMPDIR/initrd-new > /dev/null
                find . | cpio -H newc -o | gzip -9 > $TMPDIR/initrd.gz || return 1
                popd > /dev/null
        fi
       
        # cleaning up working dirs
        rm -rf $TMPDIR/initrd-{old,new}

}
##########################################################################

echo
echo "This will install the Devil Linux ISO image to a disk device (USB/SCSI/IDE)"
echo "and make it bootable, assuming that your PC can boot this device."

### Get some user info for the install
echo
echo "Select which bootloader you want to use:"
echo " 1) SysLinux"
echo " 2) Grub"
echo " 3) Grub with serial console"
echo " 4) Lilo"
ANS=""
read -p "Choice: " -t 60 -n 1 -rs ANS
ANS=${ANS:-1}
echo $ANS

[ $ANS = "1" ] && BOOTLOADER="syslinux"
[ $ANS = "2" ] && { BOOTLOADER="grub"; SERIAL_CONSOLE=""; }
[ $ANS = "3" ] && { BOOTLOADER="grub"; SERIAL_CONSOLE="true"; }
[ $ANS = "4" ] && BOOTLOADER="lilo"

SERIALSPEED="9600"
if [ "$SERIAL_CONSOLE" = "true" ]; then
    echo
    echo "Select Baud Rate for the serial console"
    echo " 1) 2400"
    echo " 2) 4800"
    echo " 3) 9600"
    echo " 4) 19200"
    echo " 5) 38400"
    echo " 6) 57600"
    echo " 7) 115200"
    ANS=""
    read -p "Choice: " -t 60 -n 1 -rs ANS
    ANS=${ANS:-1}
    echo $ANS
    [ $ANS = "1" ] && SERIALSPEED="2400"
    [ $ANS = "2" ] && SERIALSPEED="4800"
    [ $ANS = "3" ] && SERIALSPEED="9600"
    [ $ANS = "4" ] && SERIALSPEED="19200"
    [ $ANS = "5" ] && SERIALSPEED="38400"
    [ $ANS = "6" ] && SERIALSPEED="57600"
    [ $ANS = "7" ] && SERIALSPEED="115200"
fi

RAMDISK="ramdisk_blocksize=1024"

# Do install
install_dl || echo "Install failed!"

echo "syncing and unmounting (this could take a while)"
sync
umount $TMPDIR/iso-mnt &> /dev/null
umount $TMPDIR/disk-mnt &> /dev/null
umount $TMPDIR/etc-mnt &> /dev/null

rm -rf $TMPDIR &> /dev/null

exit


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Devil-linux-discuss mailing list
Devil-linux-discuss@...
https://lists.sourceforge.net/lists/listinfo/devil-linux-discuss