35 lines
915 B
Bash
Executable File
35 lines
915 B
Bash
Executable File
#!/usr/bin/env zsh
|
|
# vi: set ft=zsh tw=80 ts=2
|
|
|
|
function ensureLocalBinFolder() {
|
|
local folder="/usr/local/bin"
|
|
if [[ ! -d "${folder}" ]]; then
|
|
mkdir -p "${folder}" 2> /dev/null || return 10
|
|
chown root:admin "${folder}"
|
|
chmod ug=rwx,o=rx "${folder}"
|
|
fi
|
|
}
|
|
|
|
function installZshlib() {
|
|
/bin/zsh -c "$(curl -fsSL https://raw.githubusercontent.com/astzweig/zshlib/main/bootstrap.sh)"
|
|
[[ -f '/usr/local/share/zsh/site-functions/zshlib.zwc' ]]
|
|
}
|
|
|
|
function installMacOSSystemLibrary() {
|
|
local destPath=/usr/local/bin/macos-system-lib.sh
|
|
curl --output $destPath -fsSL https://raw.githubusercontent.com/astzweig/macos-system/main/modules/lib.sh
|
|
chown root:admin $destPath
|
|
chmod ugo=r $destPath
|
|
}
|
|
|
|
function main() {
|
|
installZshlib
|
|
ensureLocalBinFolder || return $?
|
|
installMacOSSystemLibrary
|
|
}
|
|
|
|
if [[ "${ZSH_EVAL_CONTEXT}" == toplevel || "${ZSH_EVAL_CONTEXT}" == cmdarg ]]; then
|
|
_DIR="${0:A:h}"
|
|
main "$@"
|
|
fi
|