systemrescue-zfs/airootfs/root/customize_airootfs.sh

57 lines
1.7 KiB
Bash
Raw Normal View History

2019-02-02 12:22:52 +01:00
#!/bin/bash
set -e -u
sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen
locale-gen
ln -sf /usr/share/zoneinfo/UTC /etc/localtime
cp -aT /etc/skel/ /root/
2019-02-09 15:21:40 +01:00
2019-04-14 14:24:36 +02:00
rm -f /usr/lib/modules-load.d/pkcs8.conf
2019-02-09 15:21:40 +01:00
# Permissions
2019-02-02 12:22:52 +01:00
chmod 700 /root
chown root:root /root -R
2019-02-21 22:27:05 +01:00
chmod 755 /etc/systemd/scripts/*
chown root:root /etc/systemd -R
chown root:root /etc/modprobe.d -R
chown root:root /etc/{fstab,hostname}
2019-02-02 12:22:52 +01:00
# Configuration
2019-02-09 15:21:40 +01:00
sed -i 's/#\(PermitRootLogin \).\+/\1yes\nAllowUsers root/' /etc/ssh/sshd_config
sed -i 's/#\(PermitEmptyPasswords \).\+/\1no/' /etc/ssh/sshd_config
2019-02-02 12:22:52 +01:00
sed -i "s/#Server/Server/g" /etc/pacman.d/mirrorlist
sed -i 's/#\(Storage=\)auto/\1volatile/' /etc/systemd/journald.conf
sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' /etc/systemd/logind.conf
sed -i 's/#\(HandleHibernateKey=\)hibernate/\1ignore/' /etc/systemd/logind.conf
sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' /etc/systemd/logind.conf
# Services
systemctl enable NetworkManager
2019-12-29 21:39:32 +01:00
systemctl enable iptables.service
systemctl enable ip6tables.service
2019-02-09 15:21:40 +01:00
systemctl enable pacman-init.service
systemctl enable choose-mirror.service
systemctl enable sshd.service
systemctl enable sysresccd-initialize.service
systemctl enable sysresccd-autorun.service
2019-02-02 12:22:52 +01:00
systemctl set-default multi-user.target
# Cleanup
find /usr/lib -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
2019-12-29 21:48:13 +01:00
rm -rf /usr/share/gtk-doc /usr/share/doc /usr/share/keepassxc/docs/*.pdf
rm -rf /usr/share/gir*
2019-02-02 12:22:52 +01:00
2019-02-21 22:27:05 +01:00
# Update pacman.conf
sed -i -e '/# ==== BEGIN customrepos ====/,/# ==== END customrepos ====/d' /etc/pacman.conf
2019-02-02 12:22:52 +01:00
# Customizations
/usr/bin/updatedb
# Packages
2019-02-21 22:27:05 +01:00
pacman -Q > /root/packages-list.txt
2019-02-02 12:22:52 +01:00
pacman -Qi | egrep '^(Name|Installed)' | cut -f2 -d':' | paste - - | column -t | sort -nrk 2 | grep MiB > /root/packages-size.txt