init-install.sh: Save/restore an existing VPN certificate
This commit is contained in:
parent
0eb1ff6e3b
commit
bf754ab498
|
@ -122,6 +122,14 @@ if [ ! "${device#mmcblk}" = "${device}" ]; then
|
||||||
fi
|
fi
|
||||||
rootfs=/dev/${device}${part_prefix}1
|
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 "*****************"
|
||||||
echo "Rootfs partition size: $rootfs_size MB ($rootfs)"
|
echo "Rootfs partition size: $rootfs_size MB ($rootfs)"
|
||||||
echo "*****************"
|
echo "*****************"
|
||||||
|
@ -148,6 +156,12 @@ dd if=/media/$dev_name/$image_name of=$rootfs bs=1024
|
||||||
# Handling of the target root partition
|
# Handling of the target root partition
|
||||||
mount $rootfs /tgt_root
|
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
|
if [ -d /tgt_root/etc/ ] ; then
|
||||||
# We dont want udev to mount our root device while we're booting...
|
# We dont want udev to mount our root device while we're booting...
|
||||||
if [ -d /tgt_root/etc/udev/ ] ; then
|
if [ -d /tgt_root/etc/udev/ ] ; then
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
SYSMOCOM := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}"
|
SYSMOCOM := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}"
|
||||||
FILESEXTRAPATHS_prepend := "${SYSMOCOM}/files:"
|
FILESEXTRAPATHS_prepend := "${SYSMOCOM}/files:"
|
||||||
|
|
||||||
PRINC = "2"
|
PRINC = "3"
|
||||||
|
|
||||||
RDEPENDS_${PN} += "e2fsprogs-e2fsck"
|
RDEPENDS_${PN} += "e2fsprogs-e2fsck"
|
||||||
|
|
Loading…
Reference in New Issue