Skip to content

Commit 89c689e

Browse files
authored
Merge pull request #37 from macmpi/dev
Version 1.2.3
2 parents 47f720a + 12d6ffe commit 89c689e

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

headless.apkovl.tar.gz

205 Bytes
Binary file not shown.

headless.apkovl.tar.gz.sha512

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d30ebaec4e1e9224e0a4a34861f392ba41adf585cdf6e3ede41492fb6a55a0c881455a510663422b77cb42a5b48a02fc17d62fafc74df6c49e324639b25ba337 headless.apkovl.tar.gz
1+
fecc6b66f1b08a959c6509334b5c1942b8df76ba6b7d51c54630f0c502706650b9d345bab71cd3d787681113eb5c1a40b2f6bc238ca6e4137fd00de8a6bc8a17 headless.apkovl.tar.gz

overlay/usr/local/bin/headless_bootstrap

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-FileCopyrightText: Copyright 2022-2023, macmpi
44
# SPDX-License-Identifier: MIT
55

6-
HDLSBSTRP_VERSION="1.2.2"
6+
HDLSBSTRP_VERSION="1.2.3"
77

88
_apk() {
99
local cmd="$1"
@@ -91,6 +91,9 @@ _setup_sshd() {
9191
## Setup temporary SSH server (root login, no password):
9292
# we use some bundled (or optionaly provided) keys to avoid generation at startup and save time.
9393
_apk add openssh-server
94+
# Preserve sshd-session & al binaries before uninstall
95+
[ -d /usr/lib/ssh ] && cp -a /usr/lib/ssh /tmp/.trash/.
96+
9497
_preserve "/etc/ssh/sshd_config"
9598
_preserve "/etc/conf.d/sshd"
9699

@@ -116,6 +119,15 @@ else
116119
EOF
117120
fi
118121

122+
# Define sshd-session & al files new location into sshd_config
123+
for f in /tmp/.trash/ssh/sshd-*; do
124+
[ -e "$f" ] || continue # protect failing glob
125+
name=$(echo $(basename $f) | cut -c6-)
126+
initial=$(echo $name | cut -c1 | tr [a-z] [A-Z])
127+
final=$(echo $name | cut -c2-)
128+
echo "Sshd${initial}${final}Path $f" >>/etc/ssh/sshd_config
129+
done
130+
119131
# Server keys: inject optional custom keys, or generate new (might be stored),
120132
# or use bundeled ones (not stored)
121133
local keygen_stance="sshd_disable_keygen=yes"
@@ -138,6 +150,7 @@ else
138150
fi
139151

140152
echo "$keygen_stance" >>/etc/conf.d/sshd
153+
141154
rc-service sshd restart
142155
}
143156

@@ -165,7 +178,7 @@ _is_ro && mount -o remount,ro "${ovlpath}"
165178
_logger "Update $updt_status"
166179

167180
if [ "$updt_status" = "successful" ]; then
168-
printf '%s\n\n' "Updated" >>/tmp/.trash/banner
181+
printf '%s\n\n' "Updated (Read release notes!)" >>/tmp/.trash/banner
169182
else
170183
printf '\n' >>/tmp/.trash/banner
171184
return 1
@@ -229,6 +242,7 @@ if ! install -m644 "${ovlpath}"/interfaces /etc/network/interfaces >/dev/null 2>
229242
230243
EOF
231244
for dev in /sys/class/net/*; do
245+
[ -e "$dev" ] || continue # protect failing glob
232246
# shellcheck disable=SC2034 # Unused IFINDEX while still sourced from uevent.
233247
local DEVTYPE INTERFACE IFINDEX
234248
DEVTYPE=""

0 commit comments

Comments
 (0)