debian: 支持在安装过程中开启 ssh

This commit is contained in:
bin456789
2025-10-31 07:50:40 +08:00
parent 780e1a694f
commit 24a4446a02
3 changed files with 227 additions and 53 deletions

View File

@ -10,7 +10,7 @@ set -eE
# 用于判断 reinstall.sh 和 trans.sh 是否兼容
# shellcheck disable=SC2034
SCRIPT_VERSION=4BACD833-A585-23BA-6CBB-9AA4E08E0003
SCRIPT_VERSION=4BACD833-A585-23BA-6CBB-9AA4E08E0004
TRUE=0
FALSE=1
@ -294,7 +294,7 @@ setup_websocketd() {
pkill websocketd || true
# websocketd 遇到 \n 才推送,因此要转换 \r 为 \n
websocketd --port "$web_port" --loglevel=fatal --staticdir=/tmp \
stdbuf -oL -eL sh -c "tail -fn+0 /reinstall.log | tr '\r' '\n'" &
stdbuf -oL -eL sh -c "tail -fn+0 /reinstall.log | tr '\r' '\n' | grep -Fiv -e password -e token" &
}
get_approximate_ram_size() {
@ -934,11 +934,15 @@ unix2dos() {
}
insert_into_file() {
file=$1
location=$2
regex_to_find=$3
local file=$1
local location=$2
local regex_to_find=$3
shift 3
if ! [ -f "$file" ]; then
error_and_exit "File not found: $file"
fi
# 默认 grep -E
if [ $# -eq 0 ]; then
set -- -E
@ -1854,6 +1858,8 @@ add_frpc_systemd_service_if_need() {
frpc_url=$(get_frpc_url linux)
basename=$(echo "$frpc_url" | awk -F/ '{print $NF}' | sed 's/\.tar\.gz//')
download "$frpc_url" "$os_dir/frpc.tar.gz"
# busybox tar 不支持 wildcard
# tar: */frpc: not found in archive
tar xzf "$os_dir/frpc.tar.gz" "$basename/frpc" -O >"$os_dir/usr/local/bin/frpc"
rm -f "$os_dir/frpc.tar.gz"
chmod a+x "$os_dir/usr/local/bin/frpc"