refactor(packages): optimize package installation logic to check for existing packages

refactor(shell): enhance TTY keyboard layout setup with existing keymap check
refactor(browsers): improve browser installation script to avoid reinstalling existing packages
refactor(devtools): streamline development tools installation by checking for already installed packages
This commit is contained in:
Martin Büchler 2025-08-14 22:53:52 +02:00
parent 88f7edf1a6
commit 088a46cced
4 changed files with 46 additions and 7 deletions

View File

@ -26,4 +26,16 @@ PACKAGES=(
# Add more packages here # Add more packages here
) )
paru -S --needed --noconfirm "${PACKAGES[@]}" to_install=()
for pkg in "${PACKAGES[@]}"; do
if ! paru -Q "$pkg" &>/dev/null; then
to_install+=("$pkg")
fi
done
if [ "${#to_install[@]}" -gt 0 ]; then
paru -S --noconfirm "${to_install[@]}"
else
echo "All packages already installed."
fi

View File

@ -7,7 +7,12 @@ fi
# Set German nodeadkeys layout for TTY/console # Set German nodeadkeys layout for TTY/console
if command -v localectl >/dev/null 2>&1; then if command -v localectl >/dev/null 2>&1; then
echo "Setting TTY keyboard layout to de-latin1-nodeadkeys..." current_keymap=$(localectl status | awk -F': ' '/VC Keymap/ {print $2}' | xargs)
sudo localectl set-keymap de-latin1-nodeadkeys if [ "$current_keymap" != "de-latin1-nodeadkeys" ]; then
echo "Setting TTY keyboard layout to de-latin1-nodeadkeys..."
sudo localectl set-keymap de-latin1-nodeadkeys
else
echo "TTY keyboard layout already set to de-latin1-nodeadkeys."
fi
fi fi

View File

@ -8,6 +8,17 @@ BROWSERS=(google-chrome firefox brave-bin)
# Install browsers with paru (AUR helper) # Install browsers with paru (AUR helper)
echo "Installing browsers: ${BROWSERS[*]}" echo "Installing browsers: ${BROWSERS[*]}"
paru -S --needed --noconfirm "${BROWSERS[@]}" to_install=()
for pkg in "${BROWSERS[@]}"; do
if ! paru -Q "$pkg" &>/dev/null; then
to_install+=("$pkg")
fi
echo "Browsers installed." done
if [ "${#to_install[@]}" -gt 0 ]; then
paru -S --noconfirm "${to_install[@]}"
echo "Browsers installed."
else
echo "All browsers already installed."
fi

View File

@ -17,6 +17,17 @@ DEVTOOLS_PACKAGES=(
opencode opencode
) )
paru -S --needed --noconfirm "${DEVTOOLS_PACKAGES[@]}" to_install=()
for pkg in "${DEVTOOLS_PACKAGES[@]}"; do
if ! paru -Q "$pkg" &>/dev/null; then
to_install+=("$pkg")
fi
echo "Development tools installed." done
if [ "${#to_install[@]}" -gt 0 ]; then
paru -S --noconfirm "${to_install[@]}"
echo "Development tools installed."
else
echo "All development tools already installed."
fi