source = https://download.qemu.org/qemu-6.0.1.tar.xz
Hi @ all
I have the addon qemu-ga for people who virtualize IPFire and to read the status without having to install the whole qemu package.
Signed-off-by: Marcel Follert (Smooky) smooky@v16.de --- config/qemu-ga/qemu-ga.init | 38 ++++++++++ config/rootfiles/packages/qemu-ga | 2 + lfs/qemu-ga | 114 ++++++++++++++++++++++++++++++ make.sh | 1 + src/paks/qemu-ga/install.sh | 34 +++++++++ src/paks/qemu-ga/uninstall.sh | 32 +++++++++ src/paks/qemu-ga/update.sh | 27 +++++++ 7 files changed, 248 insertions(+) create mode 100755 config/qemu-ga/qemu-ga.init create mode 100644 config/rootfiles/packages/qemu-ga create mode 100644 lfs/qemu-ga create mode 100644 src/paks/qemu-ga/install.sh create mode 100644 src/paks/qemu-ga/uninstall.sh create mode 100644 src/paks/qemu-ga/update.sh
diff --git a/config/qemu-ga/qemu-ga.init b/config/qemu-ga/qemu-ga.init new file mode 100755 index 000000000..c87ce86e8 --- /dev/null +++ b/config/qemu-ga/qemu-ga.init @@ -0,0 +1,38 @@ +#!/bin/sh +# Begin $rc_base/init.d/qemu-guest-agent + + +. /etc/sysconfig/rc +. $rc_functions + +case "$1" in + start) + boot_mesg "Starting Qemu-guest-agent..." + /usr/bin/qemu-ga -m virtio-serial -p /dev/virtio-ports/org.qemu.guest_agent.0 -f /run/qemu-ga.pid -d + evaluate_retval + ;; + + stop) + boot_mesg "Stopping Qemu-guest-agent..." + killproc /usr/bin/qemu-ga + ;; + + restart) + $0 stop + sleep 3 + $0 start + ;; + + status) + statusproc /usr/bin/qemu-ga + ;; + + + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + + +# End $rc_base/init.d/qemu-guest-agent diff --git a/config/rootfiles/packages/qemu-ga b/config/rootfiles/packages/qemu-ga new file mode 100644 index 000000000..78f368862 --- /dev/null +++ b/config/rootfiles/packages/qemu-ga @@ -0,0 +1,2 @@ +usr/bin/qemu-ga +etc/rc.d/init.d/qemu-ga diff --git a/lfs/qemu-ga b/lfs/qemu-ga new file mode 100644 index 000000000..71bf61cbe --- /dev/null +++ b/lfs/qemu-ga @@ -0,0 +1,114 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007-2022 IPFire Team info@ipfire.org # +# # +# 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/. # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +VER = 6.0.1 + +THISAPP = qemu-$(VER) +DL_FILE = $(THISAPP).tar.xz +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) +SUP_ARCH = i586 x86_64 +PROG = qemu-ga +PAK_VER = 1 + +DEPS = + +TARGETS = \ + i386-linux-user \ + x86_64-linux-user \ + arm-linux-user \ + riscv64-linux-user \ + i386-softmmu \ + x86_64-softmmu \ + arm-softmmu \ + riscv64-softmmu + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_MD5 = 10c651469e07844523995e2c980a4fdb + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +md5 : $(subst %,%_MD5,$(objects)) + +dist: + @$(PAK) + +############################################################################### +# Downloading, checking, md5sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_MD5,$(objects)) : + @$(MD5) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && ./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --enable-kvm \ + --disable-attr \ + --target-list="$(TARGETS)" \ + --extra-cflags="$(CFLAGS)" \ + --enable-spice \ + --enable-usb-redir \ + --enable-seccomp \ + --disable-docs \ + --disable-sdl + + cd $(DIR_APP) && make $(MAKETUNING) + cd $(DIR_APP) && cp build/qga/qemu-ga /usr/bin + +# Install init file for 'qemu-ga' + install -v -m 755 $(DIR_SRC)/config/qemu-ga/qemu-ga.init \ + /etc/rc.d/init.d/qemu-ga + + + @rm -rf $(DIR_APP) + @$(POSTBUILD) diff --git a/make.sh b/make.sh index e6f948ba0..fe6dc123c 100755 --- a/make.sh +++ b/make.sh @@ -1615,6 +1615,7 @@ buildipfire() { lfsmake2 libcdada lfsmake2 pmacct lfsmake2 squid-asnbl + lfsmake2 qemu-ga }
buildinstaller() { diff --git a/src/paks/qemu-ga/install.sh b/src/paks/qemu-ga/install.sh new file mode 100644 index 000000000..6980820ba --- /dev/null +++ b/src/paks/qemu-ga/install.sh @@ -0,0 +1,34 @@ +#!/bin/bash +############################################################################ +# # +# This file is part of the IPFire Firewall. # +# # +# IPFire 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 2 of the License, or # +# (at your option) any later version. # +# # +# IPFire 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 IPFire; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Copyright (C) 2022 IPFire-Team info@ipfire.org. # +# # +############################################################################ +# +. /opt/pakfire/lib/functions.sh +extract_files +restore_backup ${NAME} + +# add symlinks for qemu-ga + +ln -s /etc/rc.d/init.d/qemu-ga /etc/rc.d/rc0.d/K00qemu-ga +ln -s /etc/rc.d/init.d/qemu-ga /etc/rc.d/rc3.d/S99qemu-ga +ln -s /etc/rc.d/init.d/qemu-ga /etc/rc.d/rc6.d/K00qemu-ga + +start_service --background ${NAME} diff --git a/src/paks/qemu-ga/uninstall.sh b/src/paks/qemu-ga/uninstall.sh new file mode 100644 index 000000000..cc1115b99 --- /dev/null +++ b/src/paks/qemu-ga/uninstall.sh @@ -0,0 +1,32 @@ +#!/bin/bash +############################################################################ +# # +# This file is part of the IPFire Firewall. # +# # +# IPFire 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 2 of the License, or # +# (at your option) any later version. # +# # +# IPFire 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 IPFire; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Copyright (C) 2022 IPFire-Team info@ipfire.org. # +# # +############################################################################ +# +. /opt/pakfire/lib/functions.sh +stop_service ${NAME} +make_backup ${NAME} + +# remove symlinks + +rm -f /etc/rc.d/rc0.d/K00qemu-ga /etc/rc.d/rc3.d/S99qemu-ga /etc/rc.d/rc6.d/K00qemu-ga + +remove_files diff --git a/src/paks/qemu-ga/update.sh b/src/paks/qemu-ga/update.sh new file mode 100644 index 000000000..ea2505f2a --- /dev/null +++ b/src/paks/qemu-ga/update.sh @@ -0,0 +1,27 @@ +#!/bin/bash +############################################################################ +# # +# This file is part of the IPFire Firewall. # +# # +# IPFire 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 2 of the License, or # +# (at your option) any later version. # +# # +# IPFire 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 IPFire; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Copyright (C) 2007-2022 IPFire-Team info@ipfire.org. # +# # +############################################################################ +# +. /opt/pakfire/lib/functions.sh +extract_backup_includes +./uninstall.sh +./install.sh
Hello Marcel,
Thank you for your patch. This is something that lots of people will hopefully find useful.
However, I have a couple of questions regarding this patch.
On 14 Jan 2022, at 10:42, smooky@v16.de wrote:
source = https://download.qemu.org/qemu-6.0.1.tar.xz
Hi @ all
I have the addon qemu-ga for people who virtualize IPFire and to read the status without having to install the whole qemu package.
Signed-off-by: Marcel Follert (Smooky) smooky@v16.de
config/qemu-ga/qemu-ga.init | 38 ++++++++++ config/rootfiles/packages/qemu-ga | 2 + lfs/qemu-ga | 114 ++++++++++++++++++++++++++++++ make.sh | 1 + src/paks/qemu-ga/install.sh | 34 +++++++++ src/paks/qemu-ga/uninstall.sh | 32 +++++++++ src/paks/qemu-ga/update.sh | 27 +++++++ 7 files changed, 248 insertions(+) create mode 100755 config/qemu-ga/qemu-ga.init create mode 100644 config/rootfiles/packages/qemu-ga create mode 100644 lfs/qemu-ga create mode 100644 src/paks/qemu-ga/install.sh create mode 100644 src/paks/qemu-ga/uninstall.sh create mode 100644 src/paks/qemu-ga/update.sh
diff --git a/config/qemu-ga/qemu-ga.init b/config/qemu-ga/qemu-ga.init new file mode 100755 index 000000000..c87ce86e8 --- /dev/null +++ b/config/qemu-ga/qemu-ga.init @@ -0,0 +1,38 @@ +#!/bin/sh +# Begin $rc_base/init.d/qemu-guest-agent
+. /etc/sysconfig/rc +. $rc_functions
+case "$1" in
- start)
boot_mesg "Starting Qemu-guest-agent..."
I would spell this as “QEMU Guest Agent”, but this is only a cosmetic change.
/usr/bin/qemu-ga -m virtio-serial -p /dev/virtio-ports/org.qemu.guest_agent.0 -f /run/qemu-ga.pid -d
evaluate_retval
;;
- stop)
boot_mesg "Stopping Qemu-guest-agent..."
killproc /usr/bin/qemu-ga
;;
- restart)
$0 stop
sleep 3
$0 start
;;
- status)
statusproc /usr/bin/qemu-ga
;;
- *)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
+esac
+# End $rc_base/init.d/qemu-guest-agent diff --git a/config/rootfiles/packages/qemu-ga b/config/rootfiles/packages/qemu-ga new file mode 100644 index 000000000..78f368862 --- /dev/null +++ b/config/rootfiles/packages/qemu-ga @@ -0,0 +1,2 @@ +usr/bin/qemu-ga +etc/rc.d/init.d/qemu-ga diff --git a/lfs/qemu-ga b/lfs/qemu-ga new file mode 100644 index 000000000..71bf61cbe --- /dev/null +++ b/lfs/qemu-ga @@ -0,0 +1,114 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007-2022 IPFire Team info@ipfire.org # +# # +# 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/. # +# # +###############################################################################
+############################################################################### +# Definitions +###############################################################################
+include Config
+VER = 6.0.1
+THISAPP = qemu-$(VER) +DL_FILE = $(THISAPP).tar.xz +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) +SUP_ARCH = i586 x86_64
We no longer support i586, so this can be removed.
Is there any reason this is not enabled for aarch64? I don’t think many people will use KVM on 32 bit ARM, but aarch64 is gaining traction.
+PROG = qemu-ga +PAK_VER = 1
+DEPS =
+TARGETS = \
- i386-linux-user \
- x86_64-linux-user \
- arm-linux-user \
- riscv64-linux-user \
- i386-softmmu \
- x86_64-softmmu \
- arm-softmmu \
- riscv64-softmmu
What relevance to these targets have for the build?
Is this just from copying lfs/qemu?
+############################################################################### +# Top-level Rules +###############################################################################
+objects = $(DL_FILE)
+$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
+$(DL_FILE)_MD5 = 10c651469e07844523995e2c980a4fdb
+install : $(TARGET)
+check : $(patsubst %,$(DIR_CHK)/%,$(objects))
+download :$(patsubst %,$(DIR_DL)/%,$(objects))
+md5 : $(subst %,%_MD5,$(objects))
+dist:
- @$(PAK)
+############################################################################### +# Downloading, checking, md5sum +###############################################################################
+$(patsubst %,$(DIR_CHK)/%,$(objects)) :
- @$(CHECK)
+$(patsubst %,$(DIR_DL)/%,$(objects)) :
- @$(LOAD)
+$(subst %,%_MD5,$(objects)) :
- @$(MD5)
+############################################################################### +# Installation Details +###############################################################################
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
- @$(PREBUILD)
- @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
- cd $(DIR_APP) && ./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--enable-kvm \
--disable-attr \
--target-list="$(TARGETS)" \
--extra-cflags="$(CFLAGS)" \
--enable-spice \
--enable-usb-redir \
--enable-seccomp \
--disable-docs \
--disable-sdl
- cd $(DIR_APP) && make $(MAKETUNING)
Can the make command be modified to not build the entire QEMU package?
I suppose this will take some time.
- cd $(DIR_APP) && cp build/qga/qemu-ga /usr/bin
+# Install init file for 'qemu-ga'
- install -v -m 755 $(DIR_SRC)/config/qemu-ga/qemu-ga.init \
/etc/rc.d/init.d/qemu-ga
We have a macro called INSTALL_INITSCRIPT which you can use if you move the script into src/initscripts/packages.
Here is an example: https://git.ipfire.org/?p=ipfire-2.x.git;a=blob;f=lfs/postfix;h=6fe46d9a83f9...
The rest of the patch looks fine to me.
Best, -Michael
- @rm -rf $(DIR_APP)
- @$(POSTBUILD)
diff --git a/make.sh b/make.sh index e6f948ba0..fe6dc123c 100755 --- a/make.sh +++ b/make.sh @@ -1615,6 +1615,7 @@ buildipfire() { lfsmake2 libcdada lfsmake2 pmacct lfsmake2 squid-asnbl
- lfsmake2 qemu-ga
}
buildinstaller() { diff --git a/src/paks/qemu-ga/install.sh b/src/paks/qemu-ga/install.sh new file mode 100644 index 000000000..6980820ba --- /dev/null +++ b/src/paks/qemu-ga/install.sh @@ -0,0 +1,34 @@ +#!/bin/bash +############################################################################ +# # +# This file is part of the IPFire Firewall. # +# # +# IPFire 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 2 of the License, or # +# (at your option) any later version. # +# # +# IPFire 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 IPFire; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Copyright (C) 2022 IPFire-Team info@ipfire.org. # +# # +############################################################################ +# +. /opt/pakfire/lib/functions.sh +extract_files +restore_backup ${NAME}
+# add symlinks for qemu-ga
+ln -s /etc/rc.d/init.d/qemu-ga /etc/rc.d/rc0.d/K00qemu-ga +ln -s /etc/rc.d/init.d/qemu-ga /etc/rc.d/rc3.d/S99qemu-ga +ln -s /etc/rc.d/init.d/qemu-ga /etc/rc.d/rc6.d/K00qemu-ga
+start_service --background ${NAME} diff --git a/src/paks/qemu-ga/uninstall.sh b/src/paks/qemu-ga/uninstall.sh new file mode 100644 index 000000000..cc1115b99 --- /dev/null +++ b/src/paks/qemu-ga/uninstall.sh @@ -0,0 +1,32 @@ +#!/bin/bash +############################################################################ +# # +# This file is part of the IPFire Firewall. # +# # +# IPFire 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 2 of the License, or # +# (at your option) any later version. # +# # +# IPFire 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 IPFire; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Copyright (C) 2022 IPFire-Team info@ipfire.org. # +# # +############################################################################ +# +. /opt/pakfire/lib/functions.sh +stop_service ${NAME} +make_backup ${NAME}
+# remove symlinks
+rm -f /etc/rc.d/rc0.d/K00qemu-ga /etc/rc.d/rc3.d/S99qemu-ga /etc/rc.d/rc6.d/K00qemu-ga
+remove_files diff --git a/src/paks/qemu-ga/update.sh b/src/paks/qemu-ga/update.sh new file mode 100644 index 000000000..ea2505f2a --- /dev/null +++ b/src/paks/qemu-ga/update.sh @@ -0,0 +1,27 @@ +#!/bin/bash +############################################################################ +# # +# This file is part of the IPFire Firewall. # +# # +# IPFire 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 2 of the License, or # +# (at your option) any later version. # +# # +# IPFire 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 IPFire; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Copyright (C) 2007-2022 IPFire-Team info@ipfire.org. # +# # +############################################################################ +# +. /opt/pakfire/lib/functions.sh +extract_backup_includes +./uninstall.sh
+./install.sh
2.33.1