1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-05 06:39:02 -08:00

avoid some forking

This commit is contained in:
Connor Olding 2013-07-09 15:10:54 -07:00
parent 5c26ac471e
commit b2feee5054

View file

@ -9,7 +9,7 @@ die() {
} }
dotless() { dotless() {
[[ "${1:0:1}" == "." ]] && echo -E "${1:1}" || echo -E "$1" [[ "${1:0:1}" == "." ]] && REPLY="${1:1}" || REPLY="$1"
} }
hardlink() { hardlink() {
@ -36,25 +36,28 @@ softlink() {
rc="$(readlink -f "$(dirname "$0")" )" rc="$(readlink -f "$(dirname "$0")" )"
cd $HOME cd $HOME
PATH="$PATH:$rc/sh" PATH="${PATH:?No existing PATH}:$rc/sh"
umask 027 umask 027
for f in .bashrc .zshrc shrc.zsh mingw.sh .vimrc .conkyrc .inputrc .screenrc .xinitrc; do for f in .bashrc .zshrc shrc.zsh mingw.sh .vimrc .conkyrc .inputrc .screenrc .xinitrc; do
r="$rc/home/$(dotless "$f")" dotless "$f"
r="$rc/home/$REPLY"
hardlink "$f" "$r" hardlink "$f" "$r"
done done
for d in sh .vim .mpv; do for d in sh .vim .mpv; do
r="$rc/$(dotless "$d")" dotless "$d"
r="$rc/$REPLY"
softlink "$d" "$r" softlink "$d" "$r"
done done
# FIXME: this loop is pretty inefficient for d in ssh config/menus; do
for r in $rc/ssh/* $rc/config/menus/*; do mkdir -p ".$d"
f=".${r#"$rc/"}" for r in $rc/$d/*; do
mkdir -p "$(dirname "$f")" f=".${r#"$rc/"}"
hardlink "$f" "$r" hardlink "$f" "$r"
done
done done
grep .bashrc .bash_profile >/dev/null 2>&1 \ grep .bashrc .bash_profile >/dev/null 2>&1 \