mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-31 19:08:07 +08:00
core: 安装模式添加 tty cmdline
This commit is contained in:
parent
9be306830e
commit
1f12589f47
@ -1,4 +1,6 @@
|
|||||||
|
# shellcheck disable=SC2148,SC2154
|
||||||
# https://www.debian.org/releases/stable/amd64/apbs04.zh-cn.html
|
# https://www.debian.org/releases/stable/amd64/apbs04.zh-cn.html
|
||||||
|
|
||||||
# B.4.1. 本地化
|
# B.4.1. 本地化
|
||||||
d-i debian-installer/locale string en_US
|
d-i debian-installer/locale string en_US
|
||||||
d-i keyboard-configuration/xkb-keymap select us
|
d-i keyboard-configuration/xkb-keymap select us
|
||||||
@ -66,6 +68,11 @@ d-i preseed/early_command string \
|
|||||||
d-i partman/early_command string \
|
d-i partman/early_command string \
|
||||||
debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
|
debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
|
||||||
|
|
||||||
|
d-i partman/early_command string \
|
||||||
|
confhome="$(grep -o 'extra\.confhome=[^ ]*' /proc/cmdline | cut -d= -f2)"; \
|
||||||
|
ttys=$(wget $confhome/ttys.sh -O- | sh -s console=); \
|
||||||
|
debconf-set debian-installer/add-kernel-opts "$ttys"
|
||||||
|
|
||||||
# debian 10 没有 /target/etc/ssh/sshd_config.d/ 文件夹
|
# debian 10 没有 /target/etc/ssh/sshd_config.d/ 文件夹
|
||||||
d-i preseed/late_command string \
|
d-i preseed/late_command string \
|
||||||
echo "PermitRootLogin yes" >/target/etc/ssh/sshd_config.d/01-permitrootlogin.conf || \
|
echo "PermitRootLogin yes" >/target/etc/ssh/sshd_config.d/01-permitrootlogin.conf || \
|
||||||
|
21
redhat.cfg
21
redhat.cfg
@ -10,7 +10,7 @@ reboot
|
|||||||
|
|
||||||
# 分区
|
# 分区
|
||||||
ignoredisk --only-use="sda|hda|xda|vda|xvda|nvme0n1"
|
ignoredisk --only-use="sda|hda|xda|vda|xvda|nvme0n1"
|
||||||
bootloader # 甲骨文x86输出到控制台添加 --append="console=ttyS0,9600"
|
%include /tmp/include-bootloader
|
||||||
clearpart --all --initlabel
|
clearpart --all --initlabel
|
||||||
reqpart # 如果需要,自动创建 efi 或 biosboot 分区
|
reqpart # 如果需要,自动创建 efi 或 biosboot 分区
|
||||||
part / --fstype=xfs --grow
|
part / --fstype=xfs --grow
|
||||||
@ -44,6 +44,25 @@ for var in $(grep -o "\b$prefix\.[^ ]*" /proc/cmdline | xargs); do
|
|||||||
eval "$(echo $var | sed -E "s/$prefix\.([^=]*)=(.*)/\1='\2'/")"
|
eval "$(echo $var | sed -E "s/$prefix\.([^=]*)=(.*)/\1='\2'/")"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# 设置 tty
|
||||||
|
include=/tmp/include-bootloader
|
||||||
|
str=
|
||||||
|
for tty in tty0 ttyS0 ttyAMA0; do
|
||||||
|
dev_tty=/dev/$tty
|
||||||
|
if [ -e $dev_tty ] && echo >$dev_tty 2>/dev/null; then
|
||||||
|
if [ -z "$str" ]; then
|
||||||
|
str="console=$tty"
|
||||||
|
else
|
||||||
|
str="$str console=$tty"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -n "$str" ]; then
|
||||||
|
echo "bootloader --append=\"$str\"" >$include
|
||||||
|
else
|
||||||
|
echo "bootloader" >$include
|
||||||
|
fi
|
||||||
|
|
||||||
# 有 installer 分区,表示用了两步安装
|
# 有 installer 分区,表示用了两步安装
|
||||||
include=/tmp/include-packages-for-resize
|
include=/tmp/include-packages-for-resize
|
||||||
touch $include
|
touch $include
|
||||||
|
@ -861,7 +861,7 @@ build_cmdline() {
|
|||||||
cmdline="alpine_repo=$nextos_repo modloop=$nextos_modloop $extra_cmdline $finalos_cmdline"
|
cmdline="alpine_repo=$nextos_repo modloop=$nextos_modloop $extra_cmdline $finalos_cmdline"
|
||||||
else
|
else
|
||||||
if [ $distro = debian ]; then
|
if [ $distro = debian ]; then
|
||||||
cmdline="lowmem=+1 lowmem/low=1 auto=true priority=critical url=$nextos_ks"
|
cmdline="lowmem=+1 lowmem/low=1 auto=true priority=critical url=$nextos_ks $extra_cmdline"
|
||||||
else
|
else
|
||||||
# redhat
|
# redhat
|
||||||
cmdline="root=live:$nextos_squashfs inst.ks=$nextos_ks $extra_cmdline"
|
cmdline="root=live:$nextos_squashfs inst.ks=$nextos_ks $extra_cmdline"
|
||||||
|
27
trans.sh
27
trans.sh
@ -131,6 +131,22 @@ setup_lighttpd() {
|
|||||||
rc-service lighttpd start
|
rc-service lighttpd start
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_ttys() {
|
||||||
|
prefix=$1
|
||||||
|
str=
|
||||||
|
for tty in tty0 ttyS0 ttyAMA0; do
|
||||||
|
dev_tty=/dev/$tty
|
||||||
|
if [ -e $dev_tty ] && echo >$dev_tty 2>/dev/null; then
|
||||||
|
if [ -z "$str" ]; then
|
||||||
|
str="$prefix$tty"
|
||||||
|
else
|
||||||
|
str="$str $prefix$tty"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo $str
|
||||||
|
}
|
||||||
|
|
||||||
setup_tty_and_log() {
|
setup_tty_and_log() {
|
||||||
cat <<EOF >/reinstall.html
|
cat <<EOF >/reinstall.html
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@ -151,12 +167,8 @@ setup_tty_and_log() {
|
|||||||
EOF
|
EOF
|
||||||
# 显示输出到前台
|
# 显示输出到前台
|
||||||
# script -f /dev/tty0
|
# script -f /dev/tty0
|
||||||
for t in /dev/tty0 /dev/ttyS0 /dev/ttyAMA0; do
|
dev_ttys=$(get_ttys /dev/)
|
||||||
if [ -e $t ] && echo >$t 2>/dev/null; then
|
exec > >(tee -a $dev_ttys /reinstall.html) 2>&1
|
||||||
ttys="$ttys $t"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
exec > >(tee -a $ttys /reinstall.html) 2>&1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_env_from_cmdline() {
|
extract_env_from_cmdline() {
|
||||||
@ -1134,6 +1146,7 @@ install_redhat_ubuntu() {
|
|||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
if [ "$distro" = "ubuntu" ]; then
|
if [ "$distro" = "ubuntu" ]; then
|
||||||
download $iso /os/installer/ubuntu.iso
|
download $iso /os/installer/ubuntu.iso
|
||||||
|
console_cmdline=$(get_ttys console=)
|
||||||
|
|
||||||
# 正常写法应该是 ds="nocloud-net;s=https://xxx/" 但是甲骨文云的ds更优先,自己的ds根本无访问记录
|
# 正常写法应该是 ds="nocloud-net;s=https://xxx/" 但是甲骨文云的ds更优先,自己的ds根本无访问记录
|
||||||
# $seed 是 https://xxx/
|
# $seed 是 https://xxx/
|
||||||
@ -1144,7 +1157,7 @@ install_redhat_ubuntu() {
|
|||||||
# rmmod tpm
|
# rmmod tpm
|
||||||
search --no-floppy --label --set=root installer
|
search --no-floppy --label --set=root installer
|
||||||
loopback loop /ubuntu.iso
|
loopback loop /ubuntu.iso
|
||||||
linux (loop)/casper/vmlinuz iso-scan/filename=/ubuntu.iso autoinstall noprompt noeject cloud-config-url=$ks $extra_cmdline ---
|
linux (loop)/casper/vmlinuz iso-scan/filename=/ubuntu.iso autoinstall noprompt noeject cloud-config-url=$ks $extra_cmdline --- $console_cmdline
|
||||||
initrd (loop)/casper/initrd
|
initrd (loop)/casper/initrd
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user