installer: route install through system and user phases
This commit is contained in:
+27
-12
@@ -5,26 +5,41 @@
|
||||
|
||||
set -e
|
||||
|
||||
# Run user-level setup FIRST so its outcome (→ branding files, AI skill
|
||||
# symlinks, xdg dirs, etc.) isn't held hostage to whether one of the
|
||||
# privileged first-run steps below aborts under set -e. omarchy-setup-user
|
||||
# is idempotent and gated on its own marker.
|
||||
# Always: refresh per-user defaults (skel-derived configs, AI skills, XDG
|
||||
# dirs, branding, MIME defaults, etc.). Idempotent via its own marker.
|
||||
omarchy-setup-user || true
|
||||
|
||||
FIRST_RUN_MODE=~/.local/state/omarchy/first-run.mode
|
||||
# Online installs grant a one-time passwordless reboot from the installer.
|
||||
# Clean it up after first login without prompting future users for sudo.
|
||||
bash "$OMARCHY_PATH/install/first-run/cleanup-reboot-sudoers.sh"
|
||||
|
||||
if [[ -f $FIRST_RUN_MODE ]]; then
|
||||
rm -f "$FIRST_RUN_MODE"
|
||||
state_dir=~/.local/state/omarchy
|
||||
mkdir -p "$state_dir"
|
||||
|
||||
# System-wide one-shot. Gated on first-run.mode (created by finalize.sh during
|
||||
# ISO installs). The install user is the only one whose /etc/sudoers.d/first-run
|
||||
# shim grants the passwordless commands these scripts need, so only that user
|
||||
# clears this marker.
|
||||
SYSTEM_MARKER="$state_dir/first-run.mode"
|
||||
if [[ -f $SYSTEM_MARKER ]]; then
|
||||
rm -f "$SYSTEM_MARKER"
|
||||
|
||||
bash "$OMARCHY_PATH/install/first-run/recover-internal-monitor.sh"
|
||||
bash "$OMARCHY_PATH/install/first-run/cleanup-reboot-sudoers.sh"
|
||||
bash "$OMARCHY_PATH/install/first-run/firewall.sh"
|
||||
bash "$OMARCHY_PATH/install/first-run/dns-resolver.sh"
|
||||
bash "$OMARCHY_PATH/install/first-run/gnome-theme.sh"
|
||||
bash "$OMARCHY_PATH/install/first-run/gtk-primary-paste.sh"
|
||||
bash "$OMARCHY_PATH/install/first-run/gnome-theme-system.sh"
|
||||
omarchy-hook-install post-update "$OMARCHY_PATH/install/first-run/install-voxtype.hook"
|
||||
sudo /bin/rm -f /etc/sudoers.d/first-run
|
||||
sudo rm -f /etc/sudoers.d/first-run
|
||||
fi
|
||||
|
||||
# Per-user one-shot. Runs on the first login for every user, including any
|
||||
# users created after install. Touches only $HOME / user dbus, no sudo.
|
||||
USER_MARKER="$state_dir/first-run-user.done"
|
||||
if [[ ! -f $USER_MARKER ]]; then
|
||||
bash "$OMARCHY_PATH/install/first-run/recover-internal-monitor.sh"
|
||||
bash "$OMARCHY_PATH/install/first-run/gnome-theme-user.sh"
|
||||
bash "$OMARCHY_PATH/install/first-run/gtk-primary-paste.sh"
|
||||
bash "$OMARCHY_PATH/install/first-run/welcome.sh"
|
||||
bash "$OMARCHY_PATH/install/first-run/wifi.sh"
|
||||
|
||||
touch "$USER_MARKER"
|
||||
fi
|
||||
|
||||
+5
-1
@@ -6,7 +6,11 @@
|
||||
# omarchy:requires-sudo=true
|
||||
|
||||
if omarchy-pkg-missing "$@"; then
|
||||
sudo pacman -S --noconfirm --needed "$@" || exit 1
|
||||
if (( EUID == 0 )); then
|
||||
pacman -S --noconfirm --needed "$@" || exit 1
|
||||
else
|
||||
sudo pacman -S --noconfirm --needed "$@" || exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
for pkg in "$@"; do
|
||||
|
||||
@@ -9,5 +9,23 @@ omarchy-refresh-config hypr/input.lua
|
||||
omarchy-refresh-config hypr/looknfeel.lua
|
||||
omarchy-refresh-config hypr/hyprland.lua
|
||||
omarchy-refresh-config hypr/monitors.lua
|
||||
bash "$OMARCHY_PATH/install/config/omarchy-toggles.sh"
|
||||
bash "$OMARCHY_PATH/install/config/detect-keyboard-layout.sh"
|
||||
|
||||
mkdir -p ~/.local/state/omarchy/toggles/hypr
|
||||
cp "$OMARCHY_PATH/default/hypr/toggles/flags.lua" ~/.local/state/omarchy/toggles/hypr/
|
||||
|
||||
conf=/etc/vconsole.conf
|
||||
hyprlua="$HOME/.config/hypr/input.lua"
|
||||
if [[ -f $conf && -f $hyprlua ]]; then
|
||||
sed -i '/^[[:space:]]*kb_layout[[:space:]]*=/d' "$hyprlua"
|
||||
sed -i '/^[[:space:]]*kb_variant[[:space:]]*=/d' "$hyprlua"
|
||||
|
||||
if grep -q '^XKBLAYOUT=' "$conf"; then
|
||||
layout=$(grep '^XKBLAYOUT=' "$conf" | cut -d= -f2 | tr -d '"')
|
||||
sed -i "/^[[:space:]]*kb_options *=/i\ kb_layout = \"$layout\"," "$hyprlua"
|
||||
fi
|
||||
|
||||
if grep -q '^XKBVARIANT=' "$conf"; then
|
||||
variant=$(grep '^XKBVARIANT=' "$conf" | cut -d= -f2 | tr -d '"')
|
||||
sed -i "/^[[:space:]]*kb_options *=/i\ kb_variant = \"$variant\"," "$hyprlua"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -17,7 +17,11 @@ cp -R $OMARCHY_PATH/config/* ~/.config/
|
||||
cp $OMARCHY_PATH/default/bashrc ~/.bashrc
|
||||
echo '[[ -f ~/.bashrc ]] && . ~/.bashrc' | tee ~/.bash_profile >/dev/null
|
||||
|
||||
$(bash $OMARCHY_PATH/install/config/theme.sh)
|
||||
env OMARCHY_PATH="$OMARCHY_PATH" OMARCHY_INSTALL_MODE=online bash -c '
|
||||
source "$OMARCHY_PATH/install/helpers/mode.sh"
|
||||
detect_install_mode
|
||||
source "$OMARCHY_PATH/install/config/theme-user.sh"
|
||||
'
|
||||
|
||||
omarchy-refresh-limine
|
||||
omarchy-refresh-plymouth
|
||||
|
||||
+41
-5
@@ -1,12 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Set up Omarchy for the current user (~/.config, ~/.local, etc.)
|
||||
# omarchy:group=install
|
||||
# omarchy:group=setup
|
||||
# omarchy:examples=omarchy setup user | omarchy setup user --force
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
if (( EUID == 0 )); then
|
||||
echo "Error: run omarchy-setup-user as the user being configured, not as root." >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -38,7 +38,34 @@ if [[ -f $marker && $force -eq 0 ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
OMARCHY_PATH="${OMARCHY_PATH:-/usr/share/omarchy}"
|
||||
export OMARCHY_PATH="${OMARCHY_PATH:-/usr/share/omarchy}"
|
||||
export OMARCHY_INSTALL="${OMARCHY_INSTALL:-$OMARCHY_PATH/install}"
|
||||
export PATH="$OMARCHY_PATH/bin:$PATH"
|
||||
|
||||
if [[ -f $OMARCHY_INSTALL/helpers/mode.sh ]]; then
|
||||
source "$OMARCHY_INSTALL/helpers/mode.sh"
|
||||
detect_install_mode
|
||||
export_legacy_mode_flags
|
||||
else
|
||||
install_mode_is() { [[ ${OMARCHY_INSTALL_MODE:-online} == "$1" ]]; }
|
||||
export -f install_mode_is
|
||||
fi
|
||||
|
||||
if [[ -n ${OMARCHY_INSTALL_LOG_FILE:-} && -f $OMARCHY_INSTALL/helpers/logging.sh ]]; then
|
||||
source "$OMARCHY_INSTALL/helpers/logging.sh"
|
||||
else
|
||||
run_logged() {
|
||||
local script="$1"
|
||||
bash -eE -c 'source "$1"' bash "$script"
|
||||
}
|
||||
fi
|
||||
|
||||
# Copy over Omarchy configs for this user. /etc/skel handles newly-created
|
||||
# users, but existing users installing Omarchy need the same defaults seeded.
|
||||
mkdir -p ~/.config
|
||||
cp -R "$OMARCHY_PATH/config/." ~/.config/
|
||||
cp "$OMARCHY_PATH/default/bashrc" ~/.bashrc
|
||||
echo '[[ -f ~/.bashrc ]] && . ~/.bashrc' > ~/.bash_profile
|
||||
|
||||
# AI assistant skill symlinks. Each agent has its own conventional skills
|
||||
# directory; we drop an 'omarchy' entry into each so the skill is loaded.
|
||||
@@ -72,13 +99,17 @@ xdg-user-dirs-update --set DESKTOP "$HOME"
|
||||
rmdir ~/Templates ~/Public ~/Desktop 2>/dev/null || true
|
||||
touch ~/.config/gtk-3.0/bookmarks
|
||||
for dir in Downloads Projects Pictures Videos; do
|
||||
printf 'file://%s/%s %s\n' "$HOME" "$dir" "$dir" >>~/.config/gtk-3.0/bookmarks
|
||||
bookmark="file://$HOME/$dir $dir"
|
||||
grep -qxF "$bookmark" ~/.config/gtk-3.0/bookmarks || echo "$bookmark" >>~/.config/gtk-3.0/bookmarks
|
||||
done
|
||||
|
||||
# Hyprland keyboard layout from /etc/vconsole.conf
|
||||
conf=/etc/vconsole.conf
|
||||
hyprlua="$HOME/.config/hypr/input.lua"
|
||||
if [[ -f $conf && -f $hyprlua ]]; then
|
||||
sed -i '/^[[:space:]]*kb_layout[[:space:]]*=/d' "$hyprlua"
|
||||
sed -i '/^[[:space:]]*kb_variant[[:space:]]*=/d' "$hyprlua"
|
||||
|
||||
if grep -q '^XKBLAYOUT=' "$conf"; then
|
||||
layout=$(grep '^XKBLAYOUT=' "$conf" | cut -d= -f2 | tr -d '"')
|
||||
sed -i "/^[[:space:]]*kb_options *=/i\ kb_layout = \"$layout\"," "$hyprlua"
|
||||
@@ -89,7 +120,12 @@ if [[ -f $conf && -f $hyprlua ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Application catalog + MIME defaults
|
||||
# Reusable per-user install phase: theme, shell/user services, default keyring,
|
||||
# hardware-specific user session fixes, and other current-user setup.
|
||||
source "$OMARCHY_INSTALL/user/all.sh"
|
||||
|
||||
# Application catalog + MIME defaults. Run after mise/node setup from user/all
|
||||
# so npm-backed wrappers can be installed for each user.
|
||||
omarchy-refresh-applications
|
||||
xdg-settings set default-web-browser chromium.desktop
|
||||
xdg-mime default HEY.desktop x-scheme-handler/mailto
|
||||
|
||||
Reference in New Issue
Block a user