#!/bin/bash
-{
+function __bootstrap_webi() {
set -e
set -u
# wget has resumable downloads
# TODO wget -c --content-disposition "$my_url"
set +e
- wget -q --show-progress --user-agent="wget $WEBI_UA" -c "$my_url" -O "$my_dl.part"
+ my_show_progress=""
+ if [[ $- == *i* ]]; then
+ my_show_progress="--show-progress"
+ fi
+ wget -q $my_show_progress --user-agent="wget $WEBI_UA" -c "$my_url" -O "$my_dl.part"
if ! [ $? -eq 0 ]; then
>&2 echo "failed to download from $WEBI_PKG_URL"
exit 1
else
# Neither GNU nor BSD curl have sane resume download options, hence we don't bother
# TODO curl -fsSL --remote-name --remote-header-name --write-out "$my_url"
- curl -fSL -H "User-Agent: curl $WEBI_UA" "$my_url" -o "$my_dl.part"
+ my_show_progress="-#"
+ if [[ $- == *i* ]]; then
+ my_show_progress=""
+ fi
+ curl -fSL $my_show_progress -H "User-Agent: curl $WEBI_UA" "$my_url" -o "$my_dl.part"
fi
mv "$my_dl.part" "$my_dl"
# in case pathman was recently installed and the PATH not updated
mkdir -p "$_webi_tmp"
- "$HOME/.local/bin/pathman" add "$1" | grep "export" >> "$_webi_tmp/.PATH.env" || true
+ # prevent "too few arguments" output on bash when there are 0 lines of stdout
+ "$HOME/.local/bin/pathman" add "$1" | grep "export" 2>/dev/null >> "$_webi_tmp/.PATH.env" || true
}
# group common pre-install tasks as default
_webi_enable_exec() {
if [ -n "$(command -v spctl)" ] && [ -n "$(command -v xattr)" ] ; then
- xattr -r -d com.apple.quarantine "$pkg_src"
+ # note: some packages contain files that cannot be affected by xattr
+ xattr -r -d com.apple.quarantine "$pkg_src" || true
return 0
fi
# TODO need to test that the above actually worked
echo " https://github.com/webinstall/packages/issues"
echo ""
-{
+function __init_installer() {
{{ installer }}
}
+__init_installer
+
##
##
## END custom override functions
# See? No magic. Just downloading and moving files.
}
+
+__bootstrap_webi