Changeset 1684


Ignore:
Timestamp:
Oct 20, 2007, 10:35:10 AM (12 years ago)
Author:
bruno
Message:

Backport USB support for Key/disks from stable to 2.2.5 for mindi

Location:
branches/2.2.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi/mindi

    r1667 r1684  
    5151PROMPT_MAKE_CD_IMAGE="yes"
    5252    # Ask if you want to make a CD Image to be written?
     53    # if this is set to 'no', then the image will be created automatically
     54
     55PROMPT_MAKE_USB_IMAGE="yes"
     56    # Ask if you want to make a USB Image to be written?
    5357    # if this is set to 'no', then the image will be created automatically
    5458
     
    775779        [ "$modres" -eq "3" ] && echo -en "\t|"
    776780    done
    777     if [ _"$MONDO_SHARE" != _"" ] ; then
     781    if [ _"$MONDO_SHARE" != _"" ]; then
    778782        mkdir -p $bigdir/tmp
    779783        mkdir -p $bigdir/sbin
     
    12131217    [ -e "$MY_FSTAB" ] || Die "Cannot find your fstab file ($MY_FSTAB)"
    12141218
    1215     rm -f $mountlist
    1216     mkdir -p $mountlist
    1217     rm -Rf $mountlist
     1219    [ "$mountlist" != "" ] && rm -Rf $mountlist
    12181220    > $mountlist
    12191221    echo -en "\rHang on...\r"
     
    16171619OfferToMakeBootableISO() {
    16181620    local i old_pwd
    1619     if [ "$PROMPT_MAKE_CD_IMAGE" = "yes" ] && [ _"$MONDO_SHARE" = _"" ] ; then
     1621    if [ "$PROMPT_MAKE_CD_IMAGE" = "yes" ] && [ _"$MONDO_SHARE" = _"" ]; then
    16201622        echo -en "Shall I make a bootable CD image? (y/[n]) "
    16211623        read i
     
    16791681    rm -f $MINDI_TMP/mkisofs.log
    16801682    cd $old_pwd
     1683}
     1684
     1685
     1686OfferToMakeBootableUSB() {
     1687    local i old_pwd
     1688    if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ] && [ _"$MONDO_SHARE" = _"" ]; then
     1689        echo "Shall I make a bootable USB image ?"
     1690        echo -en "WARNING: This will erase all content on $USBDEVICE (y/[n]) "
     1691        read i
     1692        [ "$i" != "y" ] && [ "$i" != "Y" ] && return 0
     1693    fi
     1694    if [ _"$MINDI_TMP" = _"" ]; then
     1695        Die "MINDI_TMP undefined"
     1696    fi
     1697    rm -Rf $MINDI_TMP/usb
     1698    mkdir -p $MINDI_TMP/usb
     1699    USBPART="${USBDEVICE}1"
     1700
     1701    echo -en "Transforming $USBDEVICE in a Bootable device "
     1702    echo -en "."
     1703    echo "Transforming $USBDEVICE in a Bootable device"  >> $LOGFILE
     1704    echo "Checking $USBDEVICE" >> $LOGFILE
     1705    $FDISK -l $USBDEVICE 2>&1 >> $LOGFILE
     1706    if [ $? -ne 0 ]; then
     1707        echo "Unable to access $USBDEVICE" | tee -a $LOGFILE
     1708        echo "Make sure your USB device is pluged in" | tee -a $LOGFILE
     1709        exit -1
     1710    fi
     1711    echo -en "."
     1712    echo "Erasing $USBDEVICE" >> $LOGFILE
     1713    $FDISK $USBDEVICE 2>&1 >> $LOGFILE << EOF
     1714d
     1715d
     1716d
     1717d
     1718n
     1719p
     17201
     1721
     1722
     1723t
     1724b
     1725a
     17261
     1727w
     1728EOF
     1729    if [ $? -ne 0 ]; then
     1730        echo "Unable to create a vfat Filesystem on $USBDEVICE" | tee -a $LOGFILE
     1731        echo "Make sure your USB device is pluged in" | tee -a $LOGFILE
     1732        $FDISK -l $USBDEVICE 2>&1 | tee -a $LOGFILE
     1733        MindiExit -1
     1734    fi
     1735    echo -en "."
     1736    echo "Creating a vfat filesystem on $USBPART" >> $LOGFILE
     1737    mkfs -t vfat $USBPART 2>&1 >> $LOGFILE
     1738    if [ $? -ne 0 ]; then
     1739        echo "Unable to create a vfat filesystem on $USBPART" | tee -a $LOGFILE
     1740        echo "Make sure your USB device is pluged in and partitioned ($USBPART must exist on it)" | tee -a $LOGFILE
     1741        $FDISK -l $USBDEVICE 2>&1 | tee -a $LOGFILE
     1742        MindiExit -1
     1743    fi
     1744    echo -en "."
     1745    echo "Mounting $USBPART on $MINDI_TMP/usb" >> $LOGFILE
     1746    mount $USBPART $MINDI_TMP/usb 2>> $LOGFILE
     1747    if [ $? -ne 0 ]; then
     1748        echo "Unable to mount $USBPART on $MINDI_TMP/usb" | tee -a $LOGFILE
     1749        echo "Make sure your USB device is pluged in, partitioned and formated ($USBPART must exist on it)" | tee -a $LOGFILE
     1750        $FDISK -l $USBDEVICE 2>&1 | tee -a $LOGFILE
     1751        MindiExit -1
     1752    fi
     1753    echo -en "."
     1754    mkdir -p $MINDI_TMP/usb/{images,archives}
     1755    cp -f $1/*.img $1/*.gz $MINDI_TMP/usb/images 2>> $LOGFILE || LogIt "OfferToMakeBootableUSB: Cannot copy $i to $MINDI_TMP/iso/images"
     1756    echo -en "."
     1757    old_pwd=`pwd`
     1758    cd $MINDI_TMP/usb
     1759    echo "mindi_lib = $MINDI_LIB" >> $LOGFILE
     1760    for i in memdisk memtest.bin memtest.img ; do
     1761        j=$MINDI_LIB/$i
     1762        k=$MINDI_TMP/usb
     1763        if [ -e "$j" ] ; then
     1764            LogIt "Copying $j to $k"
     1765            cp -f $j $k 2> /dev/null || Die "Failed to copy $j to $k"
     1766            cp -f $j $MINDI_TMP 2> /dev/null || Die "Failed to copy $j to $MINDI_TMP"
     1767            if [ _"$MONDO_SHARE" != _"" ]; then
     1768                cp -f $j $MONDO_ROOT 2>> $LOGFILE || Die "Failed to copy $j to $MONDO_ROOT"
     1769            fi
     1770        fi
     1771    done
     1772    echo -en "."
     1773    MakeSyslinuxMessageFile $MINDI_TMP/usb/message.txt
     1774    echo -en "."
     1775    cp $kernelpath $MINDI_TMP/usb/vmlinuz 2> /dev/null || Die "Cannot copy vmlinuz ($kernelpath) to mindi tmp ($MINDI_TMP/usb/syslinux/vmlinuz). Did you run out of disk space?"
     1776    echo -en "."
     1777    cp $MINDI_TMP/mindi.rdz $MINDI_TMP/usb/initrd.img 2>> $LOGFILE
     1778    echo -en "."
     1779    if [ _"$MONDO_SHARE" != _"" ]; then
     1780        cp $kernelpath $MONDO_ROOT/vmlinuz 2> /dev/null || Die "Cannot copy vmlinuz ($kernelpath) to mondo root ($MONDO_ROOT/vmlinuz). Did you run out of disk space?"
     1781        cp $MINDI_TMP/mindi.rdz $MONDO_ROOT/initrd.img 2> /dev/null || Die "Cannot copy mindi.rdz ($MINDI_TMP) to mondo root ($MONDO_ROOT/initrd.img). Did you run out of disk space?"
     1782
     1783    fi
     1784    echo -en "."
     1785    [ -e "$iso_cfg_file" ] || Die "FIXME - unable to find $iso_cfg_file - this should never occur"
     1786    cat $sys_cfg_file | HackSyslinuxFile $ramdisk_size $MINDI_TMP/usb > syslinux.cfg || Die "Cannot copy syslinux.cfg from mindi_home to $MINDI_TMP/usb - did you run out of disk space?"
     1787    echo -en "."
     1788    if [ "$NFS_DEV" != "" ] ; then
     1789        perl -pi -e 's/interactive/iso/' syslinux.cfg
     1790    fi
     1791    cd $old_pwd
     1792    echo -en "."
     1793    if [ "$ARCH" != "ia64" ] ; then
     1794        if [ _"$MONDO_SHARE" != _"" ]; then
     1795            cp -f $MINDI_TMP/usb/{syslinux.cfg,initrd.img,vmlinuz,message.txt} $MONDO_ROOT 2>> $LOGFILE || Die "Cannot copy core files to ramdisk for boot disk (under $MONDO_ROOT). Did you run out of disk space?"
     1796            cp -f $MONDO_SHARE/autorun $MONDO_ROOT 2>> $LOGFILE
     1797        fi
     1798        umount $MINDI_TMP/usb
     1799        syslinux $USBPART 2>> $MINDI_TMP/syslinux.log
     1800        if [ "$?" -ne "0" ] ; then
     1801            echo "----------- syslinux's errors --------------" |tee -a $LOGFILE
     1802            cat $MINDI_TMP/syslinux.log |tee -a $LOGFILE
     1803            LogIt "Failed to create USB image."
     1804        else
     1805            echo -e "$DONE"
     1806            echo "Created bootable USB image on $USBDEVICE" >> $LOGFILE
     1807        fi
     1808        rm -f $MINDI_TMP/syslinux.log
     1809    else
     1810        echo "No USB boot support for ia64" | tee -a $LOGFILE
     1811        umount $MINDI_TMP/usb
     1812        MindiExit -1
     1813    fi
     1814    echo -en "."
     1815    #
     1816    # If mondoarchive, then tranfer $MINDI_CACHE content to the USB device
     1817    # and mount that device under that mountpoint instead
     1818    # Has to be done at the end here.
     1819    #
     1820    if [ _"$MONDO_SHARE" != _"" ]; then
     1821        mount $USBPART $MINDI_TMP/usb 2>> $LOGFILE
     1822        mv $CACHE_LOC/* $MINDI_TMP/usb
     1823        umount $MINDI_TMP/usb
     1824        mount $USBPART $CACHE_LOC
     1825    fi
    16811826}
    16821827
     
    27852930    cd $minidir_root/all
    27862931    size_of_all_tools=`du -sk . | cut -f1`
    2787     if [ _"$MONDO_SHARE" != _"" ] ; then
     2932    if [ _"$MONDO_SHARE" != _"" ]; then
    27882933        for q in filelist.full.gz biggielist.txt ; do
    27892934            [ ! -e "$MINDI_TMP/$q" ] && Die "Cannot find $MINDI_TMP/$q"
     
    28142959echo "$@" >> $LOGFILE
    28152960echo "Start date : `date`" >> $LOGFILE
     2961echo "-----------------------------" >> $LOGFILE
    28162962
    28172963if [ -e "/etc/conf.modules" ] && [ ! -e "/etc/modules.conf" ] ; then
     
    28522998# /etc/modprobe.conf which is exactly what module-init-tools does. The temporary
    28532999# modprobe.conf file is created in MakeModuleLoadingScript. AL041128.
    2854 if [ -d "/etc/modprobe.d" ] && [ `uname -r | cut -c1-3` = "2.6" ] ; then
     3000if [ -d "/etc/modprobe.d" ] && [ "`uname -r | cut -c1-3`" = "2.6" ] ; then
    28553001    TMPMODPROBE_FLAG="Y"
    28563002else
     
    29623108done
    29633109
     3110#
     3111# If we have a USB device we need to store info
     3112# and remove it from the parameters line
     3113#
     3114if [ "$#" -ne "0" ] ; then
     3115    if [ "$1" = "--usb" ] ; then
     3116        shift
     3117        USBDEVICE=$1
     3118        if [ _"$USBDEVICE" = _"" ]; then
     3119            Die "No USB device specified"
     3120        fi
     3121        shift
     3122    fi
     3123fi
     3124
    29643125if [ "$#" -ne "0" ] ; then
    29653126    if [ "$1" = "--findkernel" ] ; then
     
    30783239
    30793240[ -e "$iso_cfg_file" ] || Die "Cannot find $iso_cfg_file"
    3080 if [ _"$MONDO_SHARE" = _"" ] ; then
     3241if [ _"$MONDO_SHARE" = _"" ]; then
    30813242    LogIt "Mindi Linux mini-distro generator v$MINDI_VERSION"
    30823243    LogIt "Latest Mindi is available from http://www.mondorescue.org"
     
    31173278fi
    31183279
     3280if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ]; then
     3281    LogIt "Including the generation of a Bootable USB device on $USBDEVICE"
     3282fi
     3283
    31193284if [ "$kernelpath" = "" ] ; then
    31203285    [ _"$MONDO_SHARE" != _"" ] && Die "Please use -k <path> to specify kernel."
     
    31963361...Or type 'memtest' to test your PC's RAM thoroughly.\n"
    31973362
    3198 if [ _"$MONDO_SHARE" = _"" ] ; then
     3363if [ _"$MONDO_SHARE" = _"" ]; then
    31993364    ListImagesForUser $CACHE_LOC
    32003365    boot_dev=/dev/fd0u1722
     
    32053370        OfferToCopyImagesToDisks $CACHE_LOC $boot_dev $FDDEVICE
    32063371    fi
     3372    if [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ]; then
     3373        OfferToMakeBootableUSB $CACHE_LOC
     3374    fi
    32073375    OfferToMakeBootableISO $CACHE_LOC
    32083376    LogIt "Finished."
     
    32143382        Die "Cannot find all.tar.gz, to be written to tape"
    32153383    fi
     3384elif [ "$PROMPT_MAKE_USB_IMAGE" = "yes" ]; then
     3385    OfferToMakeBootableUSB $CACHE_LOC
    32163386else
    32173387    OfferToMakeBootableISO $CACHE_LOC
  • branches/2.2.5/pbconf/mondorescue.pb

    r1651 r1684  
    1414
    1515pkgver mindi = 1.2.5
    16 pkgver mindi-busybox = 1.2.2
    17 pkgtag mindi-busybox = 4
     16pkgver mindi-busybox = 1.7.2
     17pkgtag mindi-busybox = 1
    1818
    1919# Hash of additional package/package directory
Note: See TracChangeset for help on using the changeset viewer.