archboot/usr/bin/archboot-update.sh

129 lines
6 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2023-08-11 17:19:18 +02:00
# SPDX-License-Identifier: GPL-3.0-or-later
# created by Tobias Powalowski <tpowa@archlinux.org>
. /etc/archboot/defaults
2022-03-21 22:25:15 +01:00
. /usr/lib/archboot/common.sh
2022-05-03 15:36:34 +02:00
. /usr/lib/archboot/container.sh
2022-09-23 08:52:39 +02:00
#shellcheck disable=SC1094
. /usr/lib/archboot/update/update.sh
. /usr/lib/archboot/update/manage.sh
. /usr/lib/archboot/update/desktop.sh
. /usr/lib/archboot/update/xfce.sh
. /usr/lib/archboot/update/gnome.sh
. /usr/lib/archboot/update/plasma.sh
2023-07-10 11:02:26 +02:00
. /usr/lib/archboot/update/sway.sh
2024-08-01 12:36:17 +02:00
[[ -z "${1}" ]] && _usage
2021-09-22 09:02:56 +02:00
while [ $# -gt 0 ]; do
2022-04-30 08:47:58 +02:00
case ${1} in
-u|--u|-update|--update) _D_SCRIPTS="1" ;;
2022-04-30 08:47:58 +02:00
-latest|--latest) _L_COMPLETE="1" ;;
-latest-install|--latest-install) _L_INSTALL_COMPLETE="1";;
-latest-image|--latest-image) _G_RELEASE="1"
_L_INSTALL_COMPLETE="1";;
-xfce|--xfce) _L_XFCE="1" ;;
2023-07-10 10:48:42 +02:00
-sway|--sway) _L_SWAY="1" ;;
-gnome|--gnome) _L_GNOME="1";;
-plasma|--plasma) _L_PLASMA="1" ;;
2022-05-22 14:13:58 +02:00
-custom-xorg|--custom-xorg) _CUSTOM_X="1" ;;
-custom-wayland|--custom-wayland) _CUSTOM_WAYLAND="1" ;;
-full-system|--full-system) _FULL_SYSTEM="1" ;;
2024-08-01 12:40:44 +02:00
-h|--h|-help|--help|?) _usage ;;
*) _usage ;;
2022-04-30 08:47:58 +02:00
esac
shift
2021-09-22 09:02:56 +02:00
done
2022-04-25 15:11:54 +02:00
_archboot_check
2023-08-02 21:18:45 +02:00
if [[ -n "${_D_SCRIPTS}" ]]; then
2023-08-02 22:20:11 +02:00
_update_installer_check
_network_check
2023-08-30 17:05:25 +02:00
: > /.update
2024-03-20 16:48:05 +01:00
_TITLE="archboot.com | ${_RUNNING_ARCH} | ${_RUNNING_KERNEL} | Basic Setup | GIT Master Scripts"
2023-08-30 21:51:43 +02:00
_download_latest | _dialog --title " Archboot GIT Master " --gauge "Downloading latest GIT..." 6 75 0
2023-08-03 19:44:30 +02:00
clear
2023-08-02 21:18:45 +02:00
fi
2021-09-22 09:02:56 +02:00
# Generate new environment and launch it with kexec
2023-08-03 15:42:29 +02:00
if [[ -n "${_L_COMPLETE}" || -n "${_L_INSTALL_COMPLETE}" ]] && [[ -z "${_G_RELEASE}" ]]; then
2023-08-02 20:54:58 +02:00
_update_installer_check
2024-02-25 17:36:43 +01:00
_geoip_mirrorlist
2023-08-30 17:05:25 +02:00
: > /.update
2024-03-20 16:48:05 +01:00
_TITLE="archboot.com | ${_RUNNING_ARCH} | ${_RUNNING_KERNEL} | Basic Setup | New Environment"
2023-08-02 19:19:52 +02:00
_new_environment | _dialog --title "${_MENU_TITLE}" --gauge "Waiting for pacman keyring..." 6 75 0
2023-08-02 20:34:50 +02:00
clear
2021-09-22 09:02:56 +02:00
fi
# Generate new images
2023-01-09 18:23:25 +01:00
if [[ -n "${_G_RELEASE}" ]]; then
2023-08-02 20:54:58 +02:00
_update_installer_check
2023-08-30 17:05:25 +02:00
: > /.update
2024-03-20 16:48:05 +01:00
_TITLE="archboot.com | ${_RUNNING_ARCH} | ${_RUNNING_KERNEL} | Basic Setup | New Images"
2023-08-02 19:19:52 +02:00
_new_image | _dialog --title "${_MENU_TITLE}" --gauge "Removing not necessary files from /..." 6 75 0
2023-08-02 20:34:50 +02:00
clear
2021-09-22 09:02:56 +02:00
fi
# install custom xorg or wayland
2023-01-09 18:23:25 +01:00
if [[ -n "${_CUSTOM_X}" || -n "${_CUSTOM_WAYLAND}" ]]; then
_custom_wayland_xorg
fi
# Gnome, KDE/PLASMA or XFCE launch
2024-06-14 12:00:01 +02:00
if [[ -n "${_L_XFCE}" || -n "${_L_SWAY}" || -n "${_L_PLASMA}" || -n "${_L_GNOME}" ]]; then
2023-08-30 17:05:25 +02:00
: > /.update
2024-03-20 16:48:05 +01:00
_TITLE="archboot.com | ${_RUNNING_ARCH} | ${_RUNNING_KERNEL} | Basic Setup | Desktop Environment"
2023-08-30 17:05:25 +02:00
[[ -e /var/cache/pacman/pkg/archboot.db ]] && : > /.graphic_installed
2024-06-16 11:24:09 +02:00
if [[ -n "${_L_XFCE}" ]]; then
_ENVIRONMENT="XFCE"
_install_xfce | _dialog --title "${_MENU_TITLE}" --gauge "Initializing ${_ENVIRONMENT}..." 6 75 0
elif [[ -n "${_L_GNOME}" ]]; then
_ENVIRONMENT="GNOME"
_install_gnome | _dialog --title "${_MENU_TITLE}" --gauge "Initializing ${_ENVIRONMENT}..." 6 75 0
elif [[ -n "${_L_PLASMA}" ]];then
_ENVIRONMENT="Plasma/KDE"
_install_plasma | _dialog --title "${_MENU_TITLE}" --gauge "Initializing ${_ENVIRONMENT}..." 6 75 0
elif [[ -n "${_L_SWAY}" ]]; then
_ENVIRONMENT="Sway"
_install_sway | _dialog --title "${_MENU_TITLE}" --gauge "Initializing ${_ENVIRONMENT}..." 6 75 0
fi
rm /.update
# only start vnc on xorg environment
echo "Setting up VNC and browser..." >"${_LOG}"
[[ -n "${_L_XFCE}" ]] && _autostart_vnc
2024-06-16 10:59:02 +02:00
echo "Setting ${_STANDARD_BROWSER} as default browser..." >"${_LOG}"
2024-06-16 08:48:13 +02:00
# gnome
if command -v gsettings &>"${_NO_LOG}"; then
[[ "${_STANDARD_BROWSER}" == "firefox" ]] && gsettings set org.gnome.shell favorite-apps "['org.gnome.Settings.desktop', 'org.gnome.Terminal.desktop', 'org.gnome.Nautilus.desktop', 'firefox.desktop', 'org.gnome.DiskUtility.desktop', 'gparted.desktop', 'archboot.desktop']"
[[ "${_STANDARD_BROWSER}" == "chromium" ]] && gsettings set org.gnome.shell favorite-apps "['org.gnome.Settings.desktop', 'org.gnome.Terminal.desktop', 'org.gnome.Nautilus.desktop', 'chromium.desktop', 'org.gnome.DiskUtility.desktop', 'gparted.desktop', 'archboot.desktop']"
fi
2024-06-16 10:52:57 +02:00
# plasma and xfce
2024-06-27 07:36:04 +02:00
sd 'firefox' "${_STANDARD_BROWSER}" /etc/xdg/xfce4/helpers.rc \
2024-06-16 10:52:57 +02:00
/etc/xdg/menus/plasma-applications.menu \
/usr/share/plasma/plasmoids/org.kde.plasma.taskmanager/contents/config/main.xml 2>"${_NO_LOG}"
2024-06-27 07:36:04 +02:00
sd 'chromium' "${_STANDARD_BROWSER}" /etc/xdg/xfce4/helpers.rc \
2024-06-16 10:52:57 +02:00
/etc/xdg/menus/plasma-applications.menu \
/usr/share/plasma/plasmoids/org.kde.plasma.taskmanager/contents/config/main.xml 2>"${_NO_LOG}"
2023-08-04 12:19:20 +02:00
if [[ -n "${_L_XFCE}" ]]; then
_start_xfce | _dialog --title "${_MENU_TITLE}" --gauge "Starting ${_ENVIRONMENT}..." 6 75 99
clear
echo -e "To relaunch \e[1mXFCE\e[m desktop use: \e[92mstartxfce4\e[m"
elif [[ -n "${_L_GNOME}" ]]; then
_start_gnome | _dialog --title "${_MENU_TITLE}" --gauge "Starting ${_ENVIRONMENT}..." 6 75 99
clear
echo -e "To relaunch \e[1mGNOME Wayland\e[m use: \e[92mgnome-wayland\e[m"
elif [[ -n "${_L_PLASMA}" ]]; then
_start_plasma | _dialog --title "${_MENU_TITLE}" --gauge "Starting ${_ENVIRONMENT}..." 6 75 99
clear
echo -e "To relaunch \e[1mKDE/Plasma Wayland\e[m use: \e[92mplasma-wayland\e[m"
elif [[ -n "${_L_SWAY}" ]]; then
_start_sway | _dialog --title "${_MENU_TITLE}" --gauge "Starting ${_ENVIRONMENT}..." 6 75 99
clear
echo -e "To relaunch \e[1mSway\e[m use: \e[92msway-wayland\e[m"
fi
fi
2022-10-08 18:44:57 +02:00
# Switch to full Arch Linux system
2023-01-09 18:23:25 +01:00
if [[ -n "${_FULL_SYSTEM}" ]]; then
2023-08-02 20:54:58 +02:00
_full_system_check
_update_installer_check
2023-08-30 17:05:25 +02:00
: > /.update
2024-03-20 16:48:05 +01:00
_TITLE="archboot.com | ${_RUNNING_ARCH} | ${_RUNNING_KERNEL} | Basic Setup | Full System"
2023-08-02 19:19:52 +02:00
_full_system | _dialog --title "${_MENU_TITLE}" --gauge "Refreshing pacman package database..." 6 75 0
2023-08-02 20:34:50 +02:00
clear
2022-10-06 22:55:35 +02:00
fi
2023-08-04 10:45:00 +02:00
[[ -e /.update ]] && rm /.update