-
Notifications
You must be signed in to change notification settings - Fork 1
/
copy_psa_sw_to_vm.sh
34 lines (28 loc) · 1.04 KB
/
copy_psa_sw_to_vm.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Uses libguestfs - Installation guide: http://www.libguestfs.org/
#
# Run this as sudo and run this file from the folder that contains PSC folder.
#
# Make sure that:
# 1) SW_PATH directory exists in the target IMG.
# 2) Make sure that intefaces and boot_script_psa have executable permission (+x).
#
# WARNING: Using this on live virtual machines can be dangerous, potentially causing disk corruption! The virtual machine must be shut down before using this script!
IMG="/var/lib/libvirt/images/parentalcontrol.img"
SW_PATH="/home/psa/pythonScript/"
# Copy python files
echo -n "copy PSA SW... "
virt-copy-in -a $IMG PSA/* $SW_PATH
echo "done."
# Copy interfaces file
echo -n "copy interfaces... "
virt-copy-in -a $IMG PSA/interfaces /etc/network/
echo "done."
# Copy boot script that is executed when interfaces are up
echo -n "copy boot_script_psa... "
virt-copy-in -a $IMG PSA/boot_script_psa /etc/network/if-up.d/
echo "done."
#Copy the hostname
echo -n "copy hostname "
virt-copy-in -a $IMG hostname /etc/
virt-copy-in -a $IMG hosts /etc/
echo "done."