# HG changeset patch # User Christophe Lincoln # Date 1336031629 -7200 # Node ID 2090eba62cb7c024f074d4102e878071cfe577b9 # Parent 41cb24a627b0ef6cad1998ca35015bf489014b33 Add: qemu-box (small frontend to Qemu) diff -r 41cb24a627b0 -r 2090eba62cb7 qemu-box/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qemu-box/Makefile Thu May 03 09:53:49 2012 +0200 @@ -0,0 +1,17 @@ +# Makefile for Qemu-box. +# + +PREFIX?=/usr +DESTDIR?= + +all: + +install: + mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)/usr/share/applications + install -m 0755 qemu-box $(DESTDIR)$(PREFIX)/bin + install -m 0644 qemu-box.desktop $(DESTDIR)/usr/share/applications + +uninstall: + rm -rf \ + $(DESTDIR)$(PREFIX)/bin/qemu-box \ + $(DESTDIR)/usr/share/applications/qemu-box.desktop diff -r 41cb24a627b0 -r 2090eba62cb7 qemu-box/qemu-box --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qemu-box/qemu-box Thu May 03 09:53:49 2012 +0200 @@ -0,0 +1,66 @@ +#!/bin/sh +# +# Small Qemu front end powered by Yad/GTK. +# +# Copyright (C) 2012 SliTaz GNU/Linux - BSD License +# +# Author: Christophe Lincoln +# + +# TODO: Handle vdisk image and kernel. Store virtual machine in $config +#config=$HOME/.config/qemu-box + +# Common boxes options. +opts=" --height=240 --width=500 --image=computer --image-on-top" +title="Qemu Box" + +# Main GUI box function with pure Yad spec +qemubox_main() { + yad --form $opts --window-icon=computer \ + --text="$title - A Small Qemulator Helper" \ + --title="$title" \ + --field="$(gettext "ISO Image:")":FL \ + --field="$(gettext "Memory:")":NUM \ + --field="$(gettext "Options:")" \ + --button="Emulate":0 \ + --button="gtk-close":1 \ + " " "512" "" +} + +# Main function +qemubox() { + # Store box results + main=$(qemubox_main) + + # Deal with --button values + case $? in + 0) continue ;; + *) exit 0 ;; + esac + + # Deal with $main values. File can be: .iso or vdisk .img + file=$(echo $main | cut -d "|" -f 1) + mem=$(echo $main | cut -d "|" -f 2 | cut -d "," -f 1) + opts=$(echo $main | cut -d "|" -f 3) + + case $file in + *.iso) exec qemu -m $mem $opts -cdrom $file & ;; + *.img) echo "TODO" ;; + *) yad $opts --title="$title Error" \ + --text "$title Error $file" ;; + esac +} + +# +# Script commands +# + +case "$1" in + usage) + echo "Usage: $(basename $0) [command]" ;; + *) + qemubox ;; +esac + +exit 0 + diff -r 41cb24a627b0 -r 2090eba62cb7 qemu-box/qemu-box.desktop --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qemu-box/qemu-box.desktop Thu May 03 09:53:49 2012 +0200 @@ -0,0 +1,8 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Qemu Emulator +Name[fr]=Emulateur Qemu +Exec=qemu-box +Icon=computer +Type=Application +Categories=Application;Development;