v2.5.0
===================================================================== --- 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:
6
zsh/git/common.zsh
Normal file
6
zsh/git/common.zsh
Normal file
@ -0,0 +1,6 @@
|
||||
_DEPENDENCIES+=(
|
||||
git
|
||||
)
|
||||
_REQUIRED_ENV+=()
|
||||
source ${0:a:h}/../common.zsh
|
||||
#####################################################################
|
6
zsh/git/package/build
Executable file
6
zsh/git/package/build
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/zsh
|
||||
_DEPENDENCIES+=()
|
||||
_REQUIRED_ENV+=()
|
||||
source ${0:a:h}/common.zsh
|
||||
#####################################################################
|
||||
__RUN_SCWRYPT zsh/git/package/install -- --only-build $@
|
73
zsh/git/package/common.zsh
Normal file
73
zsh/git/package/common.zsh
Normal file
@ -0,0 +1,73 @@
|
||||
_DEPENDENCIES+=()
|
||||
_REQUIRED_ENV+=()
|
||||
source ${0:a:h}/../common.zsh
|
||||
#####################################################################
|
||||
|
||||
PACKAGE_INSTALL_DIR="$HOME/.local/share/source-packages"
|
||||
|
||||
#####################################################################
|
||||
|
||||
CLONE() {
|
||||
cd "$PACKAGE_INSTALL_DIR"
|
||||
__STATUS "downloading $NAME"
|
||||
git clone "$TARGET" "$NAME" \
|
||||
&& __SUCCESS "successfully downloaded '$NAME'" \
|
||||
|| __FAIL 1 "failed to download '$NAME'" \
|
||||
;
|
||||
}
|
||||
|
||||
PULL() {
|
||||
__STATUS "updating '$NAME'"
|
||||
cd "$PACKAGE_INSTALL_DIR/$NAME"
|
||||
git pull origin $(git rev-parse --abbrev-ref HEAD) \
|
||||
&& __SUCCESS "successfully updated '$NAME'" \
|
||||
|| __FAIL 1 "failed to update '$NAME'" \
|
||||
;
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
|
||||
BUILD() {
|
||||
cd "$PACKAGE_INSTALL_DIR/$NAME"
|
||||
|
||||
CHECK_MAKE && { MAKE && return 0 || return 1; }
|
||||
CHECK_MAKEPKG && { MAKEPKG && return 0 || return 2; }
|
||||
|
||||
__WARNING 'could not detect supported installation method'
|
||||
|
||||
__REMINDER 'complete manual installation in the directory below:'
|
||||
__REMINDER "$PACKAGE_INSTALL_DIR/$NAME"
|
||||
}
|
||||
|
||||
CHECK_MAKE() { [ -f ./Makefile ]; }
|
||||
CHECK_MAKEPKG() { [ -f ./PKGBUILD ]; }
|
||||
|
||||
MAKE() {
|
||||
[[ $CLEAN -eq 1 ]] && {
|
||||
__STATUS "cleaning '$NAME'"
|
||||
make clean
|
||||
}
|
||||
|
||||
__STATUS "building '$NAME'"
|
||||
make \
|
||||
&& __SUCCESS "finished building '$NAME'" \
|
||||
|| __FAIL 1 "build failed for '$NAME' (see above)"\
|
||||
;
|
||||
|
||||
__STATUS "installing '$NAME'"
|
||||
__GETSUDO
|
||||
sudo make install \
|
||||
&& __SUCCESS "succesfully installed '$NAME'" \
|
||||
|| __FAIL 2 "failed to install '$NAME' (see above)"\
|
||||
;
|
||||
}
|
||||
|
||||
MAKEPKG() {
|
||||
__STATUS "installing '$NAME'"
|
||||
yes | makepkg -si \
|
||||
&& __SUCCESS "succesfully installed '$NAME'" \
|
||||
|| __FAIL 1 "failed to install '$NAME' (see above)"\
|
||||
;
|
||||
}
|
||||
|
||||
#####################################################################
|
6
zsh/git/package/download
Executable file
6
zsh/git/package/download
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/zsh
|
||||
_DEPENDENCIES+=()
|
||||
_REQUIRED_ENV+=()
|
||||
source ${0:a:h}/common.zsh
|
||||
#####################################################################
|
||||
__RUN_SCWRYPT zsh/git/package/install -- --only-pull $@
|
88
zsh/git/package/install
Executable file
88
zsh/git/package/install
Executable file
@ -0,0 +1,88 @@
|
||||
#!/bin/zsh
|
||||
_DEPENDENCIES+=()
|
||||
_REQUIRED_ENV+=()
|
||||
source ${0:a:h}/common.zsh
|
||||
#####################################################################
|
||||
|
||||
INSTALL() {
|
||||
local USAGE="
|
||||
usage: [...options...]
|
||||
|
||||
options
|
||||
-t, --target-url <string> target URL; required for first-time download
|
||||
-n, --local-name <string> local name for package (optional)
|
||||
|
||||
-u, --update if package exists, update without prompt
|
||||
-b, --only-build if package exists, skip update step and only build
|
||||
-p, --only-pull skip the automated build step
|
||||
-c, --clean for make, run make clean before build
|
||||
|
||||
-h, --help print this message and exit
|
||||
"
|
||||
local NAME
|
||||
local TARGET
|
||||
|
||||
local SKIP_BUILD=0
|
||||
local SKIP_PULL=0
|
||||
local UPDATE=0
|
||||
local CLEAN=0
|
||||
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
case $1 in
|
||||
-t | --target-url ) TARGET="$2"; shift 1 ;;
|
||||
-n | --local-name ) NAME="$2"; shift 1 ;;
|
||||
|
||||
-u | --update ) UPDATE=1 ;;
|
||||
-b | --only-build ) SKIP_PULL=1 ;;
|
||||
-p | --only-pull ) SKIP_BUILD=1 ;;
|
||||
-c | --clean ) CLEAN=1 ;;
|
||||
|
||||
-h | --help ) __USAGE; exit 0 ;;
|
||||
|
||||
-* ) __ERROR "unknown argument '$1'" ;;
|
||||
|
||||
* ) [ ! $TARGET ] && TARGET="$1" \
|
||||
|| __ERROR "extra positional argument '$1'" \
|
||||
;
|
||||
;;
|
||||
esac
|
||||
shift 1
|
||||
done
|
||||
|
||||
[[ $SKIP_PULL -eq 1 ]] && [[ $SKIP_BUILD -eq 1 ]] && __ERROR 'only one of [-b | -p] can be specified'
|
||||
|
||||
[ ! $TARGET ] && [ ! $NAME ] && {
|
||||
[[ $SKIP_BUILD -eq 1 ]] && {
|
||||
__ERROR 'cannot skip build without specifying package local-name'
|
||||
} || {
|
||||
UPDATE=1
|
||||
NAME=$(ls "$PACKAGE_INSTALL_DIR" | __FZF 'select a package to update')
|
||||
[ ! $NAME ] && __ERROR 'target-url required'
|
||||
}
|
||||
}
|
||||
|
||||
__ERROR_CHECK
|
||||
|
||||
####################################################
|
||||
|
||||
[ ! $NAME ] && {
|
||||
NAME=$(echo $TARGET | sed 's/.*\///; s/\.git$//')
|
||||
__INFO "using default name '$NAME'"
|
||||
}
|
||||
|
||||
[ -d "$PACKAGE_INSTALL_DIR/$NAME" ] && [[ $SKIP_PULL -eq 0 ]] && {
|
||||
[[ $UPDATE -eq 0 ]] && __Yn "package '$NAME' already exists; update now?" && UPDATE=1
|
||||
[[ $UPDATE -eq 1 ]] && PULL || return 1
|
||||
}
|
||||
|
||||
[ ! -d "$PACKAGE_INSTALL_DIR/$NAME" ] && {
|
||||
CLONE || return 2
|
||||
}
|
||||
|
||||
[[ $SKIP_BUILD -eq 1 ]] && return 0
|
||||
BUILD
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
INSTALL $@
|
6
zsh/git/package/update
Executable file
6
zsh/git/package/update
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/zsh
|
||||
_DEPENDENCIES+=()
|
||||
_REQUIRED_ENV+=()
|
||||
source ${0:a:h}/common.zsh
|
||||
#####################################################################
|
||||
__RUN_SCWRYPT zsh/git/package/install -- --update $@
|
Reference in New Issue
Block a user