From 3684f7d07d327d506a32f093a2d073fd8416b34c Mon Sep 17 00:00:00 2001 From: uvok cheetah Date: Mon, 9 Sep 2024 20:56:18 +0200 Subject: Set dropbear symlink --- custom/overlay/etc/init.d/S49-dropbear-prep | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'custom') diff --git a/custom/overlay/etc/init.d/S49-dropbear-prep b/custom/overlay/etc/init.d/S49-dropbear-prep index 33bad8f..7cc5ed6 100755 --- a/custom/overlay/etc/init.d/S49-dropbear-prep +++ b/custom/overlay/etc/init.d/S49-dropbear-prep @@ -4,11 +4,9 @@ # Assumes there's a third partition (test for it). # Assume partition is formatted (however you want). # -# TODO: -# Actually create the dropbear symlink if keys already -# exist in /data/dropbear/ # +set -eu start() { if ! [[ -e /data/ ]] ; then @@ -18,6 +16,11 @@ start() { if test -e /dev/mmcblk0p3 && ! grep -sq mmcblk0p3 /proc/mounts ; then mount /dev/mmcblk0p3 /data/ fi + + if grep -sq mmcblk0p3 /proc/mounts && test -d /data/dropbear ; then + rmdir /etc/dropbear || mv /etc/dropbear /etc/dropbear.bak + ln -snf /data/dropbear /etc/dropbear + fi } case "$1" in -- cgit v1.2.3