Merge pull request from mightbesatvik/install-scripts
feat: add install-apps.sh for per-distro app installation
This commit is contained in:
23
README.md
23
README.md
@@ -627,6 +627,26 @@ pip install haishoku
|
||||
|
||||
Quick setup instructions:
|
||||
|
||||
### Option A — Automated install (recommended)
|
||||
|
||||
1. Clone the repo
|
||||
```bash
|
||||
git clone https://github.com/SeraphimeZelel/rion-ricing.git ~/.rion-dotfiles
|
||||
cd ~/.rion-dotfiles
|
||||
```
|
||||
2. Run the combined installer
|
||||
```bash
|
||||
./install.sh
|
||||
```
|
||||
- Installs required applications for GNOME rice
|
||||
- Creates symbolic links for configs into `~/.config`
|
||||
- Links scripts from `.script/` into `~/.local/bin` and makes them executable
|
||||
- Backs up existing configs/scripts into a timestamped folder in your home
|
||||
|
||||
> Note: If you only want to install applications, run `./install-apps.sh`.
|
||||
|
||||
### Option B — Manual steps
|
||||
|
||||
1. **Clone the repo**
|
||||
```bash
|
||||
git clone https://github.com/SeraphimeZelel/rion-ricing.git ~/.rion-dotfiles
|
||||
@@ -668,6 +688,9 @@ Quick setup instructions:
|
||||
chmod +x ~/.local/bin/*
|
||||
```
|
||||
|
||||
> Don’t forget to install GNOME extensions manually from https://extensions.gnome.org:
|
||||
> Forge, Blur My Shell, Just Perfection, Open Bar, Quick Settings Tweaks.
|
||||
|
||||
## 📝 Notes
|
||||
|
||||
If `wallpaper-picker.sh` fails to set your wallpaper, try renaming the file with the prefix `Anything_`.
|
||||
|
||||
184
install-apps.sh
Executable file
184
install-apps.sh
Executable file
@@ -0,0 +1,184 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -u
|
||||
|
||||
# Simple logging helpers
|
||||
bold="\033[1m"
|
||||
green="\033[32m"
|
||||
yellow="\033[33m"
|
||||
red="\033[31m"
|
||||
reset="\033[0m"
|
||||
|
||||
info() { echo -e "${bold}[*]${reset} $1"; }
|
||||
ok() { echo -e "${green}[✓]${reset} $1"; }
|
||||
warn() { echo -e "${yellow}[!]${reset} $1"; }
|
||||
err() { echo -e "${red}[x]${reset} $1"; }
|
||||
|
||||
require_file() {
|
||||
if [[ ! -f "$1" ]]; then
|
||||
err "Required file '$1' not found. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
detect_distro() {
|
||||
require_file "/etc/os-release"
|
||||
# shellcheck disable=SC1091
|
||||
. /etc/os-release
|
||||
local id like
|
||||
id="${ID:-}"
|
||||
like="${ID_LIKE:-}"
|
||||
id="${id,,}"
|
||||
like="${like,,}"
|
||||
|
||||
if [[ "$id" == "arch" || "$like" == *"arch"* ]]; then
|
||||
echo "arch"
|
||||
elif [[ "$id" == "fedora" || "$like" == *"fedora"* ]]; then
|
||||
echo "fedora"
|
||||
elif [[ "$id" == "ubuntu" || "$id" == "debian" || "$like" == *"debian"* || "$like" == *"ubuntu"* ]]; then
|
||||
echo "debian"
|
||||
else
|
||||
echo "unsupported"
|
||||
fi
|
||||
}
|
||||
|
||||
install_arch() {
|
||||
info "Updating package database (pacman)..."
|
||||
sudo pacman -Syu --noconfirm | cat
|
||||
local packages=(
|
||||
jq
|
||||
imagemagick
|
||||
python-pywal
|
||||
wezterm
|
||||
cava
|
||||
btop
|
||||
fastfetch
|
||||
wlogout
|
||||
nautilus
|
||||
gnome-tweaks
|
||||
gnome-shell-extensions
|
||||
)
|
||||
local failed=()
|
||||
info "Installing packages with pacman..."
|
||||
for pkg in "${packages[@]}"; do
|
||||
info "Installing $pkg..."
|
||||
if sudo pacman -S --needed --noconfirm "$pkg" | cat; then
|
||||
ok "$pkg installed"
|
||||
else
|
||||
warn "Failed to install $pkg"
|
||||
failed+=("$pkg")
|
||||
fi
|
||||
done
|
||||
if (( ${#failed[@]} > 0 )); then
|
||||
warn "Some packages failed on Arch: ${failed[*]}"
|
||||
fi
|
||||
}
|
||||
|
||||
install_fedora() {
|
||||
info "Updating packages (dnf)..."
|
||||
sudo dnf -y upgrade --refresh | cat
|
||||
local packages=(
|
||||
jq
|
||||
ImageMagick
|
||||
python3-pywal
|
||||
wezterm
|
||||
cava
|
||||
btop
|
||||
fastfetch
|
||||
wlogout
|
||||
nautilus
|
||||
gnome-tweaks
|
||||
gnome-shell-extensions
|
||||
)
|
||||
local failed=()
|
||||
info "Installing packages with dnf..."
|
||||
for pkg in "${packages[@]}"; do
|
||||
info "Installing $pkg..."
|
||||
if sudo dnf -y install "$pkg" | cat; then
|
||||
ok "$pkg installed"
|
||||
else
|
||||
warn "Failed to install $pkg"
|
||||
failed+=("$pkg")
|
||||
# Helpful hint for common cases
|
||||
if [[ "$pkg" == "wezterm" ]]; then
|
||||
warn "WezTerm may require COPR: sudo dnf copr enable wezfurlong/wezterm -y && sudo dnf install wezterm -y"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if (( ${#failed[@]} > 0 )); then
|
||||
warn "Some packages failed on Fedora: ${failed[*]}"
|
||||
fi
|
||||
}
|
||||
|
||||
install_debian() {
|
||||
info "Updating package lists (apt)..."
|
||||
sudo apt-get update -y | cat
|
||||
info "Upgrading installed packages (apt)..."
|
||||
sudo apt-get upgrade -y | cat
|
||||
local packages=(
|
||||
jq
|
||||
imagemagick
|
||||
python3-pywal
|
||||
wezterm
|
||||
cava
|
||||
btop
|
||||
fastfetch
|
||||
wlogout
|
||||
nautilus
|
||||
gnome-tweaks
|
||||
gnome-shell-extensions
|
||||
)
|
||||
local failed=()
|
||||
info "Installing packages with apt..."
|
||||
for pkg in "${packages[@]}"; do
|
||||
info "Installing $pkg..."
|
||||
if sudo apt-get install -y "$pkg" | cat; then
|
||||
ok "$pkg installed"
|
||||
else
|
||||
warn "Failed to install $pkg"
|
||||
failed+=("$pkg")
|
||||
if [[ "$pkg" == "wezterm" ]]; then
|
||||
warn "WezTerm may not be in your Ubuntu/Debian repo. Install the .deb from the official releases."
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if (( ${#failed[@]} > 0 )); then
|
||||
warn "Some packages failed on Ubuntu/Debian: ${failed[*]}"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
info "Detecting Linux distribution..."
|
||||
distro="$(detect_distro)"
|
||||
case "$distro" in
|
||||
arch)
|
||||
ok "Detected Arch Linux"
|
||||
install_arch
|
||||
;;
|
||||
fedora)
|
||||
ok "Detected Fedora"
|
||||
install_fedora
|
||||
;;
|
||||
debian)
|
||||
ok "Detected Ubuntu/Debian"
|
||||
install_debian
|
||||
;;
|
||||
*)
|
||||
err "Unsupported Linux distribution. Exiting."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo
|
||||
info "Manual step required: GNOME Extensions"
|
||||
echo -e "Install these extensions manually from ${bold}https://extensions.gnome.org${reset}:"
|
||||
echo "- Forge"
|
||||
echo "- Blur My Shell"
|
||||
echo "- Just Perfection"
|
||||
echo "- Open Bar"
|
||||
echo "- Quick Settings Tweaks"
|
||||
echo
|
||||
ok "All steps completed."
|
||||
}
|
||||
|
||||
main "$@"
|
||||
122
install.sh
Executable file
122
install.sh
Executable file
@@ -0,0 +1,122 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
bold="\033[1m"
|
||||
green="\033[32m"
|
||||
yellow="\033[33m"
|
||||
red="\033[31m"
|
||||
reset="\033[0m"
|
||||
|
||||
info() { echo -e "${bold}[*]${reset} $1"; }
|
||||
ok() { echo -e "${green}[✓]${reset} $1"; }
|
||||
warn() { echo -e "${yellow}[!]${reset} $1"; }
|
||||
err() { echo -e "${red}[x]${reset} $1"; }
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
DOTFILES_DIR="$SCRIPT_DIR"
|
||||
CONFIG_SRC="$DOTFILES_DIR/.config"
|
||||
SCRIPTS_SRC="$DOTFILES_DIR/.script"
|
||||
CONFIG_DST="$HOME/.config"
|
||||
BIN_DST="$HOME/.local/bin"
|
||||
BACKUP_ROOT="$HOME/.dotfiles-backup-$(date +%Y%m%d_%H%M%S)"
|
||||
|
||||
ensure_dirs() {
|
||||
mkdir -p "$CONFIG_DST" "$BIN_DST" "$BACKUP_ROOT"
|
||||
}
|
||||
|
||||
backup_path() {
|
||||
local path="$1"
|
||||
local base
|
||||
base="$(basename "$path")"
|
||||
echo "$BACKUP_ROOT/$base"
|
||||
}
|
||||
|
||||
link_config_items() {
|
||||
if [[ ! -d "$CONFIG_SRC" ]]; then
|
||||
warn "No .config directory found in repo; skipping config linking."
|
||||
return
|
||||
fi
|
||||
|
||||
info "Linking config directories from $CONFIG_SRC to $CONFIG_DST"
|
||||
shopt -s nullglob dotglob
|
||||
for item in "$CONFIG_SRC"/*; do
|
||||
local name
|
||||
name="$(basename "$item")"
|
||||
local target="$CONFIG_DST/$name"
|
||||
|
||||
if [[ -e "$target" || -L "$target" ]]; then
|
||||
local backup
|
||||
backup="$(backup_path "$target")"
|
||||
info "Backing up $target → $backup"
|
||||
mv "$target" "$backup"
|
||||
fi
|
||||
|
||||
info "Linking $item → $target"
|
||||
ln -s "$item" "$target"
|
||||
done
|
||||
ok "Configs linked. Backup at $BACKUP_ROOT"
|
||||
}
|
||||
|
||||
link_script_items() {
|
||||
if [[ ! -d "$SCRIPTS_SRC" ]]; then
|
||||
warn "No .script directory found in repo; skipping script linking."
|
||||
return
|
||||
fi
|
||||
|
||||
info "Linking scripts from $SCRIPTS_SRC to $BIN_DST"
|
||||
shopt -s nullglob
|
||||
for file in "$SCRIPTS_SRC"/*; do
|
||||
[[ -f "$file" ]] || continue
|
||||
local name
|
||||
name="$(basename "$file")"
|
||||
local target="$BIN_DST/$name"
|
||||
|
||||
if [[ -e "$target" || -L "$target" ]]; then
|
||||
local backup
|
||||
backup="$(backup_path "$target")"
|
||||
info "Backing up $target → $backup"
|
||||
mv "$target" "$backup"
|
||||
fi
|
||||
|
||||
chmod +x "$file" || true
|
||||
info "Linking $file → $target"
|
||||
ln -s "$file" "$target"
|
||||
done
|
||||
ok "Scripts linked. Backup at $BACKUP_ROOT"
|
||||
}
|
||||
|
||||
run_app_install() {
|
||||
if [[ -x "$SCRIPT_DIR/install-apps.sh" ]]; then
|
||||
info "Running application installer..."
|
||||
"$SCRIPT_DIR/install-apps.sh"
|
||||
else
|
||||
warn "install-apps.sh not found or not executable. Skipping package installation."
|
||||
fi
|
||||
}
|
||||
|
||||
post_notes() {
|
||||
echo
|
||||
info "Manual step required: GNOME Extensions"
|
||||
echo -e "Install these extensions manually from ${bold}https://extensions.gnome.org${reset}:"
|
||||
echo "- Forge"
|
||||
echo "- Blur My Shell"
|
||||
echo "- Just Perfection"
|
||||
echo "- Open Bar"
|
||||
echo "- Quick Settings Tweaks"
|
||||
echo
|
||||
}
|
||||
|
||||
main() {
|
||||
info "Starting combined installer"
|
||||
ensure_dirs
|
||||
run_app_install
|
||||
link_config_items
|
||||
link_script_items
|
||||
ok "All tasks completed. Backup directory: $BACKUP_ROOT"
|
||||
post_notes
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user