Refactored profiles and package lists into centralized config files.
This commit is contained in:
34
config/drivers.conf
Normal file
34
config/drivers.conf
Normal 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
192
config/profiles.conf
Normal 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)
|
||||
@@ -16,6 +16,8 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# Source configuration
|
||||
source "${SCRIPT_DIR}/config/defaults.conf"
|
||||
source "${SCRIPT_DIR}/config/luks.conf"
|
||||
source "${SCRIPT_DIR}/config/drivers.conf"
|
||||
source "${SCRIPT_DIR}/config/profiles.conf"
|
||||
|
||||
# Source core libraries
|
||||
source "${SCRIPT_DIR}/lib/core/common.sh"
|
||||
|
||||
@@ -17,21 +17,7 @@
|
||||
# drivers.sh - Graphics driver installation
|
||||
#
|
||||
# Prompts the user to select and install graphics drivers (Intel, NVIDIA, or skip).
|
||||
|
||||
# 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
|
||||
)
|
||||
# Driver package arrays are defined in config/drivers.conf.
|
||||
|
||||
# Prompt user for graphics driver selection and install
|
||||
prompt_install_graphics() {
|
||||
|
||||
@@ -17,47 +17,7 @@
|
||||
# xfce.sh - XFCE desktop environment installation
|
||||
#
|
||||
# Installs XFCE4 with LightDM and copies pre-configured user settings.
|
||||
|
||||
# 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
|
||||
)
|
||||
# XFCE_PACKAGES is defined in config/profiles.conf.
|
||||
|
||||
# Install XFCE base packages
|
||||
install_xfce_packages() {
|
||||
|
||||
@@ -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
|
||||
)
|
||||
@@ -16,152 +16,106 @@
|
||||
|
||||
# registry.sh - Profile registry and management
|
||||
#
|
||||
# Defines installation profiles that customize the system for different use cases.
|
||||
# Each profile specifies which packages to install and services to enable.
|
||||
# Provides functions to list, select, and install profiles.
|
||||
# Profile definitions are loaded from config/profiles.conf.
|
||||
# Adding a new profile requires only adding entries to the config file.
|
||||
|
||||
# Source shared package definitions
|
||||
source "${SCRIPT_DIR}/profiles/packages.sh"
|
||||
# Get profile key by menu number (1-based)
|
||||
# Arguments:
|
||||
# $1 - menu selection number
|
||||
# Outputs:
|
||||
# Profile key to stdout
|
||||
get_profile_key() {
|
||||
local index=$(($1 - 1))
|
||||
echo "${PROFILES[$index]}"
|
||||
}
|
||||
|
||||
# Profile definitions
|
||||
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
|
||||
# Display available profiles (auto-generated from PROFILES array)
|
||||
list_profiles() {
|
||||
print "Base install complete. Select profile to install for this system:"
|
||||
|
||||
for i in {1..7}; do
|
||||
print " $i - ${PROFILE_NAMES[$i]}"
|
||||
print " ${PROFILE_DESCRIPTIONS[$i]}"
|
||||
local i=1
|
||||
for profile in "${PROFILES[@]}"; do
|
||||
local name_var="PROFILE_${profile}_NAME"
|
||||
local desc_var="PROFILE_${profile}_DESC"
|
||||
print " $i - ${!name_var}"
|
||||
print " ${!desc_var}"
|
||||
((i++))
|
||||
done
|
||||
}
|
||||
|
||||
# Get packages for a profile
|
||||
# Arguments:
|
||||
# $1 - profile number
|
||||
# $1 - profile key
|
||||
# Outputs:
|
||||
# Package list to stdout
|
||||
get_profile_packages() {
|
||||
local profile="$1"
|
||||
|
||||
case "$profile" in
|
||||
"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
|
||||
local profile_key="$1"
|
||||
local pkg_var="PROFILE_${profile_key}_PACKAGES[@]"
|
||||
echo "${!pkg_var}"
|
||||
}
|
||||
|
||||
# Get services to enable for a profile
|
||||
# Get services for a profile
|
||||
# Arguments:
|
||||
# $1 - profile number
|
||||
# $1 - profile key
|
||||
# Outputs:
|
||||
# Service list to stdout
|
||||
get_profile_services() {
|
||||
local profile="$1"
|
||||
|
||||
case "$profile" in
|
||||
"2"|"7")
|
||||
echo "docker.service"
|
||||
;;
|
||||
esac
|
||||
local profile_key="$1"
|
||||
local svc_var="PROFILE_${profile_key}_SERVICES[@]"
|
||||
echo "${!svc_var}"
|
||||
}
|
||||
|
||||
# Check if profile requires XFCE
|
||||
# Arguments:
|
||||
# $1 - profile number
|
||||
# $1 - profile key
|
||||
# Returns:
|
||||
# 0 if requires XFCE, 1 otherwise
|
||||
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
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
# Validate profile selection
|
||||
# Arguments:
|
||||
# $1 - user selection
|
||||
# Returns:
|
||||
# 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
|
||||
# Arguments:
|
||||
# $1 - profile number
|
||||
# $1 - profile key
|
||||
# $2 - username
|
||||
install_profile() {
|
||||
local profile="$1"
|
||||
local profile_key="$1"
|
||||
local username="$2"
|
||||
local packages
|
||||
local services
|
||||
|
||||
# Install XFCE if required
|
||||
if profile_requires_xfce "$profile"; then
|
||||
if profile_requires_xfce "$profile_key"; then
|
||||
install_xfce "$username"
|
||||
prompt_install_graphics
|
||||
fi
|
||||
|
||||
# Get and install profile packages
|
||||
packages=$(get_profile_packages "$profile")
|
||||
packages=$(get_profile_packages "$profile_key")
|
||||
if [ -n "$packages" ]; then
|
||||
# shellcheck disable=SC2086
|
||||
chroot_pacman_install $packages
|
||||
fi
|
||||
|
||||
# Enable profile services
|
||||
services=$(get_profile_services "$profile")
|
||||
if [ -n "$services" ]; then
|
||||
# shellcheck disable=SC2086
|
||||
chroot_systemd_enable $services
|
||||
fi
|
||||
services=$(get_profile_services "$profile_key")
|
||||
for service in $services; do
|
||||
chroot_systemd_enable "$service"
|
||||
done
|
||||
}
|
||||
|
||||
# Prompt user for profile selection and install
|
||||
@@ -169,16 +123,18 @@ install_profile() {
|
||||
# $1 - username
|
||||
select_and_install_profile() {
|
||||
local username="$1"
|
||||
local profile
|
||||
local selection
|
||||
local profile_key
|
||||
|
||||
list_profiles
|
||||
read -r profile
|
||||
read -r selection
|
||||
|
||||
# Validate selection
|
||||
if ! [[ "$profile" =~ ^[1-7]$ ]]; then
|
||||
if ! validate_profile_selection "$selection"; then
|
||||
print_warning "Unknown profile, defaulting to minimal install."
|
||||
profile="1"
|
||||
selection="1"
|
||||
fi
|
||||
|
||||
install_profile "$profile" "$username"
|
||||
profile_key=$(get_profile_key "$selection")
|
||||
install_profile "$profile_key" "$username"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user