Tons of tweaks to reach working v1
This commit is contained in:
1 parent
e1429b743b
commit
c089a3b6f7
3 files changed
+211
-79
No files matched your search
@@ -0,0 +1,103 @@
|
||||
#!/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" \
|
||||
/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
|
||||
# Initialize and populate the keyring
|
||||
# Always reinitialize to ensure it's properly set up
|
||||
echo "Initializing pacman keyring..."
|
||||
pacman-key --init
|
||||
pacman-key --populate archlinux
|
||||
|
||||
# Sync the offline database so pacman can find packages
|
||||
echo "Syncing offline package database..."
|
||||
pacman -Sy --noconfirm
|
||||
|
||||
# Configurator for user information, disk selection, and wifi configuration
|
||||
NETWORK_NOT_NEEDED=true ./configurator
|
||||
|
||||
# Get username from installer config for reliable error recovery
|
||||
OMARCHY_USER="$(jq -r '.users[0].username' user_credentials.json)"
|
||||
|
||||
# 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
|
||||
|
||||
# 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/
|
||||
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
|
||||
|
||||
# Run Omarchy installer directly (skip boot.sh since it would try to clone again)
|
||||
# boot.sh just clones the repo and runs install.sh, but we already have the repo
|
||||
chroot_bash -lc "source /home/$OMARCHY_USER/.local/share/omarchy/install.sh || bash"
|
||||
fi
|
||||
Reference in new issue
Block a user