From 0a6281b54369889435fa97205aa55cccd2e3a121 Mon Sep 17 00:00:00 2001 From: alejandrogs73 Date: Mon, 28 Sep 2026 12:18:28 +0200 Subject: [PATCH] install.sh: quitar los enlaces a archivos borrados del repo Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01C5v1qWDwgkaVM5kjVHGGh8 --- README-en.md | 3 ++- README.md | 3 ++- install.sh | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README-en.md b/README-en.md index 97fcc6e..fdeb02d 100644 --- a/README-en.md +++ b/README-en.md @@ -34,7 +34,8 @@ for example) and repeated safely: 2. `suckless`: builds the programs and installs them in `/usr/local`. 3. `enlaces` (links): symlinks every file in `home/` into `~`. If a different file was already there, it is kept as `.bak`. Since they are symlinks, - editing `~/.bashrc` edits the repo. It also creates the user folders and + editing `~/.bashrc` edits the repo. Links to files deleted from the repo + are removed. It also creates the user folders and sets `~/.ssh` to 700. 4. `gtk`: builds the [Everforest GTK](https://github.com/Fausto-Korpsvart/Everforest-GTK-Theme) theme (green, dark, medium palette) in `~/.themes` from a pinned commit, diff --git a/README.md b/README.md index 54091e5..d8ae132 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,8 @@ Hace siete pasos, que también se pueden lanzar por separado 2. `suckless`: compila e instala los programas en `/usr/local`. 3. `enlaces`: enlaza cada archivo de `home/` en `~`. Si ya existía un archivo distinto, lo guarda como `.bak`. Como son enlaces, editar `~/.bashrc` es - editar el repo. También crea las carpetas del usuario y deja `~/.ssh` en + editar el repo. Los enlaces a archivos que se han borrado del repo se + quitan. También crea las carpetas del usuario y deja `~/.ssh` en 700. 4. `gtk`: compila el tema [Everforest GTK](https://github.com/Fausto-Korpsvart/Everforest-GTK-Theme) (verde, oscuro, paleta medium) en `~/.themes`, en una versión fija, y lo diff --git a/install.sh b/install.sh index 34cf6a5..6794881 100755 --- a/install.sh +++ b/install.sh @@ -104,6 +104,14 @@ enlaces() { done cd "$DIR" + # Los enlaces a archivos que ya no están en home/ (borrados del repo) + find "$HOME" -xdev -type l -lname "$DIR/home/*" ! -exec test -e {} \; -print | + while read -r l; do + rm "$l" + rmdir "$(dirname "$l")" 2>/dev/null || true + echo " ${l#"$HOME"/} (ya no está en el repo: quitado)" + done + # Las carpetas de home/.config/user-dirs.dirs (y la de las capturas) mkdir -p "$HOME/Documents" "$HOME/Downloads" "$HOME/Images/Screenshots" # ssh no quiere ~/.ssh accesible para otros