add symlink-from-home
Script will generate links to docker-sahred environment for use in volatile envrionment, like temporary debug servers
This commit is contained in:
parent
11576d2806
commit
356a690f51
2 changed files with 33 additions and 0 deletions
|
@ -0,0 +1 @@
|
||||||
|
../../../_home/private_dot_local/bin/executable_symlink-from-home.sh
|
|
@ -0,0 +1,32 @@
|
||||||
|
#! /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"
|
||||||
|
cd $SRC
|
||||||
|
(
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue