Recursive install script
This commit is contained in:
parent
fb86f77ff8
commit
20325870e2
34
install.sh
34
install.sh
|
@ -1,25 +1,23 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
PWD="$(pwd)"
|
PWD="$(pwd)"
|
||||||
|
|
||||||
#dotfiles from
|
#dir to
|
||||||
#~/.config
|
clone_dir() {
|
||||||
for f in config/*; do
|
local dir=${1:-home}
|
||||||
mkdir -p "$HOME/.$f"
|
local to=${2:-$HOME}
|
||||||
for d in $f/*; do
|
|
||||||
ln -sf "$PWD/$d" "$HOME/.$d"
|
mkdir -p "$to/.${dir#home}"
|
||||||
|
for f in $dir/*; do
|
||||||
|
if [ -d "$f" ]; then
|
||||||
|
clone_dir "$f" "$to"
|
||||||
|
elif [ -f "$f" ]; then
|
||||||
|
ln -sf '$PWD/$f' -> '$to/.${f#home/}'
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
done
|
}
|
||||||
|
|
||||||
#dotfiles from
|
for d in */; do
|
||||||
#~
|
clone_dir "${d%/}"
|
||||||
for f in home/*; do
|
|
||||||
ln -sf "$PWD/$f" "$HOME/.$(basename $f)"
|
|
||||||
done
|
|
||||||
|
|
||||||
#scripts
|
|
||||||
#~/.local/bin
|
|
||||||
mkdir -p "$HOME/.local/bin"
|
|
||||||
for f in local/bin/*; do
|
|
||||||
ln -sf "$PWD/$f" "$HOME/.$f"
|
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue