[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r11758: Include boot menu when running in QEMU. (in incognito/trunk: . arch/x86/overlay root_overlay/usr/sbin)
Author: double
Date: 2007-10-04 09:57:20 -0400 (Thu, 04 Oct 2007)
New Revision: 11758
Added:
incognito/trunk/create-runbat.sh
Removed:
incognito/trunk/arch/x86/overlay/run-usb.bat
Modified:
incognito/trunk/ChangeLog
incognito/trunk/TODO
incognito/trunk/arch/x86/overlay/run.bat
incognito/trunk/livecd-stage2.sh
incognito/trunk/root_overlay/usr/sbin/create-usb
Log:
Include boot menu when running in QEMU.
Modified: incognito/trunk/ChangeLog
===================================================================
--- incognito/trunk/ChangeLog 2007-10-03 20:00:47 UTC (rev 11757)
+++ incognito/trunk/ChangeLog 2007-10-04 13:57:20 UTC (rev 11758)
@@ -1,3 +1,6 @@
+
+ - Include boot menu when run as virtual PC.
+
27 Sep 2007
20070824.2 changes since 20070824.1:
Modified: incognito/trunk/TODO
===================================================================
--- incognito/trunk/TODO 2007-10-03 20:00:47 UTC (rev 11757)
+++ incognito/trunk/TODO 2007-10-04 13:57:20 UTC (rev 11758)
@@ -64,9 +64,6 @@
The CD or USB may be run in a virtual PC for computers that won't boot from removable media. USB must be run read-only due to bugs in QEMU (writable vvfat). When QEMU fixes this, we should use it.
See http://www.h7.dion.ne.jp/~qemu-win/HowToFloppyCdrom-en.html
-- Provide menu choices in virtual PC use
-Options are fixed when running in a virtual PC. Read the syslinux.cfg file and allow the same options. This may be able to still use run.bat, depends on how good the Windows command interpreter is. We could definately do it with bash :)
-
- Allow Tor to be bypassed
Sometimes a direct connection to the Internet is desired. We need a way to bypass the iptables filter. Possibly another proxy process that does not go through Tor. There should be a clear indicator that we are not anonymous.
Deleted: incognito/trunk/arch/x86/overlay/run-usb.bat
===================================================================
--- incognito/trunk/arch/x86/overlay/run-usb.bat 2007-10-03 20:00:47 UTC (rev 11757)
+++ incognito/trunk/arch/x86/overlay/run-usb.bat 2007-10-04 13:57:20 UTC (rev 11758)
@@ -1,22 +0,0 @@
-@echo off
-echo.
-echo Running Incognito CD/USB in a virtual PC.
-echo.
-echo Defaulting to English locale and keyboard.
-echo.
-echo Type CTRL-ALT-F to toggle fullscreen mode.
-echo.
-echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-echo !! !!
-echo !! BEWARE! While running Incognito USB from within Microsoft Windows any !!
-echo !! changes made to the user home (e.g. new settings, new files) will not be !!
-echo !! persistent between boots! In other words, any changes made during this !!
-echo !! session will be lost when shutting down, just like when running from the !!
-echo !! liveCD. Note, however, that changes made to the user home in the past !!
-echo !! will be present now. !!
-echo !! !!
-echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-echo.
-
-set DRIVE=%CD:~0,1%
-start /B %DRIVE%:\qemu\qemu.exe -m 256M -localtime -usb -L %DRIVE%://qemu -hda fat:%DRIVE%:\ -kernel %DRIVE%:\syslinux\gentoo -initrd %DRIVE%:\syslinux\gentoo.igz -append "root=/dev/ram0 init=/linuxrc looptype=squashfs loop=/image.squashfs cdroot vga=791 splash=silent,theme:livecd-2006.1 CONSOLE=/dev/tty1 acpi=on quiet dokeymap"
Modified: incognito/trunk/arch/x86/overlay/run.bat
===================================================================
--- incognito/trunk/arch/x86/overlay/run.bat 2007-10-03 20:00:47 UTC (rev 11757)
+++ incognito/trunk/arch/x86/overlay/run.bat 2007-10-04 13:57:20 UTC (rev 11758)
@@ -1,10 +1,32 @@
@echo off
echo.
-echo Running Incognito CD/USB in a virtual PC.
+echo Running __INCOGNITO__ in a virtual PC.
echo.
echo Type CTRL-ALT-F to toggle fullscreen mode.
echo.
+echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+echo !! !!
+echo !! BEWARE! While running from within Microsoft Windows any changes made !!
+echo !! to the user home (e.g. new settings, new files) will not be persistent !!
+echo !! between boots! In other words, any changes made during this session !!
+echo !! will be lost when shutting down, just like when running from the LiveCD. !!
+echo !! Note, however, that changes made to the user home in the past !!
+echo !! will be present now. !!
+echo !! !!
+echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
set DRIVE=%CD:~0,1%
-start /B %DRIVE%:\qemu\qemu.exe -m 256M -localtime -usb -L %DRIVE%://qemu -cdrom //./%DRIVE%: -boot d
+rem Default boot parameters, just in case
+set KERNEL=gentoo
+set INITRD=gentoo.igz
+set KERNEL_ARGS=root=/dev/ram0 init=/linuxrc looptype=squashfs loop=/image.squashfs cdroot vga=791 splash=silent,theme:livecd-2006.1 CONSOLE=/dev/tty1 acpi=on quiet dokeymap
+
+rem MENU
+
+rem Find the correct SYSLINUX directory
+set SYSLINUX=syslinux
+if exist %DRIVE%:\isolinux set SYSLINUX=isolinux
+
+rem Start QEMU
+start /B %DRIVE%:\qemu\qemu.exe -m 256M -localtime -usb -L %DRIVE%://qemu -hda fat:%DRIVE%:\ -kernel %DRIVE%:\%SYSLINUX%\%KERNEL% -initrd %DRIVE%:\%SYSLINUX%\%INITRD% -append "%KERNEL_ARGS%"
Added: incognito/trunk/create-runbat.sh
===================================================================
--- incognito/trunk/create-runbat.sh (rev 0)
+++ incognito/trunk/create-runbat.sh 2007-10-04 13:57:20 UTC (rev 11758)
@@ -0,0 +1,88 @@
+#!/bin/sh
+
+# Verify arguments
+BAT="$1"
+ISOLINUX="$2"
+if [[ -z "${BAT}" ]] || [[ ! -r "${BAT}" ]] || [[ -z "${ISOLINUX}" ]] || [[ ! -r "${ISOLINUX}" ]]; then
+ echo "Usage: $0 <bat_file> <isolinux.cfg>"
+ exit 1
+fi
+
+grep "rem MENU" "${BAT}" >/dev/null || exit 0
+
+declare -a BOOT_TITLE BOOT_KERNEL BOOT_INITRD BOOT_ARGS
+declare -i BOOT_COUNT
+
+BOOT_COUNT=0
+eval $( cat "${ISOLINUX}" | while read -r L; do
+
+ if echo $L | grep "^\\s*menu label " >/dev/null; then
+ echo BOOT_TITLE[$BOOT_COUNT]=\"${L/menu label /}\"
+ elif echo $L | grep "^\\s*kernel " >/dev/null; then
+ echo BOOT_KERNEL[$BOOT_COUNT]=\"${L/kernel /}\"
+ elif echo $L | grep "^\\s*append " >/dev/null; then
+ echo BOOT_INITRD[$BOOT_COUNT]=\"$( echo $L | tr -s [:space:] '\n' | grep initrd | cut -c 8- )\"
+ L="$(echo $L | sed 's/initrd=[^\s]*//')"
+ echo BOOT_ARGS[$BOOT_COUNT]=\"${L/append /}\"
+ elif echo $L | grep "^\\s*label " >/dev/null; then
+ BOOT_COUNT=$(( $BOOT_COUNT+1 ))
+ echo BOOT_COUNT=$BOOT_COUNT
+ BOOT_LIST="${BOOT_LIST} $BOOT_COUNT"
+ echo BOOT_LIST=\"${BOOT_LIST}\"
+ fi
+
+done )
+
+# No kernels in the config, don't do anything
+[[ $BOOT_COUNT -eq 0 ]] && exit 0
+
+# Create temporary
+FILE="$(mktemp -t incognitoXXXXXXXX)"
+if [[ $? -ne 0 ]]; then
+ echo "Could not create temporary file, $? from mktemp" >2
+ exit 1
+fi
+
+cat "${BAT}" | while read -r FL; do
+
+if echo "${FL}" | grep "rem MENU" >/dev/null; then
+
+(
+
+echo -en ":menu\r\n"
+echo -en "echo.\r\n"
+
+for BOOT_INDEX in ${BOOT_LIST}; do
+echo -en "echo $(( $BOOT_INDEX )). ${BOOT_TITLE[$BOOT_INDEX]}\r\n"
+done
+
+echo -en "set /p BOOT_OPT= Boot Option:\r\n"
+
+for BOOT_INDEX in $BOOT_LIST; do
+echo -en "if \"%BOOT_OPT%\" == \"$(( $BOOT_INDEX ))\" goto bootopt$(( $BOOT_INDEX ))\r\n"
+done
+
+echo -en "goto menu\r\n"
+
+for BOOT_INDEX in $BOOT_LIST; do
+echo -en ":bootopt$(( $BOOT_INDEX ))\r\n"
+echo -en "set KERNEL=${BOOT_KERNEL[$BOOT_INDEX]}\r\n"
+echo -en "set INITRD=${BOOT_INITRD[$BOOT_INDEX]}\r\n"
+echo -en "set KERNEL_ARGS=${BOOT_ARGS[$BOOT_INDEX]}\r\n"
+echo -en "goto qemu\r\n"
+done
+
+echo -en ":qemu\r\n"
+
+) >> "${FILE}"
+
+else
+
+echo "${FL}" >> "${FILE}"
+
+fi
+
+done
+
+mv "${FILE}" "${BAT}"
+
Property changes on: incognito/trunk/create-runbat.sh
___________________________________________________________________
Name: svn:executable
+ *
Modified: incognito/trunk/livecd-stage2.sh
===================================================================
--- incognito/trunk/livecd-stage2.sh 2007-10-03 20:00:47 UTC (rev 11757)
+++ incognito/trunk/livecd-stage2.sh 2007-10-04 13:57:20 UTC (rev 11758)
@@ -58,7 +58,7 @@
# Do branding replacement
# TODO: Get these two from somewhere else
INCOGNITO="Incognito"
-INCOGNITO_TITLE="Incognito CD/USB"
+INCOGNITO_TITLE="Incognito"
INCOGNITO_VERSION="custom"
# Add revision
@@ -99,6 +99,11 @@
for QEMU_TARGET in *.bin *.dll keymaps qemu.exe License; do
mv "${DIR}"/qemu-0.9.0-windows/${QEMU_TARGET} "${DIR}/overlay/qemu"
done
+
+ # Fixup run*.bat with menu
+ ISOLINUX="$(find ${DIR}/overlay -name 'isolinux.cfg')"
+ [[ -n "${ISOLINUX}" ]] && find "${DIR}/overlay" -name "*.bat" -exec ./create-runbat.sh {} "${ISOLINUX}" \;
+
fi
# Build it
Modified: incognito/trunk/root_overlay/usr/sbin/create-usb
===================================================================
--- incognito/trunk/root_overlay/usr/sbin/create-usb 2007-10-03 20:00:47 UTC (rev 11757)
+++ incognito/trunk/root_overlay/usr/sbin/create-usb 2007-10-04 13:57:20 UTC (rev 11758)
@@ -123,7 +123,7 @@
# Required files
IMAGE="image.squashfs"
REQUIRED_FILES="isolinux/isolinux.cfg isolinux/vesamenu.c32 isolinux/splash.png isolinux/gentoo isolinux/gentoo.igz ${IMAGE}"
-EXCLUDE="System.map-gentoo|isolinux.bin|boot.cat|kernels.msg|run.bat"
+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" )
@@ -224,9 +224,6 @@
exit 1
fi
-# Switch to USB adapted batch file for booting with qemu
-mv -f ${MTPT}/run-usb.bat ${MTPT}/run.bat
-
# Unmount the drive
( echo 90 ; echo 90 ; umount -v "${MTPT}" ) | ${DIALOG} --progress "Completing USB file copy" 0 ${DEFAULT_WIDTH}
rmdir "${MTPT}"