systemrescue-zfs/airootfs/root/customize_airootfs.sh

83 lines
2.6 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
# Permissions
2019-02-02 12:22:52 +01:00
chmod 700 /root
2019-02-21 22:27:05 +01:00
chmod 755 /etc/systemd/scripts/*
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
# PulseAudio takes care of volume restore
ln -sf /dev/null /etc/udev/rules.d/90-alsa-restore.rules
2019-02-02 12:22:52 +01:00
# Services
systemctl enable NetworkManager.service
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
systemctl mask atop-rotate.timer
systemctl mask shadow.timer
# Provide additional commands (using busybox instead of binutils to save space)
ln -sf /usr/bin/busybox /usr/local/bin/ar
ln -sf /usr/bin/busybox /usr/local/bin/strings
2019-02-02 12:22:52 +01:00
# Cleanup
find /usr/lib -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
find /usr/lib -type f,l -name '*.a' -delete
rm -rf /usr/lib/libgo.*
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/keepassxc/translations
2019-12-29 21:48:13 +01:00
rm -rf /usr/share/gir*
rm -rf /usr/include
rm -rf /usr/share/man/man3
2019-02-02 12:22:52 +01:00
2020-04-12 19:30:37 +02:00
# Cleanup XFCE menu
sed -i '2 i NoDisplay=true' /usr/share/applications/{exo-mail-reader,exo-web-browser,jmacs,jpico,jstar}.desktop
sed -i "s/^\(Categories=\).*\$/Categories=TextEditor;Utility;/" /usr/share/applications/{geany,joe,jmacs,jpico,jstar}.desktop
# Remove large/irrelevant firmwares
rm -rf /usr/lib/firmware/{liquidio,netronome}
2020-01-26 15:02:31 +01:00
# Remove extra locales
2020-02-01 10:52:46 +01:00
if [ -x /usr/bin/localepurge ]
then
echo -e "MANDELETE\nDONTBOTHERNEWLOCALE\nSHOWFREEDSPACE\nen\nen_US\nen_US.UTF-8" > /etc/locale.nopurge
/usr/bin/localepurge
fi
2020-01-26 15:02:31 +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
expac -H M -s "%-30n %m" | sort -rhk 2 > /root/packages-size.txt
2020-04-13 16:29:38 +02:00
# Generate HTML version of the manual
markdown -o usr/share/sysresccd/index.html usr/share/sysresccd/index.md