2023-07-12 18:26:11 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
# written by Tobias Powalowski <tpowa@archlinux.org>
|
2023-07-17 08:34:15 +02:00
|
|
|
. /usr/lib/archboot/basic-common.sh
|
2023-07-17 08:43:20 +02:00
|
|
|
_TITLE="Archboot ${_RUNNING_ARCH} | Basic Setup | Launcher"
|
2023-07-12 18:26:11 +02:00
|
|
|
|
2023-07-14 07:46:24 +02:00
|
|
|
_check_desktop() {
|
|
|
|
_DESKTOP=()
|
|
|
|
update | grep -q Gnome && _DESKTOP+=( "GNOME" "Simple Beautiful Elegant" )
|
|
|
|
update | grep -q KDE && _DESKTOP+=( "PLASMA" "Simple By Default" )
|
|
|
|
update | grep -q Sway && _DESKTOP+=( "SWAY" "Tiling Wayland Compositor" )
|
|
|
|
update | grep -q Xfce && _DESKTOP+=( "XFCE" "Leightweight Desktop" )
|
|
|
|
}
|
|
|
|
|
|
|
|
_check_manage() {
|
|
|
|
_MANAGE=()
|
|
|
|
update | grep -q full && _MANAGE+=( "FULL" "Switch To Full Arch Linux System" )
|
2023-07-20 10:21:59 +02:00
|
|
|
update | grep -q 'latest archboot' && _MANAGE+=( "UPDATE" "Update Archboot Environment" )
|
|
|
|
update | grep -q image && _MANAGE+=( "IMAGE" "Create Archboot Images" )
|
2023-07-14 07:46:24 +02:00
|
|
|
}
|
|
|
|
|
2023-07-14 08:13:04 +02:00
|
|
|
_desktop () {
|
2023-07-15 23:32:16 +02:00
|
|
|
_dialog --cancel-label "Back" --title " Desktop Menu " --menu "" 10 40 6 "${_DESKTOP[@]}" 2>${_ANSWER} || return 1
|
2023-07-18 08:29:07 +02:00
|
|
|
[[ -e /.launcher-running ]] && rm /.launcher-running
|
2023-07-14 08:13:04 +02:00
|
|
|
_EXIT="$(cat ${_ANSWER})"
|
2023-07-19 22:09:27 +02:00
|
|
|
source /etc/locale.conf
|
2023-07-14 08:13:04 +02:00
|
|
|
if [[ "${_EXIT}" == "GNOME" ]]; then
|
|
|
|
if _dialog --defaultno --yesno "Gnome Desktop:\nDo you want to use the Wayland Backend?" 6 45; then
|
|
|
|
clear
|
|
|
|
update -gnome-wayland
|
|
|
|
else
|
|
|
|
clear
|
|
|
|
update -gnome
|
|
|
|
fi
|
|
|
|
elif [[ "${_EXIT}" == "PLASMA" ]]; then
|
|
|
|
if _dialog --defaultno --yesno "KDE/Plasma Desktop:\nDo you want to use the Wayland Backend?" 6 45; then
|
|
|
|
clear
|
|
|
|
update -plasma-wayland
|
|
|
|
else
|
|
|
|
clear
|
|
|
|
update -plasma
|
|
|
|
fi
|
|
|
|
elif [[ "${_EXIT}" == "SWAY" ]]; then
|
|
|
|
clear
|
|
|
|
update -sway
|
|
|
|
elif [[ "${_EXIT}" == "XFCE" ]]; then
|
|
|
|
clear
|
|
|
|
update -xfce
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
_manage() {
|
2023-07-15 23:32:16 +02:00
|
|
|
_dialog --cancel-label "Back" --title " Manage Archboot Menu " --menu "" 9 50 5 "${_MANAGE[@]}" 2>${_ANSWER} || return 1
|
2023-07-14 08:13:04 +02:00
|
|
|
clear
|
2023-07-18 08:29:07 +02:00
|
|
|
[[ -e /.launcher-running ]] && rm /.launcher-running
|
2023-07-14 08:13:04 +02:00
|
|
|
_EXIT="$(cat ${_ANSWER})"
|
|
|
|
if [[ "${_EXIT}" == "FULL" ]]; then
|
2023-07-19 10:36:14 +02:00
|
|
|
_show_coffee
|
2023-07-14 08:13:04 +02:00
|
|
|
update -full-system
|
|
|
|
elif [[ "${_EXIT}" == "UPDATE" ]]; then
|
2023-07-18 07:32:48 +02:00
|
|
|
_run_update_environment
|
2023-07-14 08:13:04 +02:00
|
|
|
elif [[ "${_EXIT}" == "IMAGE" ]]; then
|
2023-07-19 10:36:14 +02:00
|
|
|
_show_coffee
|
2023-07-14 08:13:04 +02:00
|
|
|
update -latest-image
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
_exit() {
|
|
|
|
#shellcheck disable=SC2086
|
2023-07-15 08:44:56 +02:00
|
|
|
_dialog --cancel-label "Back" --title " Exit Menu " --menu "" 9 30 5 \
|
2023-07-14 08:13:04 +02:00
|
|
|
"1" "Exit Program" \
|
|
|
|
"2" "Reboot System" \
|
2023-07-14 17:43:37 +02:00
|
|
|
"3" "Poweroff System" 2>${_ANSWER} || return 1
|
|
|
|
_EXIT="$(cat ${_ANSWER})"
|
2023-07-14 08:13:04 +02:00
|
|
|
if [[ "${_EXIT}" == "1" ]]; then
|
2023-07-18 08:29:07 +02:00
|
|
|
[[ -e /.launcher-running ]] && rm /.launcher-running
|
2023-07-14 08:17:40 +02:00
|
|
|
_show_login
|
2023-07-14 17:44:51 +02:00
|
|
|
exit 0
|
2023-07-14 08:13:04 +02:00
|
|
|
elif [[ "${_EXIT}" == "2" ]]; then
|
|
|
|
_dialog --infobox "Rebooting in 10 seconds...\nDon't forget to remove the boot medium!" 4 50
|
|
|
|
sleep 10
|
|
|
|
clear
|
2023-07-27 09:03:22 +02:00
|
|
|
echo -e "\e[1mRebooting the system...\e[m" | wall -n
|
2023-07-27 08:55:57 +02:00
|
|
|
sleep 3
|
2023-07-14 08:13:04 +02:00
|
|
|
reboot
|
|
|
|
elif [[ "${_EXIT}" == "3" ]]; then
|
|
|
|
_dialog --infobox "Powering off in 10 seconds...\nDon't forget to remove the boot medium!" 4 50
|
|
|
|
sleep 10
|
|
|
|
clear
|
2023-07-27 09:03:22 +02:00
|
|
|
echo -e "\e[1mPowering off the system...\e[m" | wall -n
|
2023-07-27 08:55:57 +02:00
|
|
|
sleep 3
|
2023-07-14 08:13:04 +02:00
|
|
|
poweroff
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_launcher() {
|
2023-07-14 07:46:24 +02:00
|
|
|
_MENU=()
|
|
|
|
if [[ -n "${_DESKTOP[@]}" ]]; then
|
|
|
|
_MENU+=( "2" "Launch Desktop Environment" )
|
|
|
|
fi
|
|
|
|
if [[ -n "${_MANAGE[@]}" ]]; then
|
|
|
|
_MENU+=( "3" "Manage Archboot Environment" )
|
|
|
|
fi
|
2023-07-19 10:27:36 +02:00
|
|
|
_dialog --default-item "${_DEFAULTITEM}" --cancel-label "Exit" --title " Main Menu " --menu "" 9 40 5 \
|
2023-07-15 08:43:46 +02:00
|
|
|
"1" "Launch Archboot Setup" "${_MENU[@]}" 2>${_ANSWER}
|
2023-07-12 18:26:11 +02:00
|
|
|
case $(cat ${_ANSWER}) in
|
|
|
|
"1")
|
2023-07-18 08:29:07 +02:00
|
|
|
[[ -e /.launcher-running ]] && rm /.launcher-running
|
2023-07-12 18:26:11 +02:00
|
|
|
setup
|
|
|
|
exit 0 ;;
|
|
|
|
"2")
|
2023-07-19 10:26:06 +02:00
|
|
|
_DEFAULTITEM=2
|
2023-07-19 10:28:27 +02:00
|
|
|
_desktop
|
2023-07-12 18:26:11 +02:00
|
|
|
;;
|
|
|
|
"3")
|
2023-07-19 10:26:06 +02:00
|
|
|
_DEFAULTITEM=3
|
2023-07-19 10:28:27 +02:00
|
|
|
_manage
|
2023-07-13 07:30:46 +02:00
|
|
|
;;
|
2023-07-12 18:26:11 +02:00
|
|
|
*)
|
2023-07-15 08:43:46 +02:00
|
|
|
_exit
|
2023-07-12 18:26:11 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2023-07-17 08:34:15 +02:00
|
|
|
_check
|
2023-07-19 10:30:29 +02:00
|
|
|
_DEFAULTITEM=1
|
2023-07-14 17:43:37 +02:00
|
|
|
while true; do
|
|
|
|
_check_desktop
|
|
|
|
_check_manage
|
|
|
|
_launcher
|
|
|
|
done
|
2023-07-12 18:26:11 +02:00
|
|
|
# vim: set ts=4 sw=4 et:
|