-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path61-config.sh
executable file
·122 lines (96 loc) · 2.45 KB
/
61-config.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash
# QQ群:111601117、钉钉群:35948877
# 避免chroot后执行
id lfs >/dev/null 2>&1
if [ $? = 0 ]; then
source `dirname ${BASH_SOURCE[0]}`/lfs.sh
cp -v ${BASH_SOURCE[0]} $LFS/task.sh
sed "s/_LFS_VERSION/$(getConf LFS_VERSION)/g" -i $LFS/task.sh
sed "s/_LFS_BUILD_PROC/$LFS_BUILD_PROC/g" -i $LFS/task.sh
source `dirname ${BASH_SOURCE[0]}`/chroot.sh
rm -fv $LFS/task.sh
exit
fi
# 来自chroot之后的调用
# 网络配置
cat > /etc/systemd/network/20-wired.network << EOF
[Match]
Name=en*
[Network]
DHCP=yes
EOF
cat > /etc/systemd/network/25-wireless.network << EOF
[Match]
Name=wl*
[Network]
DHCP=ipv4
EOF
# 主机名
echo "lucky" > /etc/hostname
# 时区
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# 语言
localedef -i zh_CN -f UTF-8 zh_CN.UTF-8
cat > /etc/locale.conf << "EOF"
LANG=zh_CN.UTF-8
EOF
# 创建 /etc/inputrc
cat > /etc/inputrc << "EOF"
# Begin /etc/inputrc
# Modified by Chris Lynn <[email protected]>
# Allow the command prompt to wrap to the next line
set horizontal-scroll-mode Off
# Enable 8-bit input
set meta-flag On
set input-meta On
# Turns off 8th bit stripping
set convert-meta Off
# Keep the 8th bit for display
set output-meta On
# none, visible or audible
set bell-style none
# All of the following map the escape sequence of the value
# contained in the 1st argument to the readline specific functions
"\eOd": backward-word
"\eOc": forward-word
# for linux console
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert
# for xterm
"\eOH": beginning-of-line
"\eOF": end-of-line
# for Konsole
"\e[H": beginning-of-line
"\e[F": end-of-line
# End /etc/inputrc
EOF
# 创建 /etc/shells
cat > /etc/shells << "EOF"
# Begin /etc/shells
/bin/sh
/bin/bash
# End /etc/shells
EOF
# systemd
systemctl preset-all --preset-mode=enable-only
systemctl disable systemd-sysupdate
# 创建 /etc/fstab
cat > /etc/fstab << "EOF"
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/nvme0n1p1 /boot/efi vfat umask=0077 0 0
/dev/nvme0n1p6 / btrfs noatime,subvol=@lfs 0 0
/dev/nvme0n1p6 /home btrfs noatime,subvol=@home 0 0
EOF
# 用户 shell
cat > /root/.bashrc << "EOF"
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
EOF
cat > /root/.bash_profile << "EOF"
[[ -f ~/.bashrc ]] && . ~/.bashrc
EOF