fix: Make the install script clone the repo instead of linking it and reflected changes into the updater
This commit is contained in:
parent
c51330c1c2
commit
38d2572e84
2 changed files with 102 additions and 79 deletions
|
|
@ -190,9 +190,13 @@ git_fetch_and_check() {
|
|||
|
||||
# ── Conflict detection ────────────────────────────────────────────────────────
|
||||
collect_changed_files() {
|
||||
# Files changed between old commit and new commit in the repo
|
||||
# Files changed inside the config/ stow package between old and new commit.
|
||||
# Strip the leading "config/" prefix so paths are relative to $HOME,
|
||||
# matching what stow creates as symlink targets.
|
||||
git -C "$DOTFILES_DIR" diff --name-only "${OLD_HASH}" "${NEW_HASH}" \
|
||||
| grep -v '^packages/' | grep -v '^\.' || true
|
||||
| grep '^config/' \
|
||||
| sed 's|^config/||' \
|
||||
|| true
|
||||
}
|
||||
|
||||
handle_conflicts() {
|
||||
|
|
@ -292,33 +296,17 @@ apply_git_update() {
|
|||
# ── Stow ─────────────────────────────────────────────────────────────────────
|
||||
apply_stow() {
|
||||
section "Stowing dotfiles"
|
||||
cd "$DOTFILES_DIR"
|
||||
|
||||
# Discover stow packages (top-level dirs, excluding hidden & packages/)
|
||||
local stow_pkgs=()
|
||||
while IFS= read -r d; do
|
||||
local name
|
||||
name=$(basename "$d")
|
||||
[[ $name == packages ]] && continue
|
||||
stow_pkgs+=("$name")
|
||||
done < <(find "$DOTFILES_DIR" -mindepth 1 -maxdepth 1 -type d ! -name '.*' | sort)
|
||||
|
||||
if (( ${#stow_pkgs[@]} == 0 )); then
|
||||
warn "No stow packages found in $DOTFILES_DIR"
|
||||
return
|
||||
local err_file; err_file=$(mktemp)
|
||||
if stow --dir="$STOW_DIR" --target="$STOW_TARGET" --restow "$STOW_PKG" 2>"$err_file"; then
|
||||
ok "stow: $STOW_PKG"
|
||||
else
|
||||
warn "stow: $STOW_PKG (errors below)"
|
||||
while IFS= read -r line; do
|
||||
echo " ${DIM}${line}${RESET}"
|
||||
done < "$err_file"
|
||||
fi
|
||||
|
||||
for pkg in "${stow_pkgs[@]}"; do
|
||||
if stow --restow --target="$STOW_TARGET" "$pkg" 2>/tmp/stow_err; then
|
||||
ok "stow: $pkg"
|
||||
else
|
||||
warn "stow: $pkg (see error below)"
|
||||
while IFS= read -r line; do
|
||||
echo " ${DIM}${line}${RESET}"
|
||||
done < /tmp/stow_err
|
||||
fi
|
||||
done
|
||||
rm -f /tmp/stow_err
|
||||
rm -f "$err_file"
|
||||
}
|
||||
|
||||
# ── Package management ────────────────────────────────────────────────────────
|
||||
|
|
@ -493,7 +481,8 @@ process_aur_group() {
|
|||
# ── Entry point ───────────────────────────────────────────────────────────────
|
||||
main() {
|
||||
echo
|
||||
echo "${BOLD} Hyprland Dotfiles Updater${RESET} ${DIM}(Arch Linux)${RESET}"
|
||||
echo "${BOLD} Atlas Desktop Updater${RESET}"
|
||||
echo "${DIM} Arch Linux${RESET}"
|
||||
echo " ${DIM}Target: ${DOTFILES_DIR}${RESET}"
|
||||
|
||||
[[ -d $DOTFILES_DIR/.git ]] || die "$DOTFILES_DIR is not a git repository."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue