X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=_webi%2Ftemplate.sh;h=a041e41ac3b530cddc2461f8743ef7fd1e855401;hb=912c9c8f06590f06a2a9df1c03d8ead43e96ec70;hp=274bfa17d01fc107a625e1b296d7cf7003c91f2f;hpb=5f35c74c4a5de4f00b1169b7ddd00b2e352f8346;p=webi-installers%2F.git diff --git a/_webi/template.sh b/_webi/template.sh index 274bfa1..a041e41 100644 --- a/_webi/template.sh +++ b/_webi/template.sh @@ -1,6 +1,6 @@ #!/bin/bash -{ +function __bootstrap_webi() { set -e set -u @@ -211,7 +211,8 @@ webi_path_add() { # 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 @@ -226,7 +227,6 @@ webi_install() { if [ -n "$WEBI_SINGLE" ] || [ "single" == "${1:-}" ]; then mkdir -p "$(dirname $pkg_src_cmd)" mv ./"$pkg_cmd_name"* "$pkg_src_cmd" - chmod a+x "$pkg_src_cmd" else rm -rf "$pkg_src" mv ./"$pkg_cmd_name"* "$pkg_src" @@ -240,7 +240,8 @@ webi_post_install() { _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 @@ -283,12 +284,14 @@ echo "Have a problem? Experience a bug? Please let us know:" echo " https://github.com/webinstall/packages/issues" echo "" -{ +function __init_installer() { {{ installer }} } +__init_installer + ## ## ## END custom override functions @@ -321,6 +324,8 @@ if [ -n "$(command -v pkg_get_current_version)" ]; then pushd "$WEBI_TMP" 2>&1 >/dev/null echo "Installing to $pkg_src_cmd" [ -n "$(command -v pkg_install)" ] && pkg_install || webi_install + chmod a+x "$pkg_src" + chmod a+x "$pkg_src_cmd" popd 2>&1 >/dev/null webi_link @@ -351,3 +356,5 @@ rm -rf "$WEBI_TMP" # See? No magic. Just downloading and moving files. } + +__bootstrap_webi