54 lines
1.6 KiB
Bash
54 lines
1.6 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
chroot_bash() {
|
|
HOME=/home/$OMARCHY_USER \
|
|
arch-chroot -u $OMARCHY_USER /mnt/ \
|
|
env 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 installation failed!\e[0m"
|
|
echo "The failing command was: \`$BASH_COMMAND\` (exit code: $?)"
|
|
echo "Get help from the community: https://discord.gg/tXFUdasqhY"
|
|
|
|
if [[ -n $OMARCHY_USER ]]; then
|
|
echo "You can retry by running: bash ~/.local/share/omarchy/install.sh"
|
|
chroot_bash
|
|
else
|
|
echo "You can retry by running: ./configurator"
|
|
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)"
|
|
|
|
# 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
|
|
chroot_bash -lc "wget -qO- https://omarchy.org/install-dev | bash"
|
|
fi
|