summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruvok cheetah2024-09-09 20:56:18 +0200
committeruvok cheetah2024-09-09 20:56:18 +0200
commit3684f7d07d327d506a32f093a2d073fd8416b34c (patch)
tree4d4b7ccf8f988d5b28fc3446622f9337e16d9462
parentb01d0123187966bc3028bbdfb9e8ef2623a7a813 (diff)
Set dropbear symlink
-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