Cleanup
This commit is contained in:
1 parent
657011cc20
commit
03cab0e23e
2 files changed
-227
No files matched your search
@@ -1,149 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Set Tokyo Night color scheme for the terminal
|
||||
set_tokyo_night_colors() {
|
||||
if [[ $(tty) == "/dev/tty"* ]]; then
|
||||
# Tokyo Night color palette
|
||||
echo -en "\e]P01a1b26" # black (background)
|
||||
echo -en "\e]P1f7768e" # red
|
||||
echo -en "\e]P29ece6a" # green
|
||||
echo -en "\e]P3e0af68" # yellow
|
||||
echo -en "\e]P47aa2f7" # blue
|
||||
echo -en "\e]P5bb9af7" # magenta
|
||||
echo -en "\e]P67dcfff" # cyan
|
||||
echo -en "\e]P7a9b1d6" # white
|
||||
echo -en "\e]P8414868" # bright black
|
||||
echo -en "\e]P9f7768e" # bright red
|
||||
echo -en "\e]PA9ece6a" # bright green
|
||||
echo -en "\e]PBe0af68" # bright yellow
|
||||
echo -en "\e]PC7aa2f7" # bright blue
|
||||
echo -en "\e]PDbb9af7" # bright magenta
|
||||
echo -en "\e]PE7dcfff" # bright cyan
|
||||
echo -en "\e]PFc0caf5" # bright white (foreground)
|
||||
|
||||
# Set default foreground and background
|
||||
echo -en "\033[0m"
|
||||
clear
|
||||
fi
|
||||
}
|
||||
|
||||
run_configurator() {
|
||||
set -euo pipefail
|
||||
|
||||
# Configurator for user information, disk selection, and wifi configuration
|
||||
NETWORK_NOT_NEEDED=true ./configurator
|
||||
|
||||
# Get username from installer config for reliable error recovery
|
||||
export OMARCHY_USER="$(jq -r '.users[0].username' user_credentials.json)"
|
||||
}
|
||||
|
||||
install_base_system() {
|
||||
set -euo pipefail
|
||||
|
||||
# Initialize and populate the keyring
|
||||
pacman-key --init
|
||||
pacman-key --populate archlinux
|
||||
|
||||
# Sync the offline database so pacman can find packages
|
||||
pacman -Sy --noconfirm
|
||||
|
||||
# Install using files generated by the ./configurator
|
||||
# Skip NTP and WKD sync since we're offline (keyring is pre-populated in ISO)
|
||||
archinstall \
|
||||
--config user_configuration.json \
|
||||
--creds user_credentials.json \
|
||||
--silent \
|
||||
--skip-ntp \
|
||||
--skip-wkd
|
||||
|
||||
# After archinstall sets up the base system but before our installer runs,
|
||||
# we need to ensure the offline pacman.conf is in place
|
||||
cp /etc/pacman.conf /mnt/etc/pacman.conf
|
||||
|
||||
# Mount the offline mirror so it's accessible in the chroot
|
||||
mkdir -p /mnt/var/cache/omarchy/mirror/offline
|
||||
mount --bind /var/cache/omarchy/mirror/offline /mnt/var/cache/omarchy/mirror/offline
|
||||
|
||||
# Mount the ruby directory so it's accessible in the chroot
|
||||
mkdir -p /mnt/var/cache/omarchy/ruby
|
||||
mount --bind /var/cache/omarchy/ruby /mnt/var/cache/omarchy/ruby
|
||||
|
||||
# No need to ask for sudo during the installation (omarchy itself responsible for removing after install)
|
||||
mkdir -p /mnt/etc/sudoers.d
|
||||
cat >/mnt/etc/sudoers.d/99-omarchy-installer <<EOF
|
||||
root ALL=(ALL:ALL) NOPASSWD: ALL
|
||||
%wheel ALL=(ALL:ALL) NOPASSWD: ALL
|
||||
$OMARCHY_USER ALL=(ALL:ALL) NOPASSWD: ALL
|
||||
EOF
|
||||
chmod 440 /mnt/etc/sudoers.d/99-omarchy-installer
|
||||
|
||||
# Copy the local omarchy repo to the user's home directory
|
||||
mkdir -p /mnt/home/$OMARCHY_USER/.local/share/
|
||||
cp -r /root/omarchy /mnt/home/$OMARCHY_USER/.local/share/
|
||||
|
||||
# Copy icons to user's applications directory
|
||||
mkdir -p /mnt/home/$OMARCHY_USER/.local/share/applications/icons
|
||||
cp -r /root/.local/share/applications/icons/* /mnt/home/$OMARCHY_USER/.local/share/applications/icons/
|
||||
|
||||
# Copy the log upload utility to the installed system
|
||||
mkdir -p /mnt/usr/local/bin
|
||||
cp /usr/local/bin/omarchy-upload-install-log /mnt/usr/local/bin/
|
||||
chmod +x /mnt/usr/local/bin/omarchy-upload-install-log
|
||||
|
||||
chown -R 1000:1000 /mnt/home/$OMARCHY_USER/.local/
|
||||
# Ensure all scripts in bin directories are executable
|
||||
find /mnt/home/$OMARCHY_USER/.local/share/omarchy -type f -path "*/bin/*" -exec chmod +x {} \;
|
||||
# Ensure install.sh is executable
|
||||
chmod +x /mnt/home/$OMARCHY_USER/.local/share/omarchy/install.sh 2>/dev/null || true
|
||||
}
|
||||
|
||||
chroot_bash() {
|
||||
HOME=/home/$OMARCHY_USER \
|
||||
arch-chroot -u $OMARCHY_USER /mnt/ \
|
||||
env OMARCHY_CHROOT_INSTALL=1 \
|
||||
OMARCHY_OFFLINE_INSTALL=1 \
|
||||
OMARCHY_USER_NAME="$(<user_full_name.txt)" \
|
||||
OMARCHY_USER_EMAIL="$(<user_email_address.txt)" \
|
||||
USER="$OMARCHY_USER" \
|
||||
HOME="/home/$OMARCHY_USER" \
|
||||
/bin/bash "$@"
|
||||
}
|
||||
|
||||
if [[ $(tty) == "/dev/tty1" ]]; then
|
||||
# Set log file to pull from in trap
|
||||
export LOG_FILE="/var/log/omarchy-install.log"
|
||||
export OMARCHY_PATH="/root/omarchy"
|
||||
export OMARCHY_INSTALL="/root/omarchy/install"
|
||||
export OMARCHY_OFFLINE_INSTALL=1
|
||||
|
||||
source "$OMARCHY_INSTALL/helpers/size.sh"
|
||||
source "$OMARCHY_INSTALL/helpers/ansi-codes.sh"
|
||||
source "$OMARCHY_INSTALL/helpers/logo.sh"
|
||||
source "$OMARCHY_INSTALL/helpers/gum-styling.sh"
|
||||
source "$OMARCHY_INSTALL/helpers/tail-log-output.sh"
|
||||
source "$OMARCHY_INSTALL/preflight/trap-errors.sh"
|
||||
|
||||
set_tokyo_night_colors
|
||||
|
||||
run_configurator
|
||||
|
||||
clear_logo
|
||||
|
||||
gum style --foreground 3 --padding "1 0 0 $PADDING_LEFT" "Installing Omarchy..."
|
||||
|
||||
touch "$LOG_FILE"
|
||||
|
||||
start_log_output
|
||||
install_base_system 2>&1 | sed -u 's/\x1b\[[0-9;]*[a-zA-Z]//g' >>"$LOG_FILE"
|
||||
cleanup
|
||||
|
||||
# Get username from the config file after installation
|
||||
OMARCHY_USER="$(jq -r '.users[0].username' user_credentials.json)"
|
||||
|
||||
# Install gum early so we have it for formatting
|
||||
chroot_bash -lc "sudo pacman -S --noconfirm --needed gum" >/dev/null
|
||||
|
||||
# Run Omarchy installer directly (skip boot.sh since it would try to clone again)
|
||||
chroot_bash -lc "source /home/$OMARCHY_USER/.local/share/omarchy/install.sh || bash"
|
||||
fi
|
||||
@@ -1,78 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
chroot_bash() {
|
||||
HOME=/home/$OMARCHY_USER \
|
||||
arch-chroot -u $OMARCHY_USER /mnt/ \
|
||||
env OMARCHY_CHROOT_INSTALL=1 \
|
||||
OMARCHY_USER_NAME="$(<user_full_name.txt)" \
|
||||
OMARCHY_USER_EMAIL="$(<user_email_address.txt)" \
|
||||
USER="$OMARCHY_USER" \
|
||||
HOME="/home/$OMARCHY_USER" \
|
||||
OMARCHY_REPO="$(<omarchy_installer_repo.txt)" \
|
||||
OMARCHY_REF="$(<omarchy_installer_ref.txt)" \
|
||||
/bin/bash "$@"
|
||||
}
|
||||
|
||||
catch_errors() {
|
||||
echo -e "\n\e[31mOmarchy ISO installation failed!\e[0m"
|
||||
echo
|
||||
echo "This command halted with exit code $?:"
|
||||
echo "$BASH_COMMAND"
|
||||
echo
|
||||
echo "Get help from the community via QR code or at https://discord.gg/tXFUdasqhY"
|
||||
echo " "
|
||||
echo " █▀▀▀▀▀█ ▄ ▄ ▀▄▄▄█ █▀▀▀▀▀█ "
|
||||
echo " █ ███ █ ▄▄▄▄▀▄▀▄▀ █ ███ █ "
|
||||
echo " █ ▀▀▀ █ ▄█ ▄█▄▄▀ █ ▀▀▀ █ "
|
||||
echo " ▀▀▀▀▀▀▀ ▀▄█ █ █ █ ▀▀▀▀▀▀▀ "
|
||||
echo " ▀▀█▀▀▄▀▀▀▀▄█▀▀█ ▀ █ ▀ █ "
|
||||
echo " █▄█ ▄▄▀▄▄ ▀ ▄ ▀█▄▄▄▄ ▀ ▀█ "
|
||||
echo " ▄ ▄▀█ ▀▄▀▀▀▄ ▄█▀▄█▀▄▀▄▀█▀ "
|
||||
echo " █ ▄▄█▄▀▄█ ▄▄▄ ▀ ▄▀██▀ ▀█ "
|
||||
echo " ▀ ▀ ▀ █ ▀▄ ▀▀█▀▀▀█▄▀ "
|
||||
echo " █▀▀▀▀▀█ ▀█ ▄▀▀ █ ▀ █▄▀██ "
|
||||
echo " █ ███ █ █▀▄▄▀ █▀███▀█▄██▄ "
|
||||
echo " █ ▀▀▀ █ ██ ▀ █▄█ ▄▄▄█▀ █ "
|
||||
echo " ▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀ ▀ ▀▀▀▀▀▀ "
|
||||
echo " "
|
||||
|
||||
if [[ -z ${OMARCHY_USER-} ]]; then
|
||||
echo "You can retry by running: ~/.automated_script.sh"
|
||||
else
|
||||
echo "You can retry by running: bash ~/.local/share/omarchy/install.sh || bash"
|
||||
chroot_bash
|
||||
fi
|
||||
}
|
||||
|
||||
trap catch_errors ERR
|
||||
|
||||
if [[ $(tty) == "/dev/tty1" ]]; then
|
||||
# Configurator for user information, disk selection, and wifi configuration
|
||||
./configurator
|
||||
|
||||
# Get username from installer config for reliable error recovery
|
||||
OMARCHY_USER="$(jq -r '.users[0].username' user_credentials.json)"
|
||||
|
||||
# Ensure that no mounts exist from past install attempts
|
||||
findmnt -R /mnt >/dev/null && umount -R /mnt
|
||||
|
||||
# Install using files generated by the ./configurator
|
||||
archinstall \
|
||||
--config user_configuration.json \
|
||||
--creds user_credentials.json \
|
||||
--silent
|
||||
|
||||
# No need to ask for sudo during the installation (omarchy itself responsible for removing after install)
|
||||
mkdir -p /mnt/etc/sudoers.d
|
||||
cat >/mnt/etc/sudoers.d/99-omarchy-installer <<EOF
|
||||
root ALL=(ALL:ALL) NOPASSWD: ALL
|
||||
%wheel ALL=(ALL:ALL) NOPASSWD: ALL
|
||||
$OMARCHY_USER ALL=(ALL:ALL) NOPASSWD: ALL
|
||||
EOF
|
||||
chmod 440 /mnt/etc/sudoers.d/99-omarchy-installer
|
||||
|
||||
# Run Omarchy web installer
|
||||
OMARCHY_INSTALL_URL=$(cat omarchy_installer_url.txt 2>/dev/null || echo "https://omarchy.org/install")
|
||||
chroot_bash -lc "curl -fsSL $OMARCHY_INSTALL_URL | bash || bash"
|
||||
fi
|
||||
Reference in new issue
Block a user