2023-07-12 18:26:11 +02:00
|
|
|
#!/usr/bin/env bash
|
2023-08-11 17:19:18 +02:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2023-07-12 18:26:11 +02:00
|
|
|
# written by Tobias Powalowski <tpowa@archlinux.org>
|
2023-09-03 22:02:48 +02:00
|
|
|
. /usr/lib/archboot/common.sh
|
2024-03-20 16:48:05 +01:00
|
|
|
_TITLE="archboot.com | ${_RUNNING_ARCH} | ${_RUNNING_KERNEL} | Basic Setup | Launcher"
|
2023-07-12 18:26:11 +02:00
|
|
|
|
2023-07-14 07:46:24 +02:00
|
|
|
_check_desktop() {
|
|
|
|
_DESKTOP=()
|
2024-06-26 20:26:51 +02:00
|
|
|
update | rg -q 'Gnome' && _DESKTOP+=( "gnome" "Simple Beautiful Elegant" )
|
|
|
|
update | rg -q 'KDE' && _DESKTOP+=( "plasma" "Simple By Default" )
|
|
|
|
update | rg -q 'Sway' && _DESKTOP+=( "sway" "Tiling Wayland Compositor" )
|
|
|
|
update | rg -q 'Xfce' && _DESKTOP+=( "xfce" "Leightweight Desktop" )
|
2023-07-14 07:46:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
_check_manage() {
|
|
|
|
_MANAGE=()
|
2024-06-26 20:26:51 +02:00
|
|
|
update | rg -q 'full' && _MANAGE+=( "FULL" "Switch To Full Arch Linux System" )
|
|
|
|
update | rg -q 'latest archboot' && _MANAGE+=( "UPDATE" "Update Archboot Environment" )
|
|
|
|
update | rg -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-09-06 09:09:26 +02:00
|
|
|
_dialog --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-08-04 16:07:03 +02:00
|
|
|
_EXIT=$(cat "${_ANSWER}")
|
2024-06-15 18:08:32 +02:00
|
|
|
#shellcheck disable=SC2086
|
2024-06-15 18:27:08 +02:00
|
|
|
_dialog --title " Internet Browser " --menu "" 8 40 4 \
|
|
|
|
"chromium" "Browser From Google" \
|
2024-06-15 18:28:37 +02:00
|
|
|
"firefox" "Browser From Mozilla" 2>${_ANSWER} || return 1
|
2024-07-10 21:40:20 +02:00
|
|
|
_BROWSER=$(cat "${_ANSWER}")
|
2024-06-27 07:36:04 +02:00
|
|
|
sd "STANDARD_BROWSER=.*" "STANDARD_BROWSER=${_BROWSER}" /etc/archboot/defaults
|
2023-07-19 22:09:27 +02:00
|
|
|
source /etc/locale.conf
|
2024-06-15 18:33:08 +02:00
|
|
|
clear
|
2024-07-10 21:40:20 +02:00
|
|
|
update -"${_EXIT}" || exit 1
|
2023-07-14 08:13:04 +02:00
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
_manage() {
|
2023-09-06 09:09:26 +02:00
|
|
|
_dialog --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-08-04 16:07:03 +02:00
|
|
|
_EXIT=$(cat "${_ANSWER}")
|
2023-07-14 08:13:04 +02:00
|
|
|
if [[ "${_EXIT}" == "FULL" ]]; then
|
|
|
|
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
|
|
|
|
update -latest-image
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
_exit() {
|
|
|
|
#shellcheck disable=SC2086
|
2023-09-06 09:09:26 +02:00
|
|
|
_dialog --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
|
2023-08-04 16:07:03 +02:00
|
|
|
_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
|
2023-09-04 09:33:55 +02:00
|
|
|
_COUNT=0
|
2023-08-04 19:59:19 +02:00
|
|
|
while true; do
|
|
|
|
sleep 1
|
|
|
|
_COUNT=$((_COUNT+1))
|
|
|
|
# abort after 10 seconds
|
2023-08-04 20:18:58 +02:00
|
|
|
_progress "$((_COUNT*10))" "Rebooting in $((10-_COUNT)) second(s). Don't forget to remove the boot medium!"
|
2023-08-04 19:59:19 +02:00
|
|
|
[[ "${_COUNT}" == 10 ]] && break
|
2023-08-04 20:04:37 +02:00
|
|
|
done | _dialog --title " System Reboot " --no-mouse --gauge "Rebooting in 10 seconds. Don't forget to remove the boot medium!" 6 75 0
|
2023-07-14 08:13:04 +02:00
|
|
|
reboot
|
|
|
|
elif [[ "${_EXIT}" == "3" ]]; then
|
2023-09-04 09:33:55 +02:00
|
|
|
_COUNT=0
|
2023-08-04 19:59:19 +02:00
|
|
|
while true; do
|
|
|
|
sleep 1
|
|
|
|
_COUNT=$((_COUNT+1))
|
|
|
|
# abort after 10 seconds
|
2023-08-04 20:18:58 +02:00
|
|
|
_progress "$((_COUNT*10))" "Powering off in $((10-_COUNT)) second(s). Don't forget to remove the boot medium!"
|
2023-08-04 19:59:19 +02:00
|
|
|
[[ "${_COUNT}" == 10 ]] && break
|
2023-08-04 20:04:37 +02:00
|
|
|
done | _dialog --title " System Shutdown " --no-mouse --gauge "Powering off in 10 seconds. Don't forget to remove the boot medium!" 6 75 0
|
2023-07-14 08:13:04 +02:00
|
|
|
poweroff
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_launcher() {
|
2023-07-14 07:46:24 +02:00
|
|
|
_MENU=()
|
2023-08-04 16:07:03 +02:00
|
|
|
if [[ -n "${_DESKTOP[*]}" ]]; then
|
2023-07-14 07:46:24 +02:00
|
|
|
_MENU+=( "2" "Launch Desktop Environment" )
|
|
|
|
fi
|
2023-08-04 16:07:03 +02:00
|
|
|
if [[ -n "${_MANAGE[*]}" ]]; then
|
2023-07-14 07:46:24 +02:00
|
|
|
_MENU+=( "3" "Manage Archboot Environment" )
|
|
|
|
fi
|
2023-10-08 20:44:13 +02:00
|
|
|
_dialog --default-item "${_DEFAULTITEM}" --cancel-label "${_LABEL}" --title " Launcher Menu " --menu "" 9 40 5 \
|
2023-08-04 16:07:03 +02:00
|
|
|
"1" "Launch Archboot Setup" "${_MENU[@]}" 2>"${_ANSWER}"
|
|
|
|
case $(cat "${_ANSWER}") in
|
2024-06-15 18:59:58 +02:00
|
|
|
"1") [[ -e /.launcher-running ]] && rm /.launcher-running
|
|
|
|
setup
|
|
|
|
exit 0 ;;
|
|
|
|
"2") _DEFAULTITEM=2
|
|
|
|
_desktop ;;
|
|
|
|
"3") _DEFAULTITEM=3
|
|
|
|
_manage ;;
|
|
|
|
*) _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
|