slitaz-dev-tools rev 178 1.7

Add: qemu-box (small frontend to Qemu)
author Christophe Lincoln <pankso@slitaz.org>
date Thu May 03 09:53:49 2012 +0200 (2012-05-03)
parents 41cb24a627b0
children d852a86d0701
files qemu-box/Makefile qemu-box/qemu-box qemu-box/qemu-box.desktop
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/qemu-box/Makefile	Thu May 03 09:53:49 2012 +0200
     1.3 @@ -0,0 +1,17 @@
     1.4 +# Makefile for Qemu-box.
     1.5 +#
     1.6 +
     1.7 +PREFIX?=/usr
     1.8 +DESTDIR?=
     1.9 +
    1.10 +all:
    1.11 +
    1.12 +install:
    1.13 +	mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)/usr/share/applications
    1.14 +	install -m 0755 qemu-box $(DESTDIR)$(PREFIX)/bin
    1.15 +	install -m 0644 qemu-box.desktop $(DESTDIR)/usr/share/applications
    1.16 +
    1.17 +uninstall:
    1.18 +	rm -rf \
    1.19 +		$(DESTDIR)$(PREFIX)/bin/qemu-box \
    1.20 +		$(DESTDIR)/usr/share/applications/qemu-box.desktop
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/qemu-box/qemu-box	Thu May 03 09:53:49 2012 +0200
     2.3 @@ -0,0 +1,66 @@
     2.4 +#!/bin/sh
     2.5 +#
     2.6 +# Small Qemu front end powered by Yad/GTK.
     2.7 +#
     2.8 +# Copyright (C) 2012 SliTaz GNU/Linux - BSD License
     2.9 +#
    2.10 +# Author: Christophe Lincoln <pankso@slitaz.org>
    2.11 +#
    2.12 +
    2.13 +# TODO: Handle vdisk image and kernel. Store virtual machine in $config
    2.14 +#config=$HOME/.config/qemu-box
    2.15 +
    2.16 +# Common boxes options.
    2.17 +opts=" --height=240 --width=500 --image=computer --image-on-top"
    2.18 +title="Qemu Box"
    2.19 +
    2.20 +# Main GUI box function with pure Yad spec
    2.21 +qemubox_main() {
    2.22 +	yad --form $opts --window-icon=computer \
    2.23 +		--text="<b>$title</b> - A Small Qemulator Helper" \
    2.24 +		--title="$title" \
    2.25 +		--field="$(gettext "ISO Image:")":FL \
    2.26 +		--field="$(gettext "Memory:")":NUM \
    2.27 +		--field="$(gettext "Options:")" \
    2.28 +		--button="Emulate":0 \
    2.29 +		--button="gtk-close":1 \
    2.30 +		" " "512" ""
    2.31 +}
    2.32 +
    2.33 +# Main function
    2.34 +qemubox() {
    2.35 +	# Store box results
    2.36 +	main=$(qemubox_main)
    2.37 +
    2.38 +	# Deal with --button values
    2.39 +	case $? in
    2.40 +		0) continue ;;
    2.41 +		*) exit 0 ;;
    2.42 +	esac
    2.43 +
    2.44 +	# Deal with $main values. File can be: .iso or vdisk .img
    2.45 +	file=$(echo $main | cut -d "|" -f 1)
    2.46 +	mem=$(echo $main | cut -d "|" -f 2 | cut -d "," -f 1)
    2.47 +	opts=$(echo $main | cut -d "|" -f 3)
    2.48 +
    2.49 +	case $file in
    2.50 +		*.iso) exec qemu -m $mem $opts -cdrom $file & ;;
    2.51 +		*.img) echo "TODO" ;;
    2.52 +		*) yad $opts --title="$title Error" \
    2.53 +			--text "<b>$title Error</b> $file" ;;
    2.54 +	esac
    2.55 +}
    2.56 +
    2.57 +#
    2.58 +# Script commands
    2.59 +#
    2.60 +
    2.61 +case "$1" in
    2.62 +	usage)
    2.63 +		echo "Usage: $(basename $0) [command]" ;;
    2.64 +	*)
    2.65 +		qemubox ;;
    2.66 +esac
    2.67 +
    2.68 +exit 0
    2.69 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/qemu-box/qemu-box.desktop	Thu May 03 09:53:49 2012 +0200
     3.3 @@ -0,0 +1,8 @@
     3.4 +[Desktop Entry]
     3.5 +Encoding=UTF-8
     3.6 +Name=Qemu Emulator
     3.7 +Name[fr]=Emulateur Qemu
     3.8 +Exec=qemu-box
     3.9 +Icon=computer
    3.10 +Type=Application
    3.11 +Categories=Application;Development;