yage
6333a2f6b8
===================================================================== --- New Scripts -------------------------- zsh ) vundle-vim helpers - vim/vundle/edit-build-actions - vim/vundle/install - vim/vundle/rebuild quick install-from-source scripts - git/package/install - git/package/build (install --only-build) - git/package/download (install --only-pull) - git/package/update (install --update) config sym-linker (for source-controlled .configs) - config/update (symlinks + terminfo) - config/symlinks (set all symlinks from settings) - config/settings (edit settings which aren't scwrypts env variables) - config/terminfo (load all terminfo from settings) --- Changes ------------------------------ - helper comments are now inserted in all env files - removed underscore prefix for standard AWS environment variables - added "opening" and "finished editing" comments to __EDIT util - added __USAGE to format $USAGE variable to std:err - added __ERROR_CHECK to exit if any __ERROR(s) were called
37 lines
1.1 KiB
Bash
Executable File
37 lines
1.1 KiB
Bash
Executable File
#!/bin/zsh
|
|
_DEPENDENCIES+=()
|
|
_REQUIRED_ENV+=()
|
|
source ${0:a:h}/common.zsh
|
|
#####################################################################
|
|
|
|
SETUP_SYMLINKS() {
|
|
while read SYMLINK
|
|
do
|
|
SETUP_SYMLINK $(echo $SYMLINK | awk '{print $1;}') $(echo $SYMLINK | awk '{print $2}')
|
|
done < <(echo $SYMLINKS | sed -n '/^[^#]/p')
|
|
}
|
|
|
|
SETUP_SYMLINK() {
|
|
[ ! $2 ] && __FAIL 1 'must provide SOURCE_CONFIG and TARGET_CONFIG'
|
|
|
|
local SOURCE_CONFIG="$1"
|
|
[ ! -f "$SOURCE_CONFIG" ] && __FAIL 2 "no such file '$SOURCE_CONFIG'"
|
|
|
|
local TARGET_CONFIG="$HOME/.config/$2"
|
|
|
|
[ ! -d $(dirname "$TARGET_CONFIG") ] && mkdir -p $(dirname "$TARGET_CONFIG")
|
|
|
|
[ -f "$TARGET_CONFIG" ] && {
|
|
[[ $SAFE_SYMLINKS -eq 1 ]] && mv "$TARGET_CONFIG" "$TARGET_CONFIG.bak"
|
|
[[ $SAFE_SYMLINKS -eq 0 ]] && rm "$TARGET_CONFIG"
|
|
}
|
|
|
|
ln -s "$SOURCE_CONFIG" "$TARGET_CONFIG" \
|
|
&& __SUCCESS "successfully linked '$(basename $(dirname $TARGET_CONFIG))/$(basename $TARGET_CONFIG)'" \
|
|
|| __FAIL 3 "failed to create link '$TARGET_CONFIG'" \
|
|
;
|
|
}
|
|
|
|
#####################################################################
|
|
SETUP_SYMLINKS $@
|