Files
Debian-Linux/Ricing/Windows-7-Theme/install-win7-theme.sh
T

56 lines
1.6 KiB
Bash

#!/usr/bin/env bash
# Downloads the "Windows 7 Theme" GTK theme + icon pack from
# https://scripts.gabesville.com/Gabesville/Debian-Linux (Ricing/Windows-7-Theme)
# and installs them into the correct dot-folders under $HOME
# Usage:
# chmod +x install-win7-theme.sh
# ./install-win7-theme.sh
set -euo pipefail
BASE_URL="https://scripts.gabesville.com/Gabesville/Debian-Linux/raw/branch/main/Ricing/Windows-7-Theme"
# filename -> destination dot-folder
declare -A PACKAGES=(
["Windows-7-theme.zip"]="$HOME/.themes"
["Windows-7-icons.zip"]="$HOME/.icons"
)
WORKDIR="$(mktemp -d)"
trap 'rm -rf "$WORKDIR"' EXIT
command -v unzip >/dev/null 2>&1 || { echo "unzip is required. Install it with: sudo apt install unzip" >&2; exit 1; }
command -v curl >/dev/null 2>&1 || { echo "curl is required. Install it with: sudo apt install curl" >&2; exit 1; }
for zipname in "${!PACKAGES[@]}"; do
dest="${PACKAGES[$zipname]}"
url="${BASE_URL}/${zipname}"
extract_dir="${WORKDIR}/${zipname%.zip}"
echo "==> Downloading ${zipname}..."
curl -fL --progress-bar -o "${WORKDIR}/${zipname}" "$url"
echo "==> Extracting ${zipname}..."
mkdir -p "$extract_dir"
unzip -q "${WORKDIR}/${zipname}" -d "$extract_dir"
mkdir -p "$dest"
src="$extract_dir"
echo "==> Installing into ${dest}..."
for item in "$src"/*; do
name="$(basename "$item")"
target="${dest}/${name}"
if [[ -e "$target" ]]; then
echo " - ${name} already exists in ${dest}, replacing..."
rm -rf "$target"
fi
mv "$item" "$target"
done
echo "==> ${zipname} installed to ${dest}"
echo
done
echo "Done"