Refactored profiles and package lists into centralized config files.

This commit is contained in:
2026-01-17 12:16:40 -05:00
parent 985ecd76a4
commit 63833f6da3
7 changed files with 288 additions and 231 deletions

34
config/drivers.conf Normal file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
# Copyright 2026 Logan Fick
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# drivers.conf - Graphics driver package definitions
#
# Defines package arrays for graphics driver installation.
# Intel graphics packages
INTEL_PACKAGES=(
mesa
vulkan-intel
intel-media-driver
libva-intel-driver
)
# NVIDIA graphics packages
NVIDIA_PACKAGES=(
mesa
nvidia-open
libva-nvidia-driver
)

192
config/profiles.conf Normal file
View File

@@ -0,0 +1,192 @@
#!/bin/bash
# Copyright 2026 Logan Fick
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# profiles.conf - Profile and desktop environment package definitions
#
# Defines XFCE packages and installation profiles. Adding a new profile
# requires only adding entries here - no code changes needed.
#===============================================================================
# DESKTOP ENVIRONMENT PACKAGES
#===============================================================================
# XFCE base packages
XFCE_PACKAGES=(
lightdm
lightdm-gtk-greeter
lightdm-gtk-greeter-settings
thunar
thunar-archive-plugin
gvfs
xfce4-panel
xfce4-power-manager
xfce4-session
xfce4-settings
xfce4-terminal
xfdesktop
xfwm4
papirus-icon-theme
xfce4-battery-plugin
xfce4-notifyd
xfce4-whiskermenu-plugin
xfce4-screensaver
xfce4-screenshooter
mousepad
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
noto-fonts-extra
pipewire
pipewire-alsa
pipewire-pulse
pipewire-jack
wireplumber
pavucontrol
xfce4-pulseaudio-plugin
ristretto
webp-pixbuf-loader
libopenraw
xarchiver
7zip
xreader
)
#===============================================================================
# PROFILE DEFINITIONS
#===============================================================================
# Profile registry - order determines menu numbering
PROFILES=(minimal server minimal_desktop htpc htpc_gaming office dev)
# Each profile defines:
# PROFILE_<key>_NAME - Display name
# PROFILE_<key>_DESC - Description shown in menu
# PROFILE_<key>_XFCE - Whether to install XFCE (true/false)
# PROFILE_<key>_PACKAGES - Package array
# PROFILE_<key>_SERVICES - Services to enable array
#---------------------------------------------------------------------------
# Profile: Minimal
#---------------------------------------------------------------------------
PROFILE_minimal_NAME="Minimal"
PROFILE_minimal_DESC="Base Arch Linux system, no additional packages."
PROFILE_minimal_XFCE=false
PROFILE_minimal_PACKAGES=()
PROFILE_minimal_SERVICES=()
#---------------------------------------------------------------------------
# Profile: Server
#---------------------------------------------------------------------------
PROFILE_server_NAME="Server"
PROFILE_server_DESC="Adds Restic, Docker, and Docker Compose."
PROFILE_server_XFCE=false
PROFILE_server_PACKAGES=(
restic
docker
docker-compose
)
PROFILE_server_SERVICES=(docker.service)
#---------------------------------------------------------------------------
# Profile: Minimal Desktop
#---------------------------------------------------------------------------
PROFILE_minimal_desktop_NAME="Minimal Desktop"
PROFILE_minimal_desktop_DESC="XFCE 4 with no additional applications."
PROFILE_minimal_desktop_XFCE=true
PROFILE_minimal_desktop_PACKAGES=()
PROFILE_minimal_desktop_SERVICES=()
#---------------------------------------------------------------------------
# Profile: Home Theater PC
#---------------------------------------------------------------------------
PROFILE_htpc_NAME="Home Theater PC"
PROFILE_htpc_DESC="XFCE 4 with Chromium and VLC media player."
PROFILE_htpc_XFCE=true
PROFILE_htpc_PACKAGES=(
chromium
vlc
vlc-plugin-ffmpeg
)
PROFILE_htpc_SERVICES=()
#---------------------------------------------------------------------------
# Profile: Home Theater PC with Gaming
#---------------------------------------------------------------------------
PROFILE_htpc_gaming_NAME="Home Theater PC with Gaming"
PROFILE_htpc_gaming_DESC="XFCE 4 with Chromium, VLC media player, and Dolphin."
PROFILE_htpc_gaming_XFCE=true
PROFILE_htpc_gaming_PACKAGES=(
dolphin-emu
chromium
vlc
vlc-plugin-ffmpeg
)
PROFILE_htpc_gaming_SERVICES=()
#---------------------------------------------------------------------------
# Profile: Office Workstation
#---------------------------------------------------------------------------
PROFILE_office_NAME="Office Workstation"
PROFILE_office_DESC="XFCE 4 with a full suite of desktop applications aimed at general office work."
PROFILE_office_XFCE=true
PROFILE_office_PACKAGES=(
chromium
vlc
vlc-plugin-ffmpeg
hunspell-en_us
libreoffice-fresh
keepassxc
qalculate-gtk
ffmpeg
gimp
syncthing
tenacity
git
gnucash
)
PROFILE_office_SERVICES=()
#---------------------------------------------------------------------------
# Profile: Software Development Workstation
#---------------------------------------------------------------------------
PROFILE_dev_NAME="Software Development Workstation"
PROFILE_dev_DESC="XFCE 4 with a suite of software development applications."
PROFILE_dev_XFCE=true
PROFILE_dev_PACKAGES=(
chromium
vlc
vlc-plugin-ffmpeg
hunspell-en_us
libreoffice-fresh
keepassxc
qalculate-gtk
ffmpeg
gimp
syncthing
tenacity
git
docker
docker-compose
python
python-virtualenv
pycharm-community-edition
jdk-openjdk
intellij-idea-community-edition
go
code
wireshark-qt
)
PROFILE_dev_SERVICES=(docker.service)

