init-install.sh: Save/restore an existing VPN certificate

This commit is contained in:
Daniel Willmann 2017-08-01 03:35:34 +02:00
parent 0eb1ff6e3b
commit bf754ab498
2 changed files with 15 additions and 1 deletions

View File

@ -122,6 +122,14 @@ if [ ! "${device#mmcblk}" = "${device}" ]; then
fi
rootfs=/dev/${device}${part_prefix}1
## Backup - only works if install is using the same partition as before
mkdir -p /bkup_root
if [ mount -o ro $rootfs /bkup_root ]; then
echo "Saving openVPN certificate if it exists"
cp -r /bkup_root/etc/openvpn /tmp/ || true
umount /bkup_root
fi
echo "*****************"
echo "Rootfs partition size: $rootfs_size MB ($rootfs)"
echo "*****************"
@ -148,6 +156,12 @@ dd if=/media/$dev_name/$image_name of=$rootfs bs=1024
# Handling of the target root partition
mount $rootfs /tgt_root
# Restore OpenVPN certificate and config
if [ -d /tmp/openvpn/ -a -d /tgt_root/etc/ ]; then
echo "Restoring openVPN certificate"
cp -r /tmp/openvpn /tgt_root/etc/
fi
if [ -d /tgt_root/etc/ ] ; then
# We dont want udev to mount our root device while we're booting...
if [ -d /tgt_root/etc/udev/ ] ; then

View File

@ -1,6 +1,6 @@
SYSMOCOM := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}"
FILESEXTRAPATHS_prepend := "${SYSMOCOM}/files:"
PRINC = "2"
PRINC = "3"
RDEPENDS_${PN} += "e2fsprogs-e2fsck"