-
Notifications
You must be signed in to change notification settings - Fork 0
/
inchroot
83 lines (70 loc) · 2.37 KB
/
inchroot
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
#!/usr/bin/env bash
#
# System tune in chroot
set -e
readonly cfg='/mnt/cfg'
readonly bpath='/mnt/bin'
name="${1}"
password="${2}"
zone="${3}"
sboot="${4}"
lang="${5}"
echo '- CHROOT'
# Tune the system
mkdir -p /etc/{micro,wofi}
mkdir -p /etc/systemd/{resolved,timesyncd}.conf.d
mkdir -p \
/etc/systemd/system/{systemd-networkd-wait-online.service,boot.mount}.d
chmod -R 755 "${bpath}"
hostname="$(python3 "${bpath}/hostnamegen")"
echo "# ${hostname}
"$(date +'install-time=%s')"" >> "${cfg}/y2ai-release"
hwclock -wv --utc
cat "${cfg}/hyprland.conf" | sed "s/kb_layout = us/&,${lang}/" \
> /etc/hyprland.conf
cat "${cfg}/style.css" > /etc/xdg/waybar/style.css
cat "${cfg}/config.jsonc" > /etc/xdg/waybar/config.jsonc
cat "${cfg}/reflector.conf" > /etc/xdg/reflector/reflector.conf
echo "${hostname}" > /etc/hostname
cp "${cfg}/one-iface.conf" \
/etc/systemd/system/systemd-networkd-wait-online.service.d
cp "${cfg}/mount-options.conf" \
/etc/systemd/system/boot.mount.d
cp "${cfg}/dns.conf" /etc/systemd/resolved.conf.d/dns.conf
cp "${cfg}/ntp.conf" /etc/systemd/timesyncd.conf.d/ntp.conf
cp "${cfg}/zram-generator.conf" /etc/systemd
cp "${cfg}/"{20-wired,25-wireless}.network /etc/systemd/network
cp "${cfg}/settings.json" /etc/micro
cp "${cfg}/wofi.cfg" /etc/wofi/cfg
cp "${cfg}/wofi.css" /etc/wofi/css
cp "${cfg}/zshrc" /etc/zsh/zshrc
cp "${cfg}/60-ioschedulers.rules" /etc/udev/rules.d
cp "${cfg}/99-sysctl.conf" /etc/sysctl.d
cp "${cfg}/"{alacritty.toml,y2ai-release} /etc
cp -a "${bpath}/." /usr/local/bin
rm -f \
/usr/share/applications/{qv4l2,qvidcap,bvnc,bssh,avahi-discover}.desktop
chmod 444 /etc/y2ai-release
chattr +i /etc/y2ai-release
# Main
ln -sf "/usr/share/zoneinfo/${zone}" /etc/localtime
mkdir /etc/skel/{atp,trash}
touch /etc/skel/.zshrc
rm -f /etc/skel/.bash*
useradd -m -G 'wheel,video' -s /usr/bin/zsh "${name}"
echo "${name}:${password}" | chpasswd
systemctl enable \
systemd-networkd systemd-resolved systemd-networkd-persistent-storage \
systemd-timesyncd fstrim.timer reflector.timer
# Secure Boot setup
if [[ "${sboot}" == 'y' ]]; then
sbctl create-keys
sbctl enroll-keys --microsoft
sbctl sign -s /boot/vmlinuz-linux-zen
sbctl sign -s -o /usr/lib/systemd/boot/efi/systemd-bootx64.efi{.signed,}
fi
# systemd-boot
bootctl install --esp-path=/boot
cp "${cfg}/arch-zen.conf" /boot/loader/entries
echo 'editor no' > /boot/loader/loader.conf
echo '- Exiting chroot'