View File

@@ -16,6 +16,8 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Source configuration # Source configuration
source "${SCRIPT_DIR}/config/defaults.conf" source "${SCRIPT_DIR}/config/defaults.conf"
source "${SCRIPT_DIR}/config/luks.conf" source "${SCRIPT_DIR}/config/luks.conf"
source "${SCRIPT_DIR}/config/drivers.conf"
source "${SCRIPT_DIR}/config/profiles.conf"
# Source core libraries # Source core libraries
source "${SCRIPT_DIR}/lib/core/common.sh" source "${SCRIPT_DIR}/lib/core/common.sh"

View File

@@ -17,21 +17,7 @@
# drivers.sh - Graphics driver installation # drivers.sh - Graphics driver installation
# #
# Prompts the user to select and install graphics drivers (Intel, NVIDIA, or skip). # Prompts the user to select and install graphics drivers (Intel, NVIDIA, or skip).
# Driver package arrays are defined in config/drivers.conf.
# Intel graphics packages
INTEL_PACKAGES=(
mesa
vulkan-intel
intel-media-driver
libva-intel-driver
)
# NVIDIA graphics packages
NVIDIA_PACKAGES=(
mesa
nvidia-open
libva-nvidia-driver
)
# Prompt user for graphics driver selection and install # Prompt user for graphics driver selection and install
prompt_install_graphics() { prompt_install_graphics() {

View File

@@ -17,47 +17,7 @@
# xfce.sh - XFCE desktop environment installation # xfce.sh - XFCE desktop environment installation
# #
# Installs XFCE4 with LightDM and copies pre-configured user settings. # Installs XFCE4 with LightDM and copies pre-configured user settings.
# XFCE_PACKAGES is defined in config/profiles.conf.
# XFCE base packages
XFCE_PACKAGES=(
lightdm
lightdm-gtk-greeter
lightdm-gtk-greeter-settings
thunar
thunar-archive-plugin
gvfs
xfce4-panel
xfce4-power-manager
xfce4-session
xfce4-settings
xfce4-terminal
xfdesktop
xfwm4
papirus-icon-theme
xfce4-battery-plugin
xfce4-notifyd
xfce4-whiskermenu-plugin
xfce4-screensaver
xfce4-screenshooter
mousepad
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
noto-fonts-extra
pipewire
pipewire-alsa
pipewire-pulse
pipewire-jack
wireplumber
pavucontrol
xfce4-pulseaudio-plugin
ristretto
webp-pixbuf-loader
libopenraw
xarchiver
7zip
xreader
)
# Install XFCE base packages # Install XFCE base packages
install_xfce_packages() { install_xfce_packages() {

View File

@@ -1,73 +0,0 @@
#!/bin/bash
# Copyright 2026 Logan Fick
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# packages.sh - Shared package group definitions
#
# Defines reusable package arrays used by installation profiles.
# Media packages (browser, video player)
PACKAGES_MEDIA=(
chromium
vlc
vlc-plugin-ffmpeg
)
# Office productivity packages
PACKAGES_OFFICE=(
hunspell-en_us
libreoffice-fresh
keepassxc
qalculate-gtk
)
# General productivity packages
PACKAGES_PRODUCTIVITY=(
ffmpeg
gimp
syncthing
tenacity
)
# Development base packages
PACKAGES_DEV_BASE=(
git
docker
docker-compose
)
# Python development packages
PACKAGES_DEV_PYTHON=(
python
python-virtualenv
pycharm-community-edition
)
# Java development packages
PACKAGES_DEV_JAVA=(
jdk-openjdk
intellij-idea-community-edition
)
# Go development packages
PACKAGES_DEV_GO=(
go
)
# Additional development tools
PACKAGES_DEV_TOOLS=(
code
wireshark-qt
)

View File

@@ -16,152 +16,106 @@
# registry.sh - Profile registry and management # registry.sh - Profile registry and management
# #
# Defines installation profiles that customize the system for different use cases. # Provides functions to list, select, and install profiles.
# Each profile specifies which packages to install and services to enable. # Profile definitions are loaded from config/profiles.conf.
# Adding a new profile requires only adding entries to the config file.
# Source shared package definitions # Get profile key by menu number (1-based)
source "${SCRIPT_DIR}/profiles/packages.sh" # Arguments:
# $1 - menu selection number
# Outputs:
# Profile key to stdout
get_profile_key() {
local index=$(($1 - 1))
echo "${PROFILES[$index]}"
}
# Profile definitions # Display available profiles (auto-generated from PROFILES array)
declare -A PROFILE_NAMES=(
[1]="Minimal"
[2]="Server"
[3]="Minimal Desktop"
[4]="Home Theater PC"
[5]="Home Theater PC with Gaming"
[6]="Office Workstation"
[7]="Software Development Workstation"
)
declare -A PROFILE_DESCRIPTIONS=(
[1]="Base Arch Linux system, no additional packages."
[2]="Adds Restic, Docker, and Docker Compose."
[3]="XFCE 4 with no additional applications."
[4]="XFCE 4 with Chromium and VLC media player."
[5]="XFCE 4 with Chromium, VLC media player, and Dolphin."
[6]="XFCE 4 with a full suite of desktop applications aimed at general office work."
[7]="XFCE 4 with a suite of software development applications."
)
declare -A PROFILE_REQUIRES_XFCE=(
[1]=false
[2]=false
[3]=true
[4]=true
[5]=true
[6]=true
[7]=true
)
# Display available profiles
list_profiles() { list_profiles() {
print "Base install complete. Select profile to install for this system:" print "Base install complete. Select profile to install for this system:"
for i in {1..7}; do local i=1
print " $i - ${PROFILE_NAMES[$i]}" for profile in "${PROFILES[@]}"; do
print " ${PROFILE_DESCRIPTIONS[$i]}" local name_var="PROFILE_${profile}_NAME"
local desc_var="PROFILE_${profile}_DESC"
print " $i - ${!name_var}"
print " ${!desc_var}"
((i++))
done done
} }
# Get packages for a profile # Get packages for a profile
# Arguments: # Arguments:
# $1 - profile number # $1 - profile key
# Outputs: # Outputs:
# Package list to stdout # Package list to stdout
get_profile_packages() { get_profile_packages() {
local profile="$1" local profile_key="$1"
local pkg_var="PROFILE_${profile_key}_PACKAGES[@]"
case "$profile" in echo "${!pkg_var}"
"1")
# Minimal - no additional packages
;;
"2")
# Server
echo "restic docker docker-compose"
;;
"3")
# Minimal Desktop - XFCE only, no additional packages
;;
"4")
# Home Theater PC
echo "${PACKAGES_MEDIA[*]}"
;;
"5")
# Home Theater PC with Gaming
echo "dolphin-emu ${PACKAGES_MEDIA[*]}"
;;
"6")
# Office Workstation
echo "${PACKAGES_MEDIA[*]} ${PACKAGES_OFFICE[*]} ${PACKAGES_PRODUCTIVITY[*]} git gnucash"
;;
"7")
# Software Development Workstation
echo "${PACKAGES_MEDIA[*]} ${PACKAGES_OFFICE[*]} ${PACKAGES_PRODUCTIVITY[*]}"
echo "${PACKAGES_DEV_BASE[*]} ${PACKAGES_DEV_PYTHON[*]} ${PACKAGES_DEV_JAVA[*]}"
echo "${PACKAGES_DEV_GO[*]} ${PACKAGES_DEV_TOOLS[*]}"
;;
esac
} }
# Get services to enable for a profile # Get services for a profile
# Arguments: # Arguments:
# $1 - profile number # $1 - profile key
# Outputs: # Outputs:
# Service list to stdout # Service list to stdout
get_profile_services() { get_profile_services() {
local profile="$1" local profile_key="$1"
local svc_var="PROFILE_${profile_key}_SERVICES[@]"
case "$profile" in echo "${!svc_var}"
"2"|"7")
echo "docker.service"
;;
esac
} }
# Check if profile requires XFCE # Check if profile requires XFCE
# Arguments: # Arguments:
# $1 - profile number # $1 - profile key
# Returns: # Returns:
# 0 if requires XFCE, 1 otherwise # 0 if requires XFCE, 1 otherwise
profile_requires_xfce() { profile_requires_xfce() {
local profile="$1" local profile_key="$1"
local xfce_var="PROFILE_${profile_key}_XFCE"
[ "${!xfce_var}" = "true" ]
}
if [ "${PROFILE_REQUIRES_XFCE[$profile]}" = "true" ]; then # Validate profile selection
return 0 # Arguments:
else # $1 - user selection
return 1 # Returns:
fi # 0 if valid, 1 otherwise
validate_profile_selection() {
local selection="$1"
local max="${#PROFILES[@]}"
[[ "$selection" =~ ^[1-9][0-9]*$ ]] && [ "$selection" -le "$max" ]
} }
# Install a profile # Install a profile
# Arguments: # Arguments:
# $1 - profile number # $1 - profile key
# $2 - username # $2 - username
install_profile() { install_profile() {
local profile="$1" local profile_key="$1"
local username="$2" local username="$2"
local packages local packages
local services local services
# Install XFCE if required # Install XFCE if required
if profile_requires_xfce "$profile"; then if profile_requires_xfce "$profile_key"; then
install_xfce "$username" install_xfce "$username"
prompt_install_graphics prompt_install_graphics
fi fi
# Get and install profile packages # Get and install profile packages
packages=$(get_profile_packages "$profile") packages=$(get_profile_packages "$profile_key")
if [ -n "$packages" ]; then if [ -n "$packages" ]; then
# shellcheck disable=SC2086 # shellcheck disable=SC2086
chroot_pacman_install $packages chroot_pacman_install $packages
fi fi
# Enable profile services # Enable profile services
services=$(get_profile_services "$profile") services=$(get_profile_services "$profile_key")
if [ -n "$services" ]; then for service in $services; do
# shellcheck disable=SC2086 chroot_systemd_enable "$service"
chroot_systemd_enable $services done
fi
} }
# Prompt user for profile selection and install # Prompt user for profile selection and install
@@ -169,16 +123,18 @@ install_profile() {
# $1 - username # $1 - username
select_and_install_profile() { select_and_install_profile() {
local username="$1" local username="$1"
local profile local selection
local profile_key
list_profiles list_profiles
read -r profile read -r selection
# Validate selection # Validate selection
if ! [[ "$profile" =~ ^[1-7]$ ]]; then if ! validate_profile_selection "$selection"; then
print_warning "Unknown profile, defaulting to minimal install." print_warning "Unknown profile, defaulting to minimal install."
profile="1" selection="1"
fi fi
install_profile "$profile" "$username" profile_key=$(get_profile_key "$selection")
install_profile "$profile_key" "$username"
} }