mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-22 17:02:58 +02:00
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:
committed by
Michael Tremer
parent
4b8f1ffb31
commit
3a4a8b055b
1
config/backup/includes/libvirt
Normal file
1
config/backup/includes/libvirt
Normal file
@@ -0,0 +1 @@
|
||||
/etc/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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user