|`- sanity [--fix] : Check full code for errors.
`-- targets : Returns the target, that the host can build.
+ vm : _Run a virtual machine (which qemu)_
+ |`- boot [cdrom|disk] : Boot machine from cdrom or disk. (Default: cdrom)
+ `-- clean : Cleanup the virtual environment.
+
pull : A macro to pull the latest changes from git and load the
source tarballs and patches. Additionally it checks the code
for error.
--- /dev/null
+#!/bin/bash
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+qemu_start() {
+ # Check if we have a qemu binary
+ if ! which qemu &>/dev/null; then
+ dialogerror "Cannot find qemu."
+ exit 1
+ fi
+
+ # Check if the working directory is present
+ [ -d "$BASEDIR/vm" ] || mkdir $BASEDIR/vm
+ QEMU_DISK=$BASEDIR/vm/qemu-hda-$HOSTNAME.img
+
+ # Create a qemu disk if not present (4G)
+ [ -e $QEMU_DISK ] || qemu-img create $QEMU_DISK 4G
+
+ # Load the kernel module
+ if ! grep -q ^kqemu /proc/modules; then
+ modprobe kqemu 2>/dev/null
+ fi
+
+ # Prepare qemu command
+ QEMU_COMMAND="qemu -name $NAME-$VERSION -m 256"
+ QEMU_COMMAND="$QEMU_COMMAND -k de -localtime -std-vga -usb"
+ QEMU_COMMAND="$QEMU_COMMAND -no-reboot -vnc :2 -hda $QEMU_DISK"
+
+ if ! grep -q ^kqemu /proc/modules; then
+ QEMU_COMMAND="$QEMU_COMMAND -no-kqemu"
+ fi
+
+ case "$1" in
+ ""|cd*)
+ QEMU_COMMAND="$QEMU_COMMAND -boot d -cdrom"
+ if [ -n "$2" ]; then
+ QEMU_COMMAND="$QEMU_COMMAND $2"
+ else
+ QEMU_COMMAND="$QEMU_COMMAND $BASEDIR/$IMAGENAME.iso"
+ fi
+ ;;
+ disk|hd*)
+ QEMU_COMMAND="$QEMU_COMMAND -boot c"
+ ;;
+ esac
+
+ echo -e "We are going to run a ${BOLD}virtual machine${NORMAL}, now."
+ echo
+ echo "You may connect to this machine with a vnc viewer to $HOSTNAME:2."
+ echo "Kill this vm by pressing Ctrl+C."
+ echo
+ $QEMU_COMMAND
+ if [ $? -eq 0 ]; then
+ echo -n "The virtual machine quit gracefully."
+ beatify message DONE
+ else
+ echo -n "The virtual machine quit with an error!"
+ beautify message FAIL
+ fi
+}