#!/usr/bin/env bash
# Run by the live session's Hyprland (/etc/bluerune-live/hyprland.lua): BlueRune's installer
# app, full screen, as root (it partitions disks) on the live user's Wayland display. How it
# ended goes to $XDG_RUNTIME_DIR/bluerune-installer.status for bluerune-live-shell, which
# opens the text installer when it failed; then Hyprland ends.

sudo --preserve-env=WAYLAND_DISPLAY,XDG_RUNTIME_DIR,HYPRLAND_INSTANCE_SIGNATURE,BLUERUNE_MEDIA,BLUERUNE_LOG \
    bluerune-installer --fullscreen
printf '%s\n' "$?" >"$XDG_RUNTIME_DIR/bluerune-installer.status"
hyprctl dispatch 'hl.dsp.exit()' >/dev/null
