1

Modify personalizer for use from barebones system

This commit is contained in:
Jessie Hildebrandt 2023-06-02 11:46:34 -04:00
parent af054353b6
commit 3b1aea5159

View File

@ -13,6 +13,19 @@
# #
################################################################################ ################################################################################
########################################
# OpenSUSE patterns
PATTERNS=(
# (Base system)
patterns-base-apparmor
patterns-base-base
patterns-base-enhanced_base
# (Desktop environment)
patterns-gnome-gnome_basic
)
######################################## ########################################
# Zypper packages # Zypper packages
@ -29,13 +42,13 @@ AL=(
# To install # To install
IN=( IN=(
# (Necessary packages) # (Necessary packages)
wget nano git-core flatpak opi git-core flatpak opi
# (Theming) # (Theming)
papirus-icon-theme fira-code-fonts gdouros-symbola-fonts papirus-icon-theme fira-code-fonts gdouros-symbola-fonts
# (Shell utilities) # (Shell utilities)
fish fzf fortune toilet cowsay wmctrl libnotify-tools fish fzf nano zenity fortune toilet cowsay wmctrl libnotify-tools
# (Programs) # (Programs)
emacs inkscape gimp shotcut audacity geary nextcloud-desktop steam blender emacs inkscape gimp shotcut audacity geary nextcloud-desktop steam blender
@ -67,10 +80,16 @@ GNOME_EXTENSIONS=(
) )
######################################## ########################################
# Directories # URLs
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) FLATHUB_REMOTE_URL="https://flathub.org/repo/flathub.flatpakrepo"
TMP_WORKDIR="/tmp/opensuse-setup-script-workdir/"
PERSONALIZER_REPO_URL="https://gitlab.com/jessieh/opensuse-personalizer.git"
########################################
# Directories and files
PERSONALIZER_REPO_DIR=/tmp/opensuse-personalizer
################################################################################ ################################################################################
# #
@ -88,9 +107,9 @@ if [ "${EUID}" == 0 ]; then
exit 1 exit 1
fi fi
# Ensure zenity is installed # Ensure "dialog" is installed
echo "Ensuring zenity is installed..." echo "Installing dialog utility..."
sudo zypper --non-interactive in zenity sudo zypper --non-interactive in dialog
######################################## ########################################
# Prompt for system chassis # Prompt for system chassis
@ -99,19 +118,19 @@ system_chassis=$(hostnamectl chassis)
function string_eq () function string_eq ()
{ {
[[ "${1}" == "${2}" ]] && echo TRUE || echo FALSE [[ "${1}" == "${2}" ]] && echo ON || echo OFF
} }
function prompt_chassis_type () function prompt_chassis_type ()
{ {
entry=$(zenity --title="Chassis Type" --list --radiolist --width=200 --height=400 \
--text="Confirm the chassis type for this system:\n" \ entry=$(dialog --title "Chassis Type" --stdout --no-cancel --erase-on-exit \
--column="Selected" --column="Chassis Type" \ --radiolist "Confirm the chassis type for this system:" 0 0 0 \
$(string_eq "${system_chassis}" "desktop") "Desktop" \ "Desktop" "Stationary form factor" $(string_eq "${system_chassis}" "desktop") \
$(string_eq "${system_chassis}" "laptop") "Laptop" \ "Laptop" "Clamshell form factor" $(string_eq "${system_chassis}" "laptop") \
$(string_eq "${system_chassis}" "tablet") "Tablet" \ "Tablet" "Touchscreen form factor" $(string_eq "${system_chassis}" "tablet") \
$(string_eq "${system_chassis}" "convertible") "Convertible") "Convertible" "Hybrid form factor" $(string_eq "${system_chassis}" "convertible"))
# Ensure entry is lowercase # Ensure entry is lowercase
entry=${entry,,} entry=${entry,,}
@ -120,7 +139,7 @@ function prompt_chassis_type ()
case "${entry}" in case "${entry}" in
"desktop"|"laptop"|"convertible"|"tablet") "desktop"|"laptop"|"convertible"|"tablet")
if if
zenity --question --title="Chassis Type" --text="Use ${entry} as chassis type?" --default-cancel --no-wrap dialog --title "Chassis Type" --defaultno --yesno "Use ${entry} as chassis type?" 0 0
then then
system_chassis="${entry}" system_chassis="${entry}"
return 0 return 0
@ -129,7 +148,7 @@ function prompt_chassis_type ()
fi fi
;; ;;
*) *)
zenity --warning --title="Chassis Type" --text="Please choose a chassis type for this system." --no-wrap dialog --title "Chassis Type" --msgbox "Please choose a chassis type for this system." 0 0
return 1 return 1
;; ;;
esac esac
@ -151,7 +170,9 @@ system_name=$(hostnamectl hostname)
function prompt_system_name () function prompt_system_name ()
{ {
entry=$(zenity --entry --title="System Name" --text="All lowercase letters, no spaces or symbols:" --entry-text="${system_name}") entry=$(dialog --title "System Name" --stdout --no-cancel --erase-on-exit \
--inputbox "All lowercase letters, no spaces or symbols:" 0 0 \
"${system_name}")
# Filter all non-letter characters out of the user's entry # Filter all non-letter characters out of the user's entry
entry=${entry//[^[:alpha:]]/} entry=${entry//[^[:alpha:]]/}
@ -161,12 +182,12 @@ function prompt_system_name ()
case "${entry}" in case "${entry}" in
"") "")
zenity --warning --title="System Name" --text="Please enter a name for this system." --no-wrap dialog --title "Chassis Type" --msgbox "Please enter a name for this system." 0 0
return 1 return 1
;; ;;
*) *)
if if
zenity --question --title="System Name" --text="Use ${entry} as system name?" --default-cancel --no-wrap dialog --title "Chassis Type" --defaultno --yesno "Use ${entry} as system name?" 0 0
then then
system_name="${entry}" system_name="${entry}"
return 0 return 0
@ -195,20 +216,21 @@ optional_additions=""
function prompt_optional_additions () function prompt_optional_additions ()
{ {
ENTRY=$(zenity --title="Optional Additions" --list --checklist --width=600 --height=440 \
--text="Select any additional configuration changes that you would like applied to the system:\n" \ ENTRY=$(dialog --title "Optional Additions" --stdout --no-cancel --single-quoted --output-separator '|' \
--column="Apply" --column="Title" --column="Description" \ --checklist "Select any additional configuration changes that you would like applied to the system:" 0 0 0 \
FALSE "Xournal++" "Install Xournal++ for taking handwritten notes" \ "Xournal++" "Install Xournal++ for taking handwritten notes" OFF \
FALSE "EasyEffects" "Install EasyEffects for applying effects (e.g. equalizers) to system audio devices" \ "EasyEffects" "Install EasyEffects for applying effects (e.g. equalizers) to system audio devices" OFF \
FALSE "Media Control Key Shortcuts" "Set up media control keyboard shortcuts (for keyboards without dedicated media control keys)" \ "Media Control Key Shortcuts" "Set up media control keyboard shortcuts (for keyboards without dedicated media control keys)" OFF \
FALSE "Touchpad Lock Toggle Shortcut" "Set up a touchpad lock toggle keyboard shortcut (for systems with touchpads)" \ "Touchpad Lock Toggle Shortcut" "Set up a touchpad lock toggle keyboard shortcut (for systems with touchpads)" OFF \
FALSE "Power Button Screen Lock Override" "Override the power button's default behavior with a screen lock shortcut (for tablets or convertibles)" \ "Power Button Screen Lock Override" "Override the power button's default behavior with a screen lock shortcut (for tablets or convertibles)" OFF \
FALSE '"Reboot to Windows" Launcher' "Install a desktop entry that reboots the system to Microsoft Windows (for systems that multi-boot with Windows)") '"Reboot to Windows" Launcher' "Install a desktop entry that reboots the system to Microsoft Windows (for systems that multi-boot with Windows)" OFF )
case "${ENTRY}" in case "${ENTRY}" in
"") "")
if if
zenity --question --title="Optional Additions" --text="Apply only baseline system configuration?" --default-cancel --no-wrap dialog --keep-window --erase-on-exit --title "Chassis Type" --defaultno --yesno "Apply only baseline system configuration?" 0 0
then then
return 0 return 0
else else
@ -217,8 +239,8 @@ function prompt_optional_additions ()
;; ;;
*) *)
if if
ADDITIONS_LIST=$(echo "${ENTRY}" | sed "s/|/\n • /g") ADDITIONS_LIST=$(echo "${ENTRY}" | sed "s/|/\\\\n * /g" | sed "s/'//g")
zenity --question --title="Optional Additions" --text="Confirm your selection of the following additions:\n${ADDITIONS_LIST}" --default-cancel --no-wrap dialog --keep-window --erase-on-exit --title "Chassis Type" --defaultno --yesno "Confirm your selection of the following additions:\n${ADDITIONS_LIST}" 0 0
then then
optional_additions="${ENTRY}" optional_additions="${ENTRY}"
return 0 return 0
@ -242,6 +264,7 @@ until prompt_optional_additions; do : ; done
# Package operations # Package operations
echo "Setting up packages..." echo "Setting up packages..."
sudo zypper --non-interactive in ${PATTERNS[@]}
sudo zypper --non-interactive rm ${RM[@]} ${AL[@]} sudo zypper --non-interactive rm ${RM[@]} ${AL[@]}
sudo zypper --non-interactive al ${AL[@]} sudo zypper --non-interactive al ${AL[@]}
sudo zypper --non-interactive in ${IN[@]} sudo zypper --non-interactive in ${IN[@]}
@ -250,7 +273,7 @@ sudo zypper --non-interactive in ${IN[@]}
# Flatpak operations # Flatpak operations
echo "Setting up Flatpak remotes..." echo "Setting up Flatpak remotes..."
FLATHUB_REMOTE=https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak remote-add --if-not-exists flathub "${FLATHUB_REMOTE}" sudo flatpak remote-add --if-not-exists flathub "${FLATHUB_REMOTE}"
echo "Setting up Flatpak packages..." echo "Setting up Flatpak packages..."
@ -480,16 +503,19 @@ sudo chsh ${USER} -s $(which fish)
echo "Installing scripts..." echo "Installing scripts..."
# Clone personalizer repo containing scripts, desktop entries, etc. to temporary folder
git clone "${PERSONALIZER_REPO_URL}" "${PERSONALIZER_REPO_DIR}"
if [[ "${optional_additions}" != *'Touchpad Lock Toggle Shortcut'* ]]; then if [[ "${optional_additions}" != *'Touchpad Lock Toggle Shortcut'* ]]; then
rm ${SCRIPT_DIR}/scripts/gnome-toggle-touchpad-lock rm ${PERSONALIZER_REPO_DIR}/scripts/gnome-toggle-touchpad-lock
fi fi
if [[ "${optional_additions}" != *'"Reboot to Windows" Launcher'* ]]; then if [[ "${optional_additions}" != *'"Reboot to Windows" Launcher'* ]]; then
rm ${SCRIPT_DIR}/scripts/reboot-windows rm ${PERSONALIZER_REPO_DIR}/scripts/reboot-windows
fi fi
chmod +x ${SCRIPT_DIR}/scripts/* chmod +x ${PERSONALIZER_REPO_DIR}/scripts/*
sudo cp ${SCRIPT_DIR}/scripts/* /usr/bin sudo cp ${PERSONALIZER_REPO_DIR}/scripts/* /usr/bin
######################################## ########################################
# Desktop entries # Desktop entries
@ -497,11 +523,11 @@ sudo cp ${SCRIPT_DIR}/scripts/* /usr/bin
echo "Installing desktop entries..." echo "Installing desktop entries..."
if [[ "${optional_additions}" != *'"Reboot to Windows" Launcher'* ]]; then if [[ "${optional_additions}" != *'"Reboot to Windows" Launcher'* ]]; then
rm ${SCRIPT_DIR}/desktop_entries/windows.desktop rm ${PERSONALIZER_REPO_DIR}/desktop_entries/windows.desktop
fi fi
mkdir -p ${HOME}/.local/share/applications/ mkdir -p ${HOME}/.local/share/applications/
cp ${SCRIPT_DIR}/desktop-entries/* ${HOME}/.local/share/applications/ cp ${PERSONALIZER_REPO_DIR}/desktop-entries/* ${HOME}/.local/share/applications/
################################################################################ ################################################################################
# #
@ -509,17 +535,22 @@ cp ${SCRIPT_DIR}/desktop-entries/* ${HOME}/.local/share/applications/
# #
################################################################################ ################################################################################
echo echo "
echo "Personalization complete!" Personalization complete!
echo
echo "Recommended next steps:" Recommended next steps:
echo " • Log in to Firefox Sync"
echo " • Configure Nextcloud client" • Reboot
if [[ "${optional_additions}" == *"EasyEffects"* ]]; then
echo " • Install an audio device profile from" • Log in to Firefox Sync
echo " https://autoeq.app"
fi • Configure Nextcloud client
echo " • Install a Wireguard VPN profile from" $(if [[ "${optional_additions}" == *"EasyEffects"* ]]; then echo " • Install an audio device profile from\n https://autoeq.app\n"; fi)
echo " https://mullvad.net/en/account/#/wireguard-config/?platform=linux" • Install a Wireguard VPN profile from
echo " • Configure display settings and run 'gdm-update-display-settings'" https://mullvad.net/en/account/#/wireguard-config/?platform=linux
echo " • Run 'themer' to install/update unofficial libadwaita themes"
• Configure display settings and run 'gdm-update-display-settings'
• Run 'themer' to install/update unofficial libadwaita themes
(A copy of these recommendations has been saved to ${HOME}/next-steps)" | tee ${HOME}/next-steps