Make it easier to restart the installation process

This commit is contained in:
David Heinemeier Hansson committed 2025-08-28 08:40:18 +02:00
1 parent 58c5c3d820
commit 8ad8c948f7
1 file changed
+28 -24
+28 -24
View File
@@ -1,6 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail
run_install() {
# 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 "curl -fsSL https://omarchy.org/install | bash || bash"
}
chroot_bash() {
HOME=/home/$OMARCHY_USER \
arch-chroot -u $OMARCHY_USER /mnt/ \
@@ -38,7 +64,7 @@ catch_errors() {
echo " "
if [[ -z ${OMARCHY_USER-} ]]; then
echo "You must reboot and start over to try again"
echo "You can retry by running: run_install"
else
echo "You can retry by running: bash ~/.local/share/omarchy/install.sh || bash"
chroot_bash
@@ -48,27 +74,5 @@ catch_errors() {
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 "curl -fsSL https://omarchy.org/install | bash || bash"
run_install
fi