Address installation inside a chroot

This commit is contained in:
David Heinemeier Hansson 2025-08-19 14:34:34 +02:00
parent 21f60a960b
commit 092b2ba51c
6 changed files with 19 additions and 13 deletions

View File

@ -7,7 +7,18 @@ export PATH="$HOME/.local/share/omarchy/bin:$PATH"
OMARCHY_INSTALL=~/.local/share/omarchy/install OMARCHY_INSTALL=~/.local/share/omarchy/install
# Chroot installations have some differences # Chroot installations have some differences
export OMARCHY_CHROOT_INSTALL=$(! cmp -s /proc/1/root/ / && echo 1 || echo 0) if ! cmp -s /proc/1/root/ / 2>/dev/null; then
export OMARCHY_CHROOT_INSTALL=1
fi
chrootable_systemctl_enable() {
local args=("$@")
if [ -n "${OMARCHY_CHROOT_INSTALL:-}" ]; then
sudo systemctl "${args[@]}" enable
else
sudo systemctl "${args[@]}" enable --now
fi
}
# Give people a chance to retry running the installation # Give people a chance to retry running the installation
catch_errors() { catch_errors() {

View File

@ -4,12 +4,7 @@
# This can happen if archinstall used ethernet # This can happen if archinstall used ethernet
if ! command -v iwctl &>/dev/null; then if ! command -v iwctl &>/dev/null; then
yay -S --noconfirm --needed iwd yay -S --noconfirm --needed iwd
chrootable_systemctl_enable iwd.service
if [ -n "${OMARCHY_CHROOT_INSTALL:-}" ]; then
sudo systemctl enable iwd.service
else
sudo systemctl enable --now iwd.service
fi
fi fi
# Prevent systemd-networkd-wait-online timeout on boot # Prevent systemd-networkd-wait-online timeout on boot

View File

@ -9,7 +9,7 @@ if ls /sys/class/power_supply/BAT* &>/dev/null; then
powerprofilesctl set balanced || true powerprofilesctl set balanced || true
# Enable battery monitoring timer for low battery notifications # Enable battery monitoring timer for low battery notifications
systemctl --user enable --now omarchy-battery-monitor.timer || true chrootable_systemctl_enable --user omarchy-battery-monitor.timer || true
else else
# This computer runs on power outlet # This computer runs on power outlet
powerprofilesctl set performance || true powerprofilesctl set performance || true

View File

@ -4,4 +4,4 @@
yay -S --noconfirm --needed blueberry yay -S --noconfirm --needed blueberry
# Turn on bluetooth by default # Turn on bluetooth by default
sudo systemctl enable --now bluetooth.service chrootable_systemctl_enable bluetooth.service

View File

@ -1,16 +1,16 @@
#!/bin/bash #!/bin/bash
sudo pacman -S --noconfirm cups cups-pdf cups-filters cups-browsed system-config-printer avahi nss-mdns sudo pacman -S --noconfirm cups cups-pdf cups-filters cups-browsed system-config-printer avahi nss-mdns
sudo systemctl enable --now cups.service chrootable_systemctl_enable cups.service
# Disable multicast dns in resolved. Avahi will provide this for better network printer discovery # Disable multicast dns in resolved. Avahi will provide this for better network printer discovery
sudo mkdir -p /etc/systemd/resolved.conf.d sudo mkdir -p /etc/systemd/resolved.conf.d
echo -e "[Resolve]\nMulticastDNS=no" | sudo tee /etc/systemd/resolved.conf.d/10-disable-multicast.conf echo -e "[Resolve]\nMulticastDNS=no" | sudo tee /etc/systemd/resolved.conf.d/10-disable-multicast.conf
sudo systemctl enable --now avahi-daemon.service chrootable_systemctl_enable avahi-daemon.service
# Enable automatically adding remote printers # Enable automatically adding remote printers
if ! grep -q '^CreateRemotePrinters Yes' /etc/cups/cups-browsed.conf; then if ! grep -q '^CreateRemotePrinters Yes' /etc/cups/cups-browsed.conf; then
echo 'CreateRemotePrinters Yes' | sudo tee -a /etc/cups/cups-browsed.conf echo 'CreateRemotePrinters Yes' | sudo tee -a /etc/cups/cups-browsed.conf
fi fi
sudo systemctl enable --now cups-browsed.service chrootable_systemctl_enable cups-browsed.service

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
if ! command -v ufw &>/dev/null; then if ! command -v ufw &>/dev/null && -z "${OMARCHY_CHROOT_INSTALL:-}"; then
yay -S --noconfirm --needed ufw ufw-docker yay -S --noconfirm --needed ufw ufw-docker
# Allow nothing in, everything out # Allow nothing in, everything out