The directory /etc/libvirt is backed up on uninstallation and is restored on installation.
Alle Files in /var are commented in the rootfile so they are not removed on uninstallation. Because of the fact that the directories are not shipped with the package they were created at installation time. The permissions of 3 directories are changed because the qemu user is nobody and the qemu group is kvm, so the permissions must be nobody:kvm
Fixes: #11151
Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org --- config/backup/includes/libvirt | 1 + config/rootfiles/packages/libvirt | 15 ++++++++------- lfs/libvirt | 4 +++- src/paks/libvirt/install.sh | 16 ++++++++++++++++ src/paks/libvirt/uninstall.sh | 4 ++++ 5 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 config/backup/includes/libvirt
diff --git a/config/backup/includes/libvirt b/config/backup/includes/libvirt new file mode 100644 index 0000000..2306999 --- /dev/null +++ b/config/backup/includes/libvirt @@ -0,0 +1 @@ +/etc/libvirt diff --git a/config/rootfiles/packages/libvirt b/config/rootfiles/packages/libvirt index aa20aaa..b193987 100644 --- a/config/rootfiles/packages/libvirt +++ b/config/rootfiles/packages/libvirt @@ -271,17 +271,18 @@ usr/share/libvirt/schemas/storagevol.rng #usr/share/man/man8/libvirtd.8 #usr/share/man/man8/virtlockd.8 #var/cache/libvirt -var/cache/libvirt/qemu +#var/cache/libvirt/qemu #var/lib/libvirt -var/lib/libvirt/boot -var/lib/libvirt/filesystems -var/lib/libvirt/images +#var/lib/libvirt/boot +#var/lib/libvirt/filesystems +#var/lib/libvirt/images #var/lib/libvirt/lockd -var/lib/libvirt/lockd/files -var/lib/libvirt/qemu +#var/lib/libvirt/lockd/files +#var/lib/libvirt/qemu #var/log/libvirt #var/log/libvirt/lxc -var/log/libvirt/qemu +#var/log/libvirt/qemu #var/log/libvirt/uml etc/rc.d/init.d/libvirt-guests etc/rc.d/init.d/libvirtd +var/ipfire/backup/addons/includes/libvirt diff --git a/lfs/libvirt b/lfs/libvirt index 6768a72..c551bc2 100644 --- a/lfs/libvirt +++ b/lfs/libvirt @@ -33,7 +33,7 @@ DIR_APP = $(DIR_SRC)/$(THISAPP) TARGET = $(DIR_INFO)/$(THISAPP) SUP_ARCH = i586 x86_64 PROG = libvirt -PAK_VER = 4 +PAK_VER = 5
DEPS = "libpciaccess libyajl ncat qemu"
@@ -91,5 +91,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) cd $(DIR_APP) && make install install -v -m 754 $(DIR_SRC)/src/initscripts/init.d/libvirtd /etc/rc.d/init.d/libvirtd mv /usr/libexec/libvirt-guests.sh /etc/rc.d/init.d/libvirt-guests + # Backup + install -v -m 644 $(DIR_SRC)/config/backup/includes/libvirt /var/ipfire/backup/addons/includes/libvirt @rm -rf $(DIR_APP) @$(POSTBUILD) diff --git a/src/paks/libvirt/install.sh b/src/paks/libvirt/install.sh index c97a18d..1034b6b 100644 --- a/src/paks/libvirt/install.sh +++ b/src/paks/libvirt/install.sh @@ -29,6 +29,22 @@ getent passwd libvirt-remote >/dev/null || \ useradd -m -g libvirt-remote -s /bin/bash "libvirt-remote"
extract_files + +# create diretorys in var +mkdir -p /var/cache/libvirt/qemu \ +/var/lib/libvirt/boot \ +/var/lib/libvirt/filesystems \ +/var/lib/libvirt/images \ +/var/lib/libvirt/lockd/files \ +/var/lib/libvirt/qemu \ +/var/log/libvirt/qemu +# set the permissions +chown -R nobody:kvm /var/cache/libvirt/qemu +chown -R nobody:kvm /var/lib/libvirt/qemu +chown -R nobody:kvm /var/lib/libvirt/images +# restore the backup +restore_backup ${NAME} + start_service --delay 300 --background libvirtd ln -svf /etc/init.d/libvirtd /etc/rc.d/rc0.d/K20libvirtd ln -svf /etc/init.d/libvirtd /etc/rc.d/rc3.d/S70libvirtd diff --git a/src/paks/libvirt/uninstall.sh b/src/paks/libvirt/uninstall.sh index 16dc724..23c86e5 100644 --- a/src/paks/libvirt/uninstall.sh +++ b/src/paks/libvirt/uninstall.sh @@ -23,6 +23,10 @@ # . /opt/pakfire/lib/functions.sh stop_service libvirtd + +extract_backup_includes +make_backup ${NAME} + remove_files
rm -f /etc/rc.d/rc*.d/*libvirt-guests
On Tue, 2016-08-02 at 14:01 +0200, Jonatan Schlag wrote:
The directory /etc/libvirt is backed up on uninstallation and is restored on installation.
Alle Files in /var are commented in the rootfile so they are not removed on uninstallation. Because of the fact that the directories are not shipped with the package they were created at installation time. The permissions of 3 directories are changed because the qemu user is nobody and the qemu group is kvm, so the permissions must be nobody:kvm
Fixes: #11151
Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org
config/backup/includes/libvirt | 1 + config/rootfiles/packages/libvirt | 15 ++++++++------- lfs/libvirt | 4 +++- src/paks/libvirt/install.sh | 16 ++++++++++++++++ src/paks/libvirt/uninstall.sh | 4 ++++ 5 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 config/backup/includes/libvirt
diff --git a/config/backup/includes/libvirt b/config/backup/includes/libvirt new file mode 100644 index 0000000..2306999 --- /dev/null +++ b/config/backup/includes/libvirt @@ -0,0 +1 @@ +/etc/libvirt diff --git a/config/rootfiles/packages/libvirt b/config/rootfiles/packages/libvirt index aa20aaa..b193987 100644 --- a/config/rootfiles/packages/libvirt +++ b/config/rootfiles/packages/libvirt @@ -271,17 +271,18 @@ usr/share/libvirt/schemas/storagevol.rng #usr/share/man/man8/libvirtd.8 #usr/share/man/man8/virtlockd.8 #var/cache/libvirt -var/cache/libvirt/qemu +#var/cache/libvirt/qemu #var/lib/libvirt -var/lib/libvirt/boot -var/lib/libvirt/filesystems -var/lib/libvirt/images +#var/lib/libvirt/boot +#var/lib/libvirt/filesystems +#var/lib/libvirt/images #var/lib/libvirt/lockd -var/lib/libvirt/lockd/files -var/lib/libvirt/qemu +#var/lib/libvirt/lockd/files +#var/lib/libvirt/qemu #var/log/libvirt #var/log/libvirt/lxc -var/log/libvirt/qemu +#var/log/libvirt/qemu #var/log/libvirt/uml etc/rc.d/init.d/libvirt-guests etc/rc.d/init.d/libvirtd +var/ipfire/backup/addons/includes/libvirt diff --git a/lfs/libvirt b/lfs/libvirt index 6768a72..c551bc2 100644 --- a/lfs/libvirt +++ b/lfs/libvirt @@ -33,7 +33,7 @@ DIR_APP = $(DIR_SRC)/$(THISAPP) TARGET = $(DIR_INFO)/$(THISAPP) SUP_ARCH = i586 x86_64 PROG = libvirt -PAK_VER = 4 +PAK_VER = 5 DEPS = "libpciaccess libyajl ncat qemu" @@ -91,5 +91,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) cd $(DIR_APP) && make install install -v -m 754 $(DIR_SRC)/src/initscripts/init.d/libvirtd /etc/rc.d/init.d/libvirtd mv /usr/libexec/libvirt-guests.sh /etc/rc.d/init.d/libvirt-guests
- # Backup
- install -v -m 644 $(DIR_SRC)/config/backup/includes/libvirt
/var/ipfire/backup/addons/includes/libvirt @rm -rf $(DIR_APP) @$(POSTBUILD) diff --git a/src/paks/libvirt/install.sh b/src/paks/libvirt/install.sh index c97a18d..1034b6b 100644 --- a/src/paks/libvirt/install.sh +++ b/src/paks/libvirt/install.sh @@ -29,6 +29,22 @@ getent passwd libvirt-remote >/dev/null || \ useradd -m -g libvirt-remote -s /bin/bash "libvirt-remote" extract_files
+# create diretorys in var +mkdir -p /var/cache/libvirt/qemu \ +/var/lib/libvirt/boot \ +/var/lib/libvirt/filesystems \ +/var/lib/libvirt/images \ +/var/lib/libvirt/lockd/files \ +/var/lib/libvirt/qemu \ +/var/log/libvirt/qemu +# set the permissions +chown -R nobody:kvm /var/cache/libvirt/qemu +chown -R nobody:kvm /var/lib/libvirt/qemu +chown -R nobody:kvm /var/lib/libvirt/images
Wouldn't this possible change the ownership of already existing images?
+# restore the backup +restore_backup ${NAME}
start_service --delay 300 --background libvirtd ln -svf /etc/init.d/libvirtd /etc/rc.d/rc0.d/K20libvirtd ln -svf /etc/init.d/libvirtd /etc/rc.d/rc3.d/S70libvirtd diff --git a/src/paks/libvirt/uninstall.sh b/src/paks/libvirt/uninstall.sh index 16dc724..23c86e5 100644 --- a/src/paks/libvirt/uninstall.sh +++ b/src/paks/libvirt/uninstall.sh @@ -23,6 +23,10 @@ # . /opt/pakfire/lib/functions.sh stop_service libvirtd
+extract_backup_includes +make_backup ${NAME}
remove_files rm -f /etc/rc.d/rc*.d/*libvirt-guests