Libvirt: Add backup

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>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Jonatan Schlag
2016-08-02 14:01:05 +02:00
committed by Michael Tremer
parent 4b8f1ffb31
commit 3a4a8b055b
5 changed files with 32 additions and 8 deletions

View File

@@ -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

View File

@@ -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