2019-02-02 12:22:52 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
set -e -u
|
|
|
|
|
|
2022-07-24 23:11:11 +02:00
|
|
|
echo "customize_airootfs.sh started..."
|
|
|
|
|
|
2019-02-02 12:22:52 +01:00
|
|
|
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
|
2020-08-05 02:46:11 +02:00
|
|
|
chmod 750 /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
|
2021-06-05 20:41:29 +02:00
|
|
|
sed -i 's/#\(Audit=\)yes/\1no/' /etc/systemd/journald.conf
|
2019-02-02 12:22:52 +01:00
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2020-03-13 00:06:04 +01:00
|
|
|
# PulseAudio takes care of volume restore
|
|
|
|
|
ln -sf /dev/null /etc/udev/rules.d/90-alsa-restore.rules
|
|
|
|
|
|
2022-04-24 19:52:04 +02:00
|
|
|
# config symlink
|
|
|
|
|
mkdir /etc/sysrescue/
|
|
|
|
|
ln -sf /run/archiso/config/sysrescue-effective-config.json /etc/sysrescue/sysrescue-effective-config.json
|
|
|
|
|
|
2019-02-02 12:22:52 +01:00
|
|
|
# Services
|
2020-03-08 12:55:01 +01:00
|
|
|
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 choose-mirror.service
|
|
|
|
|
systemctl enable sshd.service
|
2022-10-15 20:22:16 +02:00
|
|
|
systemctl enable sysrescue-initialize-prenet.service
|
|
|
|
|
systemctl enable sysrescue-initialize-whilenet.service
|
2020-09-12 12:27:37 +02:00
|
|
|
systemctl enable sysrescue-autorun.service
|
2020-11-08 13:23:10 +01:00
|
|
|
systemctl enable qemu-guest-agent.service
|
2021-12-05 02:08:37 +01:00
|
|
|
systemctl enable var-lib-pacman\\x2drolling-local.mount
|
2019-02-02 12:22:52 +01:00
|
|
|
systemctl set-default multi-user.target
|
|
|
|
|
|
2020-08-19 08:38:26 +02:00
|
|
|
# Mask irrelevant timer units (#140)
|
2020-03-08 12:55:01 +01:00
|
|
|
systemctl mask atop-rotate.timer
|
|
|
|
|
systemctl mask shadow.timer
|
2020-08-19 08:38:26 +02:00
|
|
|
systemctl mask man-db.timer
|
|
|
|
|
systemctl mask updatedb.timer
|
2022-12-18 22:02:49 +01:00
|
|
|
systemctl mask archlinux-keyring-wkd-sync.timer
|
2020-03-08 12:55:01 +01:00
|
|
|
|
2021-12-12 11:33:21 +01:00
|
|
|
# ldconfig ("Rebuild Dynamic Linker Cache") unnecessarily slows down boot some time after the release
|
|
|
|
|
systemctl mask ldconfig.service
|
|
|
|
|
|
2022-12-11 17:48:53 +01:00
|
|
|
# systemd-gpt-auto-generator could automatically mount filesystems given the right config. Prevent that.
|
2023-04-15 01:09:50 +02:00
|
|
|
mkdir -p /etc/systemd/system-generators/
|
|
|
|
|
ln -sf /dev/null /etc/systemd/system-generators/systemd-gpt-auto-generator
|
2022-12-11 17:48:53 +01:00
|
|
|
|
2022-07-24 23:11:11 +02:00
|
|
|
# setup pacman signing key storage
|
|
|
|
|
/usr/bin/pacman-key --init
|
|
|
|
|
/usr/bin/pacman-key --populate
|
|
|
|
|
rm -f /etc/pacman.d/gnupg/*~
|
|
|
|
|
|
2022-12-10 21:02:45 +01:00
|
|
|
echo "" >>/etc/pacman.d/gnupg/gpg.conf
|
|
|
|
|
echo "# disable caching & trustdb regeneration to be able to use pacman with faketime in the pacman-faketime wrapper" >>/etc/pacman.d/gnupg/gpg.conf
|
|
|
|
|
echo "no-sig-cache" >>/etc/pacman.d/gnupg/gpg.conf
|
|
|
|
|
echo "no-auto-check-trustdb" >>/etc/pacman.d/gnupg/gpg.conf
|
|
|
|
|
|
2022-10-11 22:33:17 +02:00
|
|
|
# get a list of all packages from sysrescuerepo to exclude them from reinstall by yay-prepare
|
|
|
|
|
mkdir -p /usr/share/sysrescue/lib/
|
|
|
|
|
pacman -Sl sysrescuerepo | sed -e "s/^sysrescuerepo //" \
|
|
|
|
|
| sed -e "s/\[installed.*\]//" >/usr/share/sysrescue/lib/yay-prepare-exclude
|
|
|
|
|
|
2019-02-02 12:22:52 +01:00
|
|
|
# Cleanup
|
2022-10-02 15:28:47 +02:00
|
|
|
# ATTENTION: adapt airootfs/usr/share/sysrescue/bin/yay-prepare when deleting anything that
|
|
|
|
|
# could be required for building packages
|
2019-02-02 12:22:52 +01:00
|
|
|
find /usr/lib -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
|
2020-01-25 14:56:36 +01:00
|
|
|
find /usr/lib -type f,l -name '*.a' -delete
|
2020-06-28 10:35:10 +02:00
|
|
|
rm -rf /usr/lib/{libgo.*,libgphobos.*,libgfortran.*}
|
2019-12-29 21:48:13 +01:00
|
|
|
rm -rf /usr/share/gtk-doc /usr/share/doc /usr/share/keepassxc/docs/*.pdf
|
2020-02-02 10:42:39 +01:00
|
|
|
rm -rf /usr/share/keepassxc/translations
|
2020-08-09 09:59:30 +02:00
|
|
|
rm -rf /usr/share/help/*/ghex/
|
2019-12-29 21:48:13 +01:00
|
|
|
rm -rf /usr/share/gir*
|
2020-01-25 13:39:01 +01:00
|
|
|
rm -rf /usr/include
|
2020-06-27 15:59:50 +02:00
|
|
|
rm -rf /usr/share/man/man3
|
2019-02-02 12:22:52 +01:00
|
|
|
|
2022-01-19 21:52:41 +01:00
|
|
|
# save some more space by removing large & unnecessary files
|
|
|
|
|
rm -f /lib/modules/*/vmlinuz
|
|
|
|
|
rm -f /usr/share/grub/themes/starfield/starfield.png
|
2022-07-31 12:57:04 +02:00
|
|
|
rm -f /usr/share/keepassxc/docs/*
|
2022-07-31 13:02:45 +02:00
|
|
|
rm -f /usr/share/qt6/translations/*
|
|
|
|
|
rm -f /usr/share/qt/translations/*
|
2022-01-19 21:52:41 +01:00
|
|
|
|
2020-04-12 19:30:37 +02:00
|
|
|
# Cleanup XFCE menu
|
2021-05-08 15:05:00 +02:00
|
|
|
sed -i '2 i NoDisplay=true' /usr/share/applications/{xfce4-mail-reader,xfce4-web-browser}.desktop
|
2021-11-07 12:17:48 +01:00
|
|
|
sed -i "s/^\(Categories=\).*\$/Categories=Utility;/" /usr/share/applications/{geany,*ristretto*,*GHex*}.desktop
|
2020-04-12 19:30:37 +02:00
|
|
|
|
2023-04-23 21:28:23 +02:00
|
|
|
# nm-applet with application indicator enabled gives better integration with xfce4-panel's systray
|
2024-01-27 13:00:44 +01:00
|
|
|
mkdir -p /usr/local/share/applications/
|
2023-04-23 21:28:23 +02:00
|
|
|
sed 's/^Exec=nm-applet$/& --indicator/' /usr/share/applications/nm-applet.desktop > /usr/local/share/applications/nm-applet.desktop
|
|
|
|
|
|
2020-01-12 11:06:57 +01:00
|
|
|
# Remove large/irrelevant firmwares
|
2021-11-07 09:39:57 +01:00
|
|
|
rm -rf /usr/lib/firmware/{liquidio,netronome,mellanox,mrvl/prestera,qcom}
|
2020-01-12 11:06:57 +01:00
|
|
|
|
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
|
2020-08-09 11:02:54 +02:00
|
|
|
sed -i -e '/# ==== BEGIN sysrescuerepo ====/,/# ==== END sysrescuerepo ====/d' /etc/pacman.conf
|
2019-02-02 12:22:52 +01:00
|
|
|
|
2020-08-05 21:03:43 +02:00
|
|
|
# Check for issues with binaries
|
|
|
|
|
/usr/bin/check-binaries.sh
|
|
|
|
|
|
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
|
2020-04-12 10:29:19 +02:00
|
|
|
expac -H M -s "%-30n %m" | sort -rhk 2 > /root/packages-size.txt
|