62 lines
2.0 KiB
Bash
Executable File
62 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# run_once_50-configure-system.sh
|
|
# System-level config, enable services and set some settings
|
|
|
|
set -euo pipefail
|
|
|
|
SYS="$(chezmoi data --format=json 2>/dev/null | jq -r '.system // "desktop"')"
|
|
DISTRO_ID="$(chezmoi data --format=json 2>/dev/null | jq -r '.chezmoi.osRelease.id // empty')"
|
|
SRC="$(chezmoi source-path)"
|
|
echo ">>> [configure] distro=$DISTRO_ID, system=$SYS, source=$SRC"
|
|
|
|
services=(
|
|
bluetooth
|
|
cups
|
|
greetd
|
|
)
|
|
|
|
case "$DISTRO_ID" in
|
|
arch)
|
|
echo ">>> [configure] applying pacman.conf"
|
|
sudo install -m644 "$SRC/assets/pacman.conf" /etc/pacman.conf
|
|
|
|
echo ">>> [configure] applying pacman.conf"
|
|
sudo sed -i 's/^#MAKEFLAGS=/MAKEFLAGS="-j'"$(nproc)"'"/' /etc/makepkg.conf
|
|
|
|
if [ "$SYS" != "server" ]; then
|
|
echo ">>> [configure] enabling services"
|
|
for service in "${services[@]}"; do
|
|
if sudo systemctl enable "$service"; then
|
|
echo "✓ $service: success"
|
|
else
|
|
echo "✗ $service: failed"
|
|
fi
|
|
done
|
|
|
|
echo ">>> [configure] applying grub-theme"
|
|
if [ -d /boot/grub/themes ]; then
|
|
sudo mkdir -p /boot/grub/themes/minegrub
|
|
sudo cp -r "$SRC/assets/minegrub/." /boot/grub/themes/minegrub/
|
|
if ! grep -q '^GRUB_THEME=' /etc/default/grub 2>/dev/null; then
|
|
echo 'GRUB_THEME="/boot/grub/themes/minegrub/theme.txt"' \
|
|
| sudo tee -a /etc/default/grub >/dev/null
|
|
sudo grub-mkconfig -o /boot/grub/grub.cfg
|
|
fi
|
|
else
|
|
echo ">>> [configure] /boot/grub/themes missing — skipping grub theme install"
|
|
fi
|
|
fi
|
|
;;
|
|
|
|
ubuntu)
|
|
echo ">>> [configure] ubuntu no configure system"
|
|
;;
|
|
|
|
*)
|
|
echo ">>> [configure] unsupported distro: ${DISTRO_ID:-unknown}, skipping"
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
echo ">>> [configure] done"
|