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
117120fi
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)
121133local keygen_stance=" sshd_disable_keygen=yes"
138150fi
139151
140152echo " $keygen_stance " >> /etc/conf.d/sshd
153+
141154rc-service sshd restart
142155}
143156
@@ -165,7 +178,7 @@ _is_ro && mount -o remount,ro "${ovlpath}"
165178_logger " Update $updt_status "
166179
167180if [ " $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
169182else
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