mirror of
https://github.com/bin456789/reinstall.git
synced 2026-06-11 22:34:30 +08:00
+21
-2
@@ -1016,7 +1016,7 @@ get_windows_iso_link() {
|
||||
grep -Ewq 'ltsb|ltsc' <<<"$edition"
|
||||
}
|
||||
|
||||
# 部分 bash 不支持 $() 里面嵌套case,所以定义成函数
|
||||
# 部分 bash 例如 ubuntu 22.04 不支持 $() 里面嵌套case,所以定义成函数
|
||||
label_msdn=$(get_label_msdn)
|
||||
label_msdl=$(get_label_msdl)
|
||||
label_vlsc=$(get_label_vlsc)
|
||||
@@ -3673,8 +3673,27 @@ EOF
|
||||
-e "/^[[:space:]]*set[[:space:]]/s/E//" \
|
||||
$initrd_dir/trans.sh
|
||||
|
||||
# ubuntu 22.04 不支持这种语法,bash -n 会报错
|
||||
# 因此不验证 trans.sh 的语法
|
||||
# a=$(
|
||||
# case 1 in
|
||||
# 1)
|
||||
# case 1 in
|
||||
# 1) echo ;;
|
||||
# 2) echo ;;
|
||||
# esac
|
||||
# ;;
|
||||
# 2)
|
||||
# case 1 in
|
||||
# 1) echo ;;
|
||||
# 2) echo ;;
|
||||
# esac
|
||||
# ;;
|
||||
# esac
|
||||
# )
|
||||
|
||||
# 测试魔改后的 trans.sh 有没有语法问题
|
||||
bash -n $initrd_dir/trans.sh
|
||||
# bash -n $initrd_dir/trans.sh
|
||||
}
|
||||
|
||||
get_disk_drivers() {
|
||||
|
||||
@@ -4273,8 +4273,21 @@ _is_ssh_kv_effective() {
|
||||
local key=$2
|
||||
local value=$3
|
||||
|
||||
# centos 7 不支持 -G
|
||||
# 解决 ubuntu 22.04 报错
|
||||
# Missing privilege separation directory: /run/sshd
|
||||
if [ -d "$os_dir/run/sshd" ]; then
|
||||
we_create_run_sshd_dir=false
|
||||
else
|
||||
we_create_run_sshd_dir=true
|
||||
mkdir -p "$os_dir/run/sshd"
|
||||
fi
|
||||
|
||||
# centos 7 / ubuntu 22.04 不支持 -G
|
||||
if res=$(chroot "$os_dir" sshd -G 2>/dev/null || chroot "$os_dir" sshd -T 2>/dev/null); then
|
||||
# 删除自己创建的,避免后续权限不准确
|
||||
if $we_create_run_sshd_dir; then
|
||||
rm -rf "$os_dir/run/sshd"
|
||||
fi
|
||||
printf "%s\n" "$res" | grep -Fxiq "$key $value"
|
||||
else
|
||||
error_and_exit "Failed to verify sshd config."
|
||||
|
||||
Reference in New Issue
Block a user