Add Limine + Snapper support (#998)
* Persist urgent notifications * Create omarchy-snapshot * Create snapshot before pulling * Extract alternative bootloader configs * Add limine-snapper config * Fix check * Update login scripts * Make chroot friendly * Extract cmdline instead of using blkid due to error * Add restore command * Export $TERMINAL so we get clickable restore notifications * Remove sync -- causes errors...we have nothing to sync yet * Executable * Minor cleanup and compatibility for non-ISO * Give login its own section * Give no-arg guard and inline commands --------- Co-authored-by: David Heinemeier Hansson <david@hey.com>
This commit is contained in:
parent
318a6e23cf
commit
d4403051cf
22
bin/omarchy-snapshot
Executable file
22
bin/omarchy-snapshot
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
COMMAND="$1"
|
||||
OMARCHY_PATH=${OMARCHY_PATH:-$HOME/.local/share/omarchy}
|
||||
|
||||
if [[ -z $COMMAND ]]; then
|
||||
echo "Usage: omarchy-snapshot <create|restore>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$COMMAND" in
|
||||
create)
|
||||
DESC="$(omarchy-version)"
|
||||
|
||||
for config in root home; do
|
||||
sudo snapper -c "$config" create -c number -d "$DESC"
|
||||
done
|
||||
;;
|
||||
restore)
|
||||
sudo limine-snapper-restore
|
||||
;;
|
||||
esac
|
@ -2,6 +2,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
omarchy-snapshot create
|
||||
omarchy-update-git
|
||||
omarchy-migrate
|
||||
omarchy-update-system-pkgs
|
||||
|
@ -1,5 +1,6 @@
|
||||
export OMARCHY_PATH=$HOME/.local/share/omarchy
|
||||
export PATH=$OMARCHY_PATH/bin/:$PATH
|
||||
export TERMINAL=alacritty
|
||||
|
||||
if command -v mise &> /dev/null; then
|
||||
eval "$(mise activate bash)"
|
||||
|
@ -73,11 +73,15 @@ source $OMARCHY_INSTALL/config/network.sh
|
||||
source $OMARCHY_INSTALL/config/power.sh
|
||||
source $OMARCHY_INSTALL/config/usb-autosuspend.sh
|
||||
source $OMARCHY_INSTALL/config/timezones.sh
|
||||
source $OMARCHY_INSTALL/config/login.sh
|
||||
source $OMARCHY_INSTALL/config/nvidia.sh
|
||||
source $OMARCHY_INSTALL/config/increase-sudo-tries.sh
|
||||
source $OMARCHY_INSTALL/config/ignore-power-button.sh
|
||||
|
||||
# Login
|
||||
source $OMARCHY_INSTALL/login/plymouth.sh
|
||||
source $OMARCHY_INSTALL/login/limine-snapper.sh
|
||||
source $OMARCHY_INSTALL/login/alt-bootloaders.sh
|
||||
|
||||
# Development
|
||||
source $OMARCHY_INSTALL/development/terminal.sh
|
||||
source $OMARCHY_INSTALL/development/development.sh
|
||||
|
115
install/login/bootloaders.sh
Normal file
115
install/login/bootloaders.sh
Normal file
@ -0,0 +1,115 @@
|
||||
if ! command -v limine &>/dev/null; then
|
||||
# Add kernel hooks
|
||||
if ! grep -Eq '^HOOKS=.*plymouth' /etc/mkinitcpio.conf; then
|
||||
# Backup original mkinitcpio.conf just in case
|
||||
backup_timestamp=$(date +"%Y%m%d%H%M%S")
|
||||
sudo cp /etc/mkinitcpio.conf "/etc/mkinitcpio.conf.bak.${backup_timestamp}"
|
||||
|
||||
# Add plymouth to HOOKS array after 'base udev' or 'base systemd'
|
||||
if grep "^HOOKS=" /etc/mkinitcpio.conf | grep -q "base systemd"; then
|
||||
sudo sed -i '/^HOOKS=/s/base systemd/base systemd plymouth/' /etc/mkinitcpio.conf
|
||||
elif grep "^HOOKS=" /etc/mkinitcpio.conf | grep -q "base udev"; then
|
||||
sudo sed -i '/^HOOKS=/s/base udev/base udev plymouth/' /etc/mkinitcpio.conf
|
||||
else
|
||||
echo "Couldn't add the Plymouth hook"
|
||||
fi
|
||||
|
||||
# Regenerate initramfs
|
||||
sudo mkinitcpio -P
|
||||
fi
|
||||
|
||||
# Add kernel parameters for Plymouth
|
||||
if [ -d "/boot/loader/entries" ]; then # systemd-boot
|
||||
echo "Detected systemd-boot"
|
||||
|
||||
for entry in /boot/loader/entries/*.conf; do
|
||||
if [ -f "$entry" ]; then
|
||||
# Skip fallback entries
|
||||
if [[ "$(basename "$entry")" == *"fallback"* ]]; then
|
||||
echo "Skipped: $(basename "$entry") (fallback entry)"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Skip if splash it already present for some reason
|
||||
if ! grep -q "splash" "$entry"; then
|
||||
sudo sed -i '/^options/ s/$/ splash quiet/' "$entry"
|
||||
else
|
||||
echo "Skipped: $(basename "$entry") (splash already present)"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
elif [ -f "/etc/default/grub" ]; then # Grub
|
||||
echo "Detected grub"
|
||||
|
||||
# Backup GRUB config before modifying
|
||||
backup_timestamp=$(date +"%Y%m%d%H%M%S")
|
||||
sudo cp /etc/default/grub "/etc/default/grub.bak.${backup_timestamp}"
|
||||
|
||||
# Check if splash is already in GRUB_CMDLINE_LINUX_DEFAULT
|
||||
if ! grep -q "GRUB_CMDLINE_LINUX_DEFAULT.*splash" /etc/default/grub; then
|
||||
# Get current GRUB_CMDLINE_LINUX_DEFAULT value
|
||||
current_cmdline=$(grep "^GRUB_CMDLINE_LINUX_DEFAULT=" /etc/default/grub | cut -d'"' -f2)
|
||||
|
||||
# Add splash and quiet if not present
|
||||
new_cmdline="$current_cmdline"
|
||||
if [[ ! "$current_cmdline" =~ splash ]]; then
|
||||
new_cmdline="$new_cmdline splash"
|
||||
fi
|
||||
if [[ ! "$current_cmdline" =~ quiet ]]; then
|
||||
new_cmdline="$new_cmdline quiet"
|
||||
fi
|
||||
|
||||
# Trim any leading/trailing spaces
|
||||
new_cmdline=$(echo "$new_cmdline" | xargs)
|
||||
|
||||
sudo sed -i "s/^GRUB_CMDLINE_LINUX_DEFAULT=\".*\"/GRUB_CMDLINE_LINUX_DEFAULT=\"$new_cmdline\"/" /etc/default/grub
|
||||
|
||||
# Regenerate grub config
|
||||
sudo grub-mkconfig -o /boot/grub/grub.cfg
|
||||
else
|
||||
echo "GRUB already configured with splash kernel parameters"
|
||||
fi
|
||||
elif [ -d "/etc/cmdline.d" ]; then # UKI
|
||||
echo "Detected a UKI setup"
|
||||
# Relying on mkinitcpio to assemble a UKI
|
||||
# https://wiki.archlinux.org/title/Unified_kernel_image
|
||||
if ! grep -q splash /etc/cmdline.d/*.conf; then
|
||||
# Need splash, create the omarchy file
|
||||
echo "splash" | sudo tee -a /etc/cmdline.d/omarchy.conf
|
||||
fi
|
||||
if ! grep -q quiet /etc/cmdline.d/*.conf; then
|
||||
# Need quiet, create or append the omarchy file
|
||||
echo "quiet" | sudo tee -a /etc/cmdline.d/omarchy.conf
|
||||
fi
|
||||
elif [ -f "/etc/kernel/cmdline" ]; then # UKI Alternate
|
||||
# Alternate UKI kernel cmdline location
|
||||
echo "Detected a UKI setup"
|
||||
|
||||
# Backup kernel cmdline config before modifying
|
||||
backup_timestamp=$(date +"%Y%m%d%H%M%S")
|
||||
sudo cp /etc/kernel/cmdline "/etc/kernel/cmdline.bak.${backup_timestamp}"
|
||||
|
||||
current_cmdline=$(cat /etc/kernel/cmdline)
|
||||
|
||||
# Add splash and quiet if not present
|
||||
new_cmdline="$current_cmdline"
|
||||
if [[ ! "$current_cmdline" =~ splash ]]; then
|
||||
new_cmdline="$new_cmdline splash"
|
||||
fi
|
||||
if [[ ! "$current_cmdline" =~ quiet ]]; then
|
||||
new_cmdline="$new_cmdline quiet"
|
||||
fi
|
||||
|
||||
# Trim any leading/trailing spaces
|
||||
new_cmdline=$(echo "$new_cmdline" | xargs)
|
||||
|
||||
# Write new file
|
||||
echo $new_cmdline | sudo tee /etc/kernel/cmdline
|
||||
else
|
||||
echo ""
|
||||
echo " None of systemd-boot, GRUB, or UKI detected. Please manually add these kernel parameters:"
|
||||
echo " - splash (to see the graphical splash screen)"
|
||||
echo " - quiet (for silent boot)"
|
||||
echo ""
|
||||
fi
|
||||
fi
|
80
install/login/limine-snapper.sh
Normal file
80
install/login/limine-snapper.sh
Normal file
@ -0,0 +1,80 @@
|
||||
if command -v limine &>/dev/null && [ ! -f /etc/default/limine ]; then
|
||||
yay -S --noconfirm --needed limine-mkinitcpio-hook limine-snapper-sync
|
||||
|
||||
sudo tee /etc/mkinitcpio.conf.d/omarchy_hooks.conf <<EOF >/dev/null
|
||||
HOOKS=(base udev plymouth keyboard autodetect microcode modconf kms keymap consolefont block encrypt filesystems fsck btrfs-overlayfs)
|
||||
EOF
|
||||
|
||||
CMDLINE=$(grep "^[[:space:]]*cmdline:" /boot/EFI/limine/limine.conf | head -1 | sed 's/^[[:space:]]*cmdline:[[:space:]]*//')
|
||||
|
||||
sudo tee /etc/default/limine <<EOF >/dev/null
|
||||
TARGET_OS_NAME="Omarchy"
|
||||
|
||||
KERNEL_CMDLINE[default]="$CMDLINE"
|
||||
KERNEL_CMDLINE[default]+="quiet splash"
|
||||
|
||||
ENABLE_UKI=yes
|
||||
|
||||
ENABLE_LIMINE_FALLBACK=yes
|
||||
|
||||
# Find and add other bootloaders
|
||||
FIND_BOOTLOADERS=yes
|
||||
|
||||
BOOT_ORDER="*, *fallback, Snapshots"
|
||||
|
||||
MAX_SNAPSHOT_ENTRIES=5
|
||||
|
||||
SNAPSHOT_FORMAT_CHOICE=5
|
||||
EOF
|
||||
|
||||
# We overwrite the whole thing knowing the limine-update will add the entries for us
|
||||
sudo tee /boot/limine.conf <<EOF >/dev/null
|
||||
### Read more at config document: https://github.com/limine-bootloader/limine/blob/trunk/CONFIG.md
|
||||
#timeout: 3
|
||||
default_entry: 2
|
||||
interface_branding: Omarchy Bootloader
|
||||
interface_branding_color: 2
|
||||
hash_mismatch_panic: no
|
||||
|
||||
term_background: 1a1b26
|
||||
backdrop: 1a1b26
|
||||
|
||||
# Terminal colors (Tokyo Night palette)
|
||||
term_palette: 15161e;f7768e;9ece6a;e0af68;7aa2f7;bb9af7;7dcfff;a9b1d6
|
||||
term_palette_bright: 414868;f7768e;9ece6a;e0af68;7aa2f7;bb9af7;7dcfff;c0caf5
|
||||
|
||||
# Text colors
|
||||
term_foreground: c0caf5
|
||||
term_foreground_bright: c0caf5
|
||||
term_background_bright: 24283b
|
||||
|
||||
EOF
|
||||
|
||||
# Match Snapper configs if not installing from the ISO
|
||||
if [ -z "${OMARCHY_CHROOT_INSTALL:-}" ]; then
|
||||
if ! sudo snapper list-configs 2>/dev/null | grep -q "root"; then
|
||||
sudo snapper -c root create-config /
|
||||
fi
|
||||
if ! sudo snapper list-configs 2>/dev/null | grep -q "home"; then
|
||||
sudo snapper -c home create-config /home
|
||||
fi
|
||||
end
|
||||
|
||||
# Tweak default Snapper configs
|
||||
sudo sed -i 's/^TIMELINE_CREATE="yes"/TIMELINE_CREATE="no"/' /etc/snapper/configs/{root,home}
|
||||
sudo sed -i 's/^NUMBER_LIMIT="50"/NUMBER_LIMIT="5"/' /etc/snapper/configs/{root,home}
|
||||
sudo sed -i 's/^NUMBER_LIMIT_IMPORTANT="10"/NUMBER_LIMIT_IMPORTANT="5"/' /etc/snapper/configs/{root,home}
|
||||
|
||||
sudo limine-update
|
||||
chrootable_systemctl_enable limine-snapper-sync.service
|
||||
fi
|
||||
|
||||
# Add UKI entry to UEFI machines to skip bootloader showing on normal boot
|
||||
# Only doing this for ISO installs
|
||||
if [ -n "${OMARCHY_CHROOT_INSTALL:-}" ] && efibootmgr &>/dev/null && ! efibootmgr | grep -q Omarchy; then
|
||||
sudo efibootmgr --create \
|
||||
--disk "$(findmnt -n -o SOURCE /boot | sed 's/[0-9]*$//')" \
|
||||
--part "$(findmnt -n -o SOURCE /boot | grep -o '[0-9]*$')" \
|
||||
--label "Omarchy" \
|
||||
--loader "\\EFI\\Linux\\$(cat /etc/machine-id)_linux.efi"
|
||||
fi
|
@ -9,119 +9,6 @@ fi
|
||||
# PLYMOUTH SETUP
|
||||
# ==============================================================================
|
||||
|
||||
if ! grep -Eq '^HOOKS=.*plymouth' /etc/mkinitcpio.conf; then
|
||||
# Backup original mkinitcpio.conf just in case
|
||||
backup_timestamp=$(date +"%Y%m%d%H%M%S")
|
||||
sudo cp /etc/mkinitcpio.conf "/etc/mkinitcpio.conf.bak.${backup_timestamp}"
|
||||
|
||||
# Add plymouth to HOOKS array after 'base udev' or 'base systemd'
|
||||
if grep "^HOOKS=" /etc/mkinitcpio.conf | grep -q "base systemd"; then
|
||||
sudo sed -i '/^HOOKS=/s/base systemd/base systemd plymouth/' /etc/mkinitcpio.conf
|
||||
elif grep "^HOOKS=" /etc/mkinitcpio.conf | grep -q "base udev"; then
|
||||
sudo sed -i '/^HOOKS=/s/base udev/base udev plymouth/' /etc/mkinitcpio.conf
|
||||
else
|
||||
echo "Couldn't add the Plymouth hook"
|
||||
fi
|
||||
|
||||
# Regenerate initramfs
|
||||
sudo mkinitcpio -P
|
||||
fi
|
||||
|
||||
# Add kernel parameters for Plymouth
|
||||
if [ -d "/boot/loader/entries" ]; then # systemd-boot
|
||||
echo "Detected systemd-boot"
|
||||
|
||||
for entry in /boot/loader/entries/*.conf; do
|
||||
if [ -f "$entry" ]; then
|
||||
# Skip fallback entries
|
||||
if [[ "$(basename "$entry")" == *"fallback"* ]]; then
|
||||
echo "Skipped: $(basename "$entry") (fallback entry)"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Skip if splash it already present for some reason
|
||||
if ! grep -q "splash" "$entry"; then
|
||||
sudo sed -i '/^options/ s/$/ splash quiet/' "$entry"
|
||||
else
|
||||
echo "Skipped: $(basename "$entry") (splash already present)"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
elif [ -f "/etc/default/grub" ]; then # Grub
|
||||
echo "Detected grub"
|
||||
|
||||
# Backup GRUB config before modifying
|
||||
backup_timestamp=$(date +"%Y%m%d%H%M%S")
|
||||
sudo cp /etc/default/grub "/etc/default/grub.bak.${backup_timestamp}"
|
||||
|
||||
# Check if splash is already in GRUB_CMDLINE_LINUX_DEFAULT
|
||||
if ! grep -q "GRUB_CMDLINE_LINUX_DEFAULT.*splash" /etc/default/grub; then
|
||||
# Get current GRUB_CMDLINE_LINUX_DEFAULT value
|
||||
current_cmdline=$(grep "^GRUB_CMDLINE_LINUX_DEFAULT=" /etc/default/grub | cut -d'"' -f2)
|
||||
|
||||
# Add splash and quiet if not present
|
||||
new_cmdline="$current_cmdline"
|
||||
if [[ ! "$current_cmdline" =~ splash ]]; then
|
||||
new_cmdline="$new_cmdline splash"
|
||||
fi
|
||||
if [[ ! "$current_cmdline" =~ quiet ]]; then
|
||||
new_cmdline="$new_cmdline quiet"
|
||||
fi
|
||||
|
||||
# Trim any leading/trailing spaces
|
||||
new_cmdline=$(echo "$new_cmdline" | xargs)
|
||||
|
||||
sudo sed -i "s/^GRUB_CMDLINE_LINUX_DEFAULT=\".*\"/GRUB_CMDLINE_LINUX_DEFAULT=\"$new_cmdline\"/" /etc/default/grub
|
||||
|
||||
# Regenerate grub config
|
||||
sudo grub-mkconfig -o /boot/grub/grub.cfg
|
||||
else
|
||||
echo "GRUB already configured with splash kernel parameters"
|
||||
fi
|
||||
elif [ -d "/etc/cmdline.d" ]; then # UKI
|
||||
echo "Detected a UKI setup"
|
||||
# Relying on mkinitcpio to assemble a UKI
|
||||
# https://wiki.archlinux.org/title/Unified_kernel_image
|
||||
if ! grep -q splash /etc/cmdline.d/*.conf; then
|
||||
# Need splash, create the omarchy file
|
||||
echo "splash" | sudo tee -a /etc/cmdline.d/omarchy.conf
|
||||
fi
|
||||
if ! grep -q quiet /etc/cmdline.d/*.conf; then
|
||||
# Need quiet, create or append the omarchy file
|
||||
echo "quiet" | sudo tee -a /etc/cmdline.d/omarchy.conf
|
||||
fi
|
||||
elif [ -f "/etc/kernel/cmdline" ]; then # UKI Alternate
|
||||
# Alternate UKI kernel cmdline location
|
||||
echo "Detected a UKI setup"
|
||||
|
||||
# Backup kernel cmdline config before modifying
|
||||
backup_timestamp=$(date +"%Y%m%d%H%M%S")
|
||||
sudo cp /etc/kernel/cmdline "/etc/kernel/cmdline.bak.${backup_timestamp}"
|
||||
|
||||
current_cmdline=$(cat /etc/kernel/cmdline)
|
||||
|
||||
# Add splash and quiet if not present
|
||||
new_cmdline="$current_cmdline"
|
||||
if [[ ! "$current_cmdline" =~ splash ]]; then
|
||||
new_cmdline="$new_cmdline splash"
|
||||
fi
|
||||
if [[ ! "$current_cmdline" =~ quiet ]]; then
|
||||
new_cmdline="$new_cmdline quiet"
|
||||
fi
|
||||
|
||||
# Trim any leading/trailing spaces
|
||||
new_cmdline=$(echo "$new_cmdline" | xargs)
|
||||
|
||||
# Write new file
|
||||
echo $new_cmdline | sudo tee /etc/kernel/cmdline
|
||||
else
|
||||
echo ""
|
||||
echo " None of systemd-boot, GRUB, or UKI detected. Please manually add these kernel parameters:"
|
||||
echo " - splash (to see the graphical splash screen)"
|
||||
echo " - quiet (for silent boot)"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ "$(plymouth-set-default-theme)" != "omarchy" ]; then
|
||||
sudo cp -r "$HOME/.local/share/omarchy/default/plymouth" /usr/share/plymouth/themes/omarchy/
|
||||
sudo plymouth-set-default-theme -R omarchy
|
@ -20,3 +20,6 @@ invisible=true
|
||||
[mode=do-not-disturb app-name=notify-send]
|
||||
invisible=false
|
||||
|
||||
|
||||
[urgency=critical]
|
||||
default-timeout=0
|
||||
|
@ -19,3 +19,6 @@ invisible=true
|
||||
|
||||
[mode=do-not-disturb app-name=notify-send]
|
||||
invisible=false
|
||||
|
||||
[urgency=critical]
|
||||
default-timeout=0
|
||||
|
@ -19,3 +19,6 @@ invisible=true
|
||||
|
||||
[mode=do-not-disturb app-name=notify-send]
|
||||
invisible=false
|
||||
|
||||
[urgency=critical]
|
||||
default-timeout=0
|
||||
|
@ -19,3 +19,6 @@ invisible=true
|
||||
|
||||
[mode=do-not-disturb app-name=notify-send]
|
||||
invisible=false
|
||||
|
||||
[urgency=critical]
|
||||
default-timeout=0
|
||||
|
@ -19,3 +19,6 @@ invisible=true
|
||||
|
||||
[mode=do-not-disturb app-name=notify-send]
|
||||
invisible=false
|
||||
|
||||
[urgency=critical]
|
||||
default-timeout=0
|
||||
|
@ -19,3 +19,6 @@ invisible=true
|
||||
|
||||
[mode=do-not-disturb app-name=notify-send]
|
||||
invisible=false
|
||||
|
||||
[urgency=critical]
|
||||
default-timeout=0
|
||||
|
@ -19,3 +19,6 @@ invisible=true
|
||||
|
||||
[mode=do-not-disturb app-name=notify-send]
|
||||
invisible=false
|
||||
|
||||
[urgency=critical]
|
||||
default-timeout=0
|
||||
|
@ -19,3 +19,6 @@ invisible=true
|
||||
|
||||
[mode=do-not-disturb app-name=notify-send]
|
||||
invisible=false
|
||||
|
||||
[urgency=critical]
|
||||
default-timeout=0
|
||||
|
@ -19,3 +19,6 @@ invisible=true
|
||||
|
||||
[mode=do-not-disturb app-name=notify-send]
|
||||
invisible=false
|
||||
|
||||
[urgency=critical]
|
||||
default-timeout=0
|
||||
|
@ -19,3 +19,6 @@ invisible=true
|
||||
|
||||
[mode=do-not-disturb app-name=notify-send]
|
||||
invisible=false
|
||||
|
||||
[urgency=critical]
|
||||
default-timeout=0
|
||||
|
@ -19,3 +19,6 @@ invisible=true
|
||||
|
||||
[mode=do-not-disturb app-name=notify-send]
|
||||
invisible=false
|
||||
|
||||
[urgency=critical]
|
||||
default-timeout=0
|
||||
|
Loading…
x
Reference in New Issue
Block a user