webinstall / webi-roadmap

A space where we can ideate without cluttering the main repo with stale issues
Mozilla Public License 2.0
2 stars 0 forks source link

bootstrap: embedded script isn't checked #2

Open coolaj86 opened 1 year ago

coolaj86 commented 1 year ago

Obviously it's a dumb idea to embed a script in a heredoc of another script.

We need a different solution for _webi/bootstrap.sh, and it may require a shudder build step... 😬

Thoughts

How about we just make the webi command its own command and installer, just like ssh-adduser?

Or maybe even host it on GitHub releases so it gets its own version?

Maybe just check if the downloaded version is more than 5 minutes old? (bad idea)

Run if WEBI_INSTALL=true is not set. 👍

Implementation thoughts

webi webi and webi update should manually update webi, regardless of version.

if command -v curl > /dev/null 2> /dev/null; then
    if ! curl -fsSL "$my_installer_url" -H "User-Agent: curl $WEBI_UA" \
        -o "$WEBI_BOOT/$my_package-bootstrap.sh"; then
        echo >&2 "error fetching '$my_installer_url'"
        exit 1
    fi
else
    if ! wget -q "$my_installer_url" --user-agent="wget $WEBI_UA" \
        -O "$WEBI_BOOT/$my_package-bootstrap.sh"; then
        echo >&2 "error fetching '$my_installer_url'"
        exit 1
    fi
fi
    webi_download \
        "$WEBI_HOST/packages/${my_cmd}/${my_cmd}.sh" \
        "$HOME/.local/bin/${my_cmd}"