2025-08-03 20:12:32 +00:00
|
|
|
#! /usr/bin/env sh
|
|
|
|
set -e
|
|
|
|
|
|
|
|
SCRIPT_DIR=${SCRIPT_DIR:-"$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )"}
|
|
|
|
|
|
|
|
SRC=${1:-$(cd $SCRIPT_DIR/../.. && pwd)}
|
|
|
|
printf 'SRC=%s\n' "$SRC"
|
2025-08-04 03:47:15 +00:00
|
|
|
[ "$SRC" = ":" ] || cd $SRC
|
2025-08-03 20:12:32 +00:00
|
|
|
(
|
|
|
|
cd "${2:-${HOME}}"
|
|
|
|
echo cleanup, phase 1...
|
|
|
|
find -P . -mindepth 1 -maxdepth 1 -type f \
|
|
|
|
-name '.zsh_history' -or \
|
|
|
|
-name '.gitconfig' -or \
|
|
|
|
-name '.bash_history' -or \
|
|
|
|
-name '.zsh_history' \
|
|
|
|
-print -delete
|
|
|
|
|
|
|
|
echo cleanup, phase 2...
|
|
|
|
find . -mindepth 1 -maxdepth 2 -type l -print -delete
|
|
|
|
mkdir -p .config
|
|
|
|
|
2025-08-04 03:47:15 +00:00
|
|
|
[ "$SRC" != ":" ] || exit 99
|
2025-08-03 20:12:32 +00:00
|
|
|
echo linking...
|
|
|
|
(
|
|
|
|
cd $SRC; (
|
|
|
|
find . -mindepth 1 -maxdepth 1 -not -path './.config' -not -path './Dockerfile'
|
|
|
|
find .config -mindepth 1 -maxdepth 1 -not -path '*/chezmoi' -not -path '*/zellij' -not -path '*/starship*'
|
|
|
|
)
|
|
|
|
) | xargs -rtI '{}' ln -sr $SRC'/{}' '{}' | true
|
|
|
|
)
|
|
|
|
echo done
|
|
|
|
|