=====================================================================

--- 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
This commit is contained in:
2022-08-15 18:30:37 -06:00
parent a740a66870
commit 6333a2f6b8
34 changed files with 472 additions and 49 deletions

13
zsh/config/common.zsh Normal file
View File

@ -0,0 +1,13 @@
_DEPENDENCIES+=()
_REQUIRED_ENV+=()
DEFAULT_CONFIG="${0:a:h}/default.conf.zsh"
source ${0:a:h}/../common.zsh
#####################################################################
SAFE_SYMLINKS=1
# in case config.dotfile.zsh is sourced... allow user to provide initial config ;)
[ ! $CONFIG__USER_SETTINGS ] \
&& CONFIG__USER_SETTINGS="$SCWRYPTS_CONFIG_PATH/config.dotfile.zsh"
[ ! -f "$CONFIG__USER_SETTINGS" ] && cp "$DEFAULT_CONFIG" "$CONFIG__USER_SETTINGS"
source $CONFIG__USER_SETTINGS

View File

@ -0,0 +1,19 @@
#
# scwrypts dot-files config
#
#TERMINFO_PATH=/path/to/sourced/terminfo/files
#
# SAFE_SYMLINKS=1, makes a backup of config files that already exist
# SAFE_SYMLINKS=0, deletes existing config file
#
#SAFE_SYMLINKS=1
# lines which begin with '#' are ignored
SYMLINKS="
# fully qualified path ~/.config/THE-REST
# ---------------------------------------------
# /path/to/your/kitty.conf kitty/kitty.conf
"

6
zsh/config/settings Executable file
View File

@ -0,0 +1,6 @@
#!/bin/zsh
_DEPENDENCIES+=()
_REQUIRED_ENV+=()
source ${0:a:h}/common.zsh
#####################################################################
__EDIT "$CONFIG__USER_SETTINGS"

36
zsh/config/symlinks Executable file
View File

@ -0,0 +1,36 @@
#!/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 $@

26
zsh/config/terminfo Executable file
View File

@ -0,0 +1,26 @@
#!/bin/zsh
_DEPENDENCIES+=(
tic
)
_REQUIRED_ENV+=()
source ${0:a:h}/common.zsh
#####################################################################
SETUP_TERMINFO() {
[ ! $TERMINFO_PATH ] && return 0
[ ! -d $TERMINFO_PATH ] && __FAIL 1 "TERMINFO_PATH='$TERMINFO_PATH' does not exist"
local ERRORS=0
for TERMINFO in $(find $TERMINFO_PATH -type f)
do
tic -x $TERMINFO >/dev/null 2>&1 \
&& __SUCCESS "added '$(basename $TERMINFO)'" \
|| __ERROR "failed to add '$(basename $TERMINFO)'" \
;
done
__ERROR_CHECK
}
#####################################################################
SETUP_TERMINFO $@

10
zsh/config/update Executable file
View File

@ -0,0 +1,10 @@
#!/bin/zsh
_DEPENDENCIES+=()
_REQUIRED_ENV+=()
source ${0:a:h}/common.zsh
#####################################################################
__STATUS 'updating all config files and links'
__RUN_SCWRYPT zsh/config/symlinks || exit 1
__RUN_SCWRYPT zsh/config/terminfo || exit 2
__SUCCESS 'finished updating config files and links'