summaryrefslogtreecommitdiff
path: root/custom/overlay/etc
diff options
context:
space:
mode:
Diffstat (limited to 'custom/overlay/etc')
-rwxr-xr-xcustom/overlay/etc/init.d/S49-dropbear-prep9
1 files changed, 6 insertions, 3 deletions
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