aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/copy_menu.sh6
-rw-r--r--scripts/lib_apps.sh52
-rw-r--r--scripts/lib_backup.sh14
-rw-r--r--scripts/lib_copy.sh94
-rw-r--r--scripts/lib_detect.sh6
-rw-r--r--scripts/lib_prompts.sh6
-rw-r--r--scripts/lib_update.sh6
7 files changed, 143 insertions, 41 deletions
diff --git a/scripts/copy_menu.sh b/scripts/copy_menu.sh
index 87f9301f..47843205 100755
--- a/scripts/copy_menu.sh
+++ b/scripts/copy_menu.sh
@@ -1,4 +1,10 @@
#!/usr/bin/env bash
+# ==================================================
+# KoolDots (2026)
+# Project URL: https://github.com/LinuxBeginnings
+# License: GNU GPLv3
+# SPDX-License-Identifier: GPL-3.0-or-later
+# ==================================================
# show_copy_menu
# Arguments:
diff --git a/scripts/lib_apps.sh b/scripts/lib_apps.sh
index f19fd75a..9472831d 100644
--- a/scripts/lib_apps.sh
+++ b/scripts/lib_apps.sh
@@ -1,4 +1,10 @@
#!/usr/bin/env bash
+# ==================================================
+# KoolDots (2026)
+# Project URL: https://github.com/LinuxBeginnings
+# License: GNU GPLv3
+# SPDX-License-Identifier: GPL-3.0-or-later
+# ==================================================
# App enablement and editor selection helpers.
enable_asusctl() {
@@ -67,10 +73,18 @@ install_terminal_configs() {
local base="${DOTFILES_DIR:-.}"
# Ghostty
- local GHOSTTY_SRC="$base/config/ghostty/ghostty.config"
+ local GHOSTTY_SRC="$base/config/ghostty/config"
local GHOSTTY_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/ghostty"
local GHOSTTY_DEST="$GHOSTTY_DIR/config"
if [ -f "$GHOSTTY_SRC" ]; then
+ if [ -d "$GHOSTTY_DIR" ]; then
+ BACKUP_DIR=$(get_backup_dirname)
+ local GHOSTTY_BACKUP="$GHOSTTY_DIR-backup-$BACKUP_DIR"
+ if [ ! -d "$GHOSTTY_BACKUP" ]; then
+ cp -a "$GHOSTTY_DIR" "$GHOSTTY_BACKUP" 2>&1 | tee -a "$log"
+ echo "${NOTE:-[NOTE]} - Backed up Ghostty config to $GHOSTTY_BACKUP." 2>&1 | tee -a "$log"
+ fi
+ fi
mkdir -p "$GHOSTTY_DIR"
install -m 0644 "$GHOSTTY_SRC" "$GHOSTTY_DEST" 2>&1 | tee -a "$log"
if [ -f "$GHOSTTY_DIR/wallust.conf" ]; then
@@ -140,14 +154,32 @@ install_waybar_weather_binary() {
return 0
fi
+ # Sudo handling for /usr/bin and /usr/local/bin
+ local SUDO=""
+ if [[ $EUID -ne 0 ]]; then
+ if command -v sudo >/dev/null 2>&1; then
+ SUDO="sudo"
+ else
+ _err "sudo not available; cannot write to ${INSTALL_PATH} as non-root"
+ return 1
+ fi
+ fi
+
if grep -qi '^ID=arch' /etc/os-release 2>/dev/null; then
- if command -v pacman >/dev/null 2>&1 && pacman -Qi weather-waybar >/dev/null 2>&1; then
- _log "weather-waybar already installed via pacman."
+ if command -v pacman >/dev/null 2>&1 && pacman -Qi waybar-weather >/dev/null 2>&1; then
+ _log "waybar-weather already installed via pacman."
return 0
fi
+
+ # If no package is installed but a static binary exists, remove it before AUR install
+ if [ -x /usr/bin/waybar-weather ] || [ -x /usr/local/bin/waybar-weather ]; then
+ _log "Removing waybar-weather static binary"
+ ${SUDO} rm -f /usr/bin/waybar-weather /usr/local/bin/waybar-weather || _warn "Failed to remove existing waybar-weather binary."
+ fi
+
if command -v yay >/dev/null 2>&1; then
- _log "Attempting to install AUR package 'weather-waybar' via yay"
- if yay -S --noconfirm weather-waybar; then
+ _log "Attempting to install AUR package 'waybar-weather' via yay"
+ if yay -S --noconfirm waybar-weather; then
_log "AUR install succeeded."
return 0
else
@@ -168,16 +200,6 @@ install_waybar_weather_binary() {
return 1
fi
- # Sudo handling for /usr/bin
- local SUDO=""
- if [[ $EUID -ne 0 ]]; then
- if command -v sudo >/dev/null 2>&1; then
- SUDO="sudo"
- else
- _err "sudo not available; cannot write to ${INSTALL_PATH} as non-root"
- return 1
- fi
- fi
_log "Installing prebuilt binary to ${INSTALL_PATH} from ${ASSET}"
if ${SUDO} sh -c "tmp=\$(mktemp '${INSTALL_PATH}.XXXXXX') && gzip -dc '$ASSET' > \"\$tmp\" && chmod 0755 \"\$tmp\" && mv -f \"\$tmp\" '${INSTALL_PATH}'"; then
diff --git a/scripts/lib_backup.sh b/scripts/lib_backup.sh
index 6867fb6d..b6f54f6a 100644
--- a/scripts/lib_backup.sh
+++ b/scripts/lib_backup.sh
@@ -1,9 +1,21 @@
#!/usr/bin/env bash
+# ==================================================
+# KoolDots (2026)
+# Project URL: https://github.com/LinuxBeginnings
+# License: GNU GPLv3
+# SPDX-License-Identifier: GPL-3.0-or-later
+# ==================================================
# Backup helper utilities shared by copy.sh (and future scripts).
# Create a unique backup directory name with month, day, hours, and minutes.
get_backup_dirname() {
- echo "back-up_$(date +"%m%d_%H%M")"
+ if [ -n "${BACKUP_DIR:-}" ]; then
+ echo "$BACKUP_DIR"
+ return
+ fi
+ BACKUP_DIR="back-up_$(date +"%m%d_%H%M")"
+ export BACKUP_DIR
+ echo "$BACKUP_DIR"
}
# Move a directory to a timestamped backup alongside the original.
diff --git a/scripts/lib_copy.sh b/scripts/lib_copy.sh
index 58fbe066..f6d4cdd2 100644
--- a/scripts/lib_copy.sh
+++ b/scripts/lib_copy.sh
@@ -1,4 +1,10 @@
#!/usr/bin/env bash
+# ==================================================
+# KoolDots (2026)
+# Project URL: https://github.com/LinuxBeginnings
+# License: GNU GPLv3
+# SPDX-License-Identifier: GPL-3.0-or-later
+# ==================================================
# Copy helpers split into phases to keep copy.sh lean.
copy_phase1() {
@@ -216,15 +222,15 @@ cleanup_duplicate_userconfigs() {
return
fi
- # Run de-dupe only for existing installs up to and including v2.3.19.
- # For v2.3.20 and newer, the underlying duplication bug is fixed and
- # this cleanup is no longer needed (and might mask future issues).
- if version_gte "$current_version" "2.3.20"; then
- echo "${INFO:-[INFO]} Skipping UserConfigs duplicate cleanup for detected version v$current_version (>= 2.3.20)." 2>&1 | tee -a "$log"
+ # Run de-dupe only for existing installs up to and including v2.3.18.
+ # For v2.3.19 and newer, UserConfigs should be left as-is to avoid
+ # removing user modifications.
+ if version_gte "$current_version" "2.3.19"; then
+ echo "${INFO:-[INFO]} Skipping UserConfigs duplicate cleanup for detected version v$current_version (>= 2.3.19)." 2>&1 | tee -a "$log"
return
fi
- echo "${INFO:-[INFO]} Running UserConfigs duplicate cleanup for detected version v$current_version (<= 2.3.19)." 2>&1 | tee -a "$log"
+ echo "${INFO:-[INFO]} Running UserConfigs duplicate cleanup for detected version v$current_version (<= 2.3.18)." 2>&1 | tee -a "$log"
local HYPR_DIR="$HOME/.config/hypr"
local BASE_DIR="$HYPR_DIR/configs"
@@ -342,6 +348,9 @@ restore_user_configs() {
local log="$1"
local express_mode="$2"
local old_version="$3"
+ if [ "${RUN_MODE:-}" = "install" ]; then
+ return
+ fi
local DIRPATH="$HOME/.config/hypr"
local BACKUP_DIR
@@ -353,15 +362,7 @@ restore_user_configs() {
exit 1
fi
- # In express mode we still want to run the de-dupe logic, but we skip
- # the interactive restoration prompts so the workflow stays non-blocking.
- local SKIP_RESTORE_PROMPTS=0
- if [ -d "$BACKUP_DIR_PATH" ] && [ "$express_mode" -eq 1 ]; then
- echo "${NOTE:-[NOTE]} Express mode: skipping UserConfigs restoration prompts." 2>&1 | tee -a "$log"
- SKIP_RESTORE_PROMPTS=1
- fi
-
- if [ -d "$BACKUP_DIR_PATH" ] && [ "$SKIP_RESTORE_PROMPTS" -eq 0 ]; then
+ if [ -d "$BACKUP_DIR_PATH" ]; then
local VERSION_FILE
VERSION_FILE=$(find "$DIRPATH" -maxdepth 1 -name "v*.*.*" | head -n 1)
local CURRENT_VERSION="999.9.9"
@@ -370,6 +371,10 @@ restore_user_configs() {
fi
local TARGET_VERSION="2.3.19"
+ local AUTO_RESTORE=0
+ if version_gte "$CURRENT_VERSION" "2.3.18"; then
+ AUTO_RESTORE=1
+ fi
echo -e "${NOTE:-[NOTE]} Restoring previous ${MAGENTA:-}User-Configs${RESET:-}... " 2>&1 | tee -a "$log"
printf "${WARNING:-}\\
@@ -382,13 +387,19 @@ restore_user_configs() {
" >&2
if version_gte "$CURRENT_VERSION" "$TARGET_VERSION"; then
- read -r -p "${CAT:-[ACTION]} Do you want to restore your previous UserConfigs directory? (Y/n): " restore_userconfigs_dir
- if [[ "$restore_userconfigs_dir" != [Nn]* ]]; then
- echo "${NOTE:-[NOTE]} Restoring UserConfigs directory..." 2>&1 | tee -a "$log"
+ if [ "$express_mode" -eq 1 ] || [ "$AUTO_RESTORE" -eq 1 ]; then
+ echo "${NOTE:-[NOTE]} Restoring UserConfigs directory automatically." 2>&1 | tee -a "$log"
rsync -a "$BACKUP_DIR_PATH/" "$DIRPATH/UserConfigs/" 2>&1 | tee -a "$log"
echo "${OK:-[OK]} - UserConfigs directory restored." 2>&1 | tee -a "$log"
else
- echo "${NOTE:-[NOTE]} - Skipped restoring UserConfigs." 2>&1 | tee -a "$log"
+ read -r -p "${CAT:-[ACTION]} Do you want to restore your previous UserConfigs directory? (Y/n): " restore_userconfigs_dir
+ if [[ "$restore_userconfigs_dir" != [Nn]* ]]; then
+ echo "${NOTE:-[NOTE]} Restoring UserConfigs directory..." 2>&1 | tee -a "$log"
+ rsync -a "$BACKUP_DIR_PATH/" "$DIRPATH/UserConfigs/" 2>&1 | tee -a "$log"
+ echo "${OK:-[OK]} - UserConfigs directory restored." 2>&1 | tee -a "$log"
+ else
+ echo "${NOTE:-[NOTE]} - Skipped restoring UserConfigs." 2>&1 | tee -a "$log"
+ fi
fi
else
echo -e "${NOTE:-[NOTE]} Detected version ${YELLOW:-}v$CURRENT_VERSION${RESET:-} (older than v$TARGET_VERSION). Using legacy restoration mode." 2>&1 | tee -a "$log"
@@ -419,18 +430,25 @@ restore_user_configs() {
echo "${OK:-[OK]} - Migrated overlay for ${YELLOW:-}$FILE_NAME${RESET:-}" 2>&1 | tee -a "$log"
continue
fi
-
- printf "\n${INFO:-[INFO]} Found ${YELLOW:-}$FILE_NAME${RESET:-} in hypr backup...\n"
- read -r -p "${CAT:-[ACTION]} Do you want to restore ${YELLOW:-}$FILE_NAME${RESET:-} from backup? (Y/n): " file_restore
-
- if [[ "$file_restore" != [Nn]* ]]; then
+ if [ "$express_mode" -eq 1 ] || [ "$AUTO_RESTORE" -eq 1 ]; then
if cp "$BACKUP_FILE" "$DIRPATH/UserConfigs/$FILE_NAME"; then
echo "${OK:-[OK]} - $FILE_NAME restored!" 2>&1 | tee -a "$log"
else
echo "${ERROR:-[ERROR]} - Failed to restore $FILE_NAME!" 2>&1 | tee -a "$log"
fi
else
- echo "${NOTE:-[NOTE]} - Skipped restoring $FILE_NAME." 2>&1 | tee -a "$log"
+ printf "\n${INFO:-[INFO]} Found ${YELLOW:-}$FILE_NAME${RESET:-} in hypr backup...\n"
+ read -r -p "${CAT:-[ACTION]} Do you want to restore ${YELLOW:-}$FILE_NAME${RESET:-} from backup? (Y/n): " file_restore
+
+ if [[ "$file_restore" != [Nn]* ]]; then
+ if cp "$BACKUP_FILE" "$DIRPATH/UserConfigs/$FILE_NAME"; then
+ echo "${OK:-[OK]} - $FILE_NAME restored!" 2>&1 | tee -a "$log"
+ else
+ echo "${ERROR:-[ERROR]} - Failed to restore $FILE_NAME!" 2>&1 | tee -a "$log"
+ fi
+ else
+ echo "${NOTE:-[NOTE]} - Skipped restoring $FILE_NAME." 2>&1 | tee -a "$log"
+ fi
fi
fi
done
@@ -489,6 +507,32 @@ restore_user_scripts() {
fi
}
+restore_terminal_configs() {
+ local log="$1"
+ local express_mode="$2"
+
+ local GHOSTTY_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/ghostty"
+ local BACKUP_DIR
+ BACKUP_DIR=$(get_backup_dirname)
+ local GHOSTTY_BACKUP="$GHOSTTY_DIR-backup-$BACKUP_DIR"
+
+ if [ -d "$GHOSTTY_BACKUP" ] && [ "$express_mode" -eq 1 ]; then
+ echo "${NOTE:-[NOTE]} Express mode: skipping Ghostty restore prompt." 2>&1 | tee -a "$log"
+ return
+ fi
+
+ if [ -d "$GHOSTTY_BACKUP" ] && [ "$express_mode" -eq 0 ]; then
+ echo -e "${NOTE:-[NOTE]} Restore previous ${MAGENTA:-}Ghostty${RESET:-} config?" 2>&1 | tee -a "$log"
+ read -r -p "${CAT:-[ACTION]} Do you want to restore Ghostty config from backup? (y/N): " restore_ghostty
+ if [[ "$restore_ghostty" == [Yy]* ]]; then
+ rm -rf "$GHOSTTY_DIR"
+ cp -a "$GHOSTTY_BACKUP" "$GHOSTTY_DIR" 2>&1 | tee -a "$log"
+ echo "${OK:-[OK]} - Ghostty config restored." 2>&1 | tee -a "$log"
+ else
+ echo "${NOTE:-[NOTE]} - Skipped restoring Ghostty config." 2>&1 | tee -a "$log"
+ fi
+ fi
+}
restore_hypr_files() {
local log="$1"
local express_mode="$2"
diff --git a/scripts/lib_detect.sh b/scripts/lib_detect.sh
index 5cb26c1b..2b11baac 100644
--- a/scripts/lib_detect.sh
+++ b/scripts/lib_detect.sh
@@ -1,4 +1,10 @@
#!/usr/bin/env bash
+# ==================================================
+# KoolDots (2026)
+# Project URL: https://github.com/LinuxBeginnings
+# License: GNU GPLv3
+# SPDX-License-Identifier: GPL-3.0-or-later
+# ==================================================
# Detection and environment adjustment helpers shared by copy.sh.
# Nvidia tweaks: uncomments envs and adjusts hardware cursor setting.
diff --git a/scripts/lib_prompts.sh b/scripts/lib_prompts.sh
index 6475e54d..8f2db3bc 100644
--- a/scripts/lib_prompts.sh
+++ b/scripts/lib_prompts.sh
@@ -1,4 +1,10 @@
#!/usr/bin/env bash
+# ==================================================
+# KoolDots (2026)
+# Project URL: https://github.com/LinuxBeginnings
+# License: GNU GPLv3
+# SPDX-License-Identifier: GPL-3.0-or-later
+# ==================================================
# User interaction helpers extracted from copy.sh. Each helper echoes state or sets
# globals deliberately to minimize side effects.
diff --git a/scripts/lib_update.sh b/scripts/lib_update.sh
index be0b8a0a..397e7728 100644
--- a/scripts/lib_update.sh
+++ b/scripts/lib_update.sh
@@ -1,4 +1,10 @@
#!/usr/bin/env bash
+# ==================================================
+# KoolDots (2026)
+# Project URL: https://github.com/LinuxBeginnings
+# License: GNU GPLv3
+# SPDX-License-Identifier: GPL-3.0-or-later
+# ==================================================
# run_repo_update
# Arguments:
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage