Install without encryption (#79)
* Configurator tester * Make it a dry run * Offer a no-encryption install mode * Fix SDDM login * Simplify the flow by using ctrl-c to toggle into unencrypted mode
This commit is contained in:
1 parent
7b42d8011e
commit
01f393f10d
3 files changed
+133
-19
No files matched your search
@@ -35,6 +35,8 @@ install_omarchy() {
|
||||
chroot_bash -lc "sudo pacman -S --noconfirm --needed gum" >/dev/null
|
||||
chroot_bash -lc "source /home/$OMARCHY_USER/.local/share/omarchy/install.sh || bash"
|
||||
|
||||
configure_login_for_unencrypted_install
|
||||
|
||||
# Reboot if requested by installer
|
||||
if [[ -f /mnt/var/tmp/omarchy-install-completed ]]; then
|
||||
reboot
|
||||
@@ -138,6 +140,40 @@ EOF
|
||||
chmod +x /mnt/home/$OMARCHY_USER/.local/share/omarchy/default/waybar/indicators/notification-silencing.sh 2>/dev/null || true
|
||||
}
|
||||
|
||||
configure_login_for_unencrypted_install() {
|
||||
if [[ $(<user_encrypt_installation.txt) != "false" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Unencrypted installs must stop at SDDM so the user password is entered
|
||||
# before reaching the desktop. Omarchy's normal encrypted path may autologin
|
||||
# because the disk password was already entered at boot.
|
||||
#
|
||||
# Keep the Omarchy SDDM theme and seed SDDM's last user/session state so
|
||||
# first boot looks like the SDDM screen shown after logging out of Omarchy.
|
||||
mkdir -p /mnt/etc/sddm.conf.d
|
||||
rm -f /mnt/etc/sddm.conf.d/autologin.conf
|
||||
cat >/mnt/etc/sddm.conf.d/99-omarchy-login.conf <<EOF
|
||||
[Theme]
|
||||
Current=omarchy
|
||||
|
||||
[Users]
|
||||
RememberLastUser=true
|
||||
RememberLastSession=true
|
||||
EOF
|
||||
|
||||
mkdir -p /mnt/var/lib/sddm
|
||||
cat >/mnt/var/lib/sddm/state.conf <<EOF
|
||||
[Last]
|
||||
Session=omarchy.desktop
|
||||
User=$OMARCHY_USER
|
||||
EOF
|
||||
|
||||
rm -f /mnt/etc/systemd/system/getty@tty1.service.d/autologin.conf
|
||||
arch-chroot /mnt chown sddm:sddm /var/lib/sddm /var/lib/sddm/state.conf >/dev/null 2>&1 || true
|
||||
arch-chroot /mnt systemctl enable sddm.service >/dev/null 2>&1 || true
|
||||
}
|
||||
|
||||
chroot_bash() {
|
||||
HOME=/home/$OMARCHY_USER \
|
||||
arch-chroot -u $OMARCHY_USER /mnt/ \
|
||||
|
||||
@@ -108,7 +108,7 @@ user_form() {
|
||||
done
|
||||
|
||||
while true; do
|
||||
password=$(gum input --placeholder "Used for user + root + encryption" --prompt.foreground="#845DF9" --password --prompt "Password> ") || abort
|
||||
password=$(gum input --placeholder "Used for user + root, and disk encryption when enabled" --prompt.foreground="#845DF9" --password --prompt "Password> ") || abort
|
||||
password_confirmation=$(gum input --placeholder "Must match the password you just typed" --prompt.foreground="#845DF9" --password --prompt "Confirm> ") || abort
|
||||
|
||||
if [[ -n "$password" && "$password" == "$password_confirmation" ]]; then
|
||||
@@ -266,15 +266,46 @@ disk_form() {
|
||||
|
||||
disk_form
|
||||
|
||||
while true; do
|
||||
gum style "Everything will be overwritten. There is no recovery possible."
|
||||
confirm_disk_overwrite() {
|
||||
local mode="encrypted"
|
||||
local affirmative confirm_status
|
||||
|
||||
echo
|
||||
if gum confirm --affirmative "Yes, format disk" --negative "No, change it" "Confirm overwriting ${disk}"; then
|
||||
break
|
||||
else
|
||||
disk_form
|
||||
fi
|
||||
while true; do
|
||||
clear_logo
|
||||
echo
|
||||
gum style "Everything will be overwritten. There is no recovery possible."
|
||||
|
||||
if [[ $mode == "encrypted" ]]; then
|
||||
gum style --foreground 8 "Press Ctrl+C for unencrypted install."
|
||||
affirmative="Yes, install"
|
||||
else
|
||||
affirmative="Yes, install without encryption"
|
||||
fi
|
||||
|
||||
echo
|
||||
gum confirm --affirmative "$affirmative" --negative "No, change it" "Confirm overwriting ${disk}"
|
||||
confirm_status=$?
|
||||
|
||||
case $confirm_status in
|
||||
0)
|
||||
[[ $mode == "encrypted" ]] && encrypt_installation=true || encrypt_installation=false
|
||||
return 0
|
||||
;;
|
||||
1)
|
||||
return 1
|
||||
;;
|
||||
130)
|
||||
[[ $mode == "encrypted" ]] && mode="unencrypted" || mode="encrypted"
|
||||
;;
|
||||
*)
|
||||
abort
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
while ! confirm_disk_overwrite; do
|
||||
disk_form
|
||||
done
|
||||
|
||||
clear
|
||||
@@ -289,9 +320,15 @@ password_escaped=$(echo -n "$password" | jq -Rsa)
|
||||
password_hash_escaped=$(echo -n "$password_hash" | jq -Rsa)
|
||||
username_escaped=$(echo -n "$username" | jq -Rsa)
|
||||
|
||||
if [[ $encrypt_installation == true ]]; then
|
||||
credentials_encryption_line=" \"encryption_password\": $password_escaped,"
|
||||
else
|
||||
credentials_encryption_line=""
|
||||
fi
|
||||
|
||||
cat <<-_EOF_ >user_credentials.json
|
||||
{
|
||||
"encryption_password": $password_escaped,
|
||||
$credentials_encryption_line
|
||||
"root_enc_password": $password_hash_escaped,
|
||||
"users": [
|
||||
{
|
||||
@@ -304,6 +341,8 @@ cat <<-_EOF_ >user_credentials.json
|
||||
}
|
||||
_EOF_
|
||||
|
||||
printf '%s\n' "$encrypt_installation" >user_encrypt_installation.txt
|
||||
|
||||
# Setup partition layout
|
||||
disk_size=$(lsblk -bdno SIZE "$disk")
|
||||
mib=$((1024 * 1024))
|
||||
@@ -324,6 +363,22 @@ else
|
||||
kernel_choice="linux"
|
||||
fi
|
||||
|
||||
if [[ $encrypt_installation == true ]]; then
|
||||
disk_encryption_config=$(cat <<-_EOF_
|
||||
,
|
||||
"disk_encryption": {
|
||||
"encryption_type": "luks",
|
||||
"lvm_volumes": [],
|
||||
"iter_time": 2000,
|
||||
"partitions": [ "8c2c2b92-1070-455d-b76a-56263bab24aa" ],
|
||||
"encryption_password": $password_escaped
|
||||
}
|
||||
_EOF_
|
||||
)
|
||||
else
|
||||
disk_encryption_config=""
|
||||
fi
|
||||
|
||||
cat <<-_EOF_ >user_configuration.json
|
||||
{
|
||||
"app_config": null,
|
||||
@@ -393,14 +448,7 @@ cat <<-_EOF_ >user_configuration.json
|
||||
],
|
||||
"wipe": true
|
||||
}
|
||||
],
|
||||
"disk_encryption": {
|
||||
"encryption_type": "luks",
|
||||
"lvm_volumes": [],
|
||||
"iter_time": 2000,
|
||||
"partitions": [ "8c2c2b92-1070-455d-b76a-56263bab24aa" ],
|
||||
"encryption_password": $password_escaped
|
||||
}
|
||||
]$disk_encryption_config
|
||||
},
|
||||
"hostname": "$hostname",
|
||||
"kernels": [ "$kernel_choice" ],
|
||||
@@ -453,5 +501,8 @@ if [[ $1 == "dry" ]]; then
|
||||
echo -e "\nUser Email Address:"
|
||||
cat user_email_address.txt
|
||||
|
||||
rm user_configuration.json user_credentials.json user_full_name.txt user_email_address.txt
|
||||
echo -e "\nDisk Encryption:"
|
||||
cat user_encrypt_installation.txt
|
||||
|
||||
rm user_configuration.json user_credentials.json user_full_name.txt user_email_address.txt user_encrypt_installation.txt
|
||||
fi
|
||||
Reference in new issue
Block a user