[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r16199: Made the USB installation script check if there are persiste (incognito/trunk/root_overlay/usr/sbin)
Author: anonym
Date: 2008-07-25 10:05:53 -0400 (Fri, 25 Jul 2008)
New Revision: 16199
Modified:
incognito/trunk/root_overlay/usr/sbin/create-usb
Log:
Made the USB installation script check if there are persistent volumes present, asking if they should be copied.
Modified: incognito/trunk/root_overlay/usr/sbin/create-usb
===================================================================
--- incognito/trunk/root_overlay/usr/sbin/create-usb 2008-07-25 14:03:06 UTC (rev 16198)
+++ incognito/trunk/root_overlay/usr/sbin/create-usb 2008-07-25 14:05:53 UTC (rev 16199)
@@ -1,4 +1,4 @@
- #!/bin/sh
+#!/bin/sh
#
# Creates a USB bootable disk from a Gentoo based Live CD
@@ -13,7 +13,7 @@
MEDIADEV=$( basename $( mount | grep ${MEDIAROOT} | cut -d ' ' -f 1 ) | cut -b 1-3 )
# Show an Xdialog of available USB drives. The one which the user choses is
-# partitioned into a single big partition. USBPART will stored the path to
+# partitioned into a single big partition. USBPART will store the path to
# the new partition and USBDEV the path to the device.
format_usb() {
# Find the mkfs.vfat command
@@ -141,7 +141,7 @@
fi
fi
- USBPART="$( ${DIALOG} --stdout --combobox "Please select a USB partition to copy the CD onto. Please note that this process may destroy the data on your USB drive, it is your responsibility to ensure any important data is backed up elsewhere." 9 ${DEFAULT_WIDTH} "${LIST[@]}" | awk '{ print $1 }' )"
+ USBPART="$( ${DIALOG} --stdout --combobox "Please select a USB partition to copy __INCOGNITO__ to. Please note that this process may destroy the data on your USB drive, it is your responsibility to ensure any important data is backed up elsewhere." 9 ${DEFAULT_WIDTH} "${LIST[@]}" | awk '{ print $1 }' )"
if [[ -z "${USBPART}" ]]; then
${DIALOG} --msgbox "No USB drive partition selected, exiting" 0 ${DEFAULT_WIDTH}
@@ -213,12 +213,13 @@
exit 1
fi
-# Required files (relative path from cd root)
IMAGE="image.squashfs"
-REQUIRED_FILES="${SYSLINUX}/${SYSLINUX}.cfg ${SYSLINUX}/vesamenu.c32 ${SYSLINUX}/splash.png ${SYSLINUX}/gentoo ${SYSLINUX}/gentoo.igz ${IMAGE}"
-EXCLUDE="System.map-gentoo|isolinux.bin|boot.cat|kernels.msg"
-COPY_FILES=$( find ${MEDIAROOT} ! -type d | egrep -v "$EXCLUDE" | sed "s|${MEDIAROOT}/||g" )
-DIRS=$( find ${MEDIAROOT} -type d | egrep -v "$EXCLUDE" | sed "s|${MEDIAROOT}||g" | sed "s|isolinux|syslinux|g" )
+HOMEPART_EXT3="${MEDIAROOT}/home.ext3.img"
+HOMEPART_TC="${MEDIAROOT}/home.tc"
+REQUIRED_FILES="${SYSLINUX}/${SYSLINUX}.cfg ${SYSLINUX}/macchang.cfg ${SYSLINUX}/vesamenu.c32 ${SYSLINUX}/splash.png ${SYSLINUX}/gentoo ${SYSLINUX}/gentoo.igz ${IMAGE}"
+EXCLUDE_FILES="System.map-gentoo|isolinux.bin|boot.cat|kernels.msg"
+COPY_FILES=$( find ${MEDIAROOT} ! -type d | egrep -v "${EXCLUDE_FILES}" | sed "s|${MEDIAROOT}/||g" )
+DIRS=$( find ${MEDIAROOT} -type d | egrep -v "${EXCLUDE_FILES}" | sed "s|${MEDIAROOT}||g" | sed "s|isolinux|syslinux|g" )
# Find the dialog command
DIALOG="$(which Xdialog 2>/dev/null)"
@@ -243,7 +244,7 @@
done
# Choose installation method
-CHOICE=$(${DIALOG} --stdout --radiolist "For this procedure, you have the option to either:\n\n1: Use an existing vfat partition on a USB drive. This requires that you have a USB drive with a Windows (vfat) partition on it. If you already have copied __INCOGNITO__ onto a USB drive and just want to do it again, this is the right choice as any persistant volumes will be preserved. As such, this option should be used if you want to update an existing __INCOGNITO__ USB installation.\n\n2: Format a USB drive. This will destory all partitions on the drive and create a single big Windows (vfat) partition consisting of all available space which __INCOGNITO__ will be copied onto. Note that this will remove all data from the USB drive so backup any valuable data elsewhere before continuing further.\n\nIf you are unsure which option to choose, try with option 1 (Use an existing vfat partition) first and then resort to optoin 2 (Format a USB drive) if that doesn't work." 0 ${DEFAULT_WIDTH} 2 "1" "Use an existing vfat partition on a USB drive" "" "2" "Format a USB drive" "" )
+CHOICE=$( ${DIALOG} --stdout --radiolist "For this procedure, you have the option to either:\n\n1: Use an existing vfat partition on a USB drive. This requires that you have a USB drive with a Windows (vfat) partition on it. If you already have copied __INCOGNITO__ onto a USB drive and just want to do it again, this is the right choice as any persistant volumes will be preserved. As such, this option should be used if you want to update an existing __INCOGNITO__ USB installation.\n\n2: Format a USB drive. This will destory all partitions on the drive and create a single big Windows (vfat) partition consisting of all available space which __INCOGNITO__ will be copied onto. Note that this will remove all data from the USB drive so backup any valuable data elsewhere before continuing further.\n\nIf you are unsure which option to choose, try with option 1 (Use an existing vfat partition) first and then resort to optoin 2 (Format a USB drive) if that doesn't work." 0 ${DEFAULT_WIDTH} 2 "1" "Use an existing vfat partition on a USB drive" "" "2" "Format a USB drive" "" )
if [ "${CHOICE}" == "1" ]; then
get_vfat
@@ -253,6 +254,14 @@
exit 0
fi
+# Check if there is a persistent volume present and ask if it should be copied
+if echo ${COPY_FILES} | grep -q -e "\(${HOMEPART_EXT3}\)\|\(${HOMEPART_TC}\)"; then
+ ${DIALOG} --stdout --yesno "Do you want to copy your existing persistant home volume to the USB drive?" 0 ${DEFAULT_WIDTH}
+ if [ "$?" != "0" ]; then
+ COPY_FILES=$( echo ${COPY_FILES} | sed "s/\(${HOMEPART_EXT3}\)\|\(${HOMEPART_TC}\)//g" )
+ fi
+fi
+
# Mount the drive
MTPT="$(mktemp -t -d incognitoXXXXXXXX)"
mkdir -p ${MTPT} 2> /dev/null
@@ -326,7 +335,7 @@
fi
# Copy syslinux MBR
-dd if=/usr/lib/syslinux/mbr.bin "of=${USBDEV}" 2> /dev/null
+dd if=/usr/share/syslinux/mbr.bin "of=${USBDEV}" 2> /dev/null
if [[ $? -ne 0 ]]; then
${DIALOG} --msgbox "Could not copy Master Boot Record to USB drive ${USBDEV} (dd)" 0 ${DEFAULT_WIDTH}
exit 1