3 Primary and community-submitted packages for
4 [webinstall.dev](https://webinstall.dev)
8 - Should install to `./local/opt/<package>-<version>`
9 - Should not need `sudo` (except perhaps for a one-time `setcap`, etc)
10 - Follow the example of
11 <https://github.com/webinstall/packages/tree/master/ripgrep>,
12 <https://github.com/webinstall/packages/tree/master/node>, or
13 <https://github.com/webinstall/packages/tree/master/golang>
15 ## Creating an Installer
17 An install consists of 5 parts in two files:
27 3. Version Check (semi-optional)
30 See these **examples**:
32 - https://github.com/webinstall/packages/blob/master/rg/
33 - https://github.com/webinstall/packages/blob/master/golang/
35 The `webinstall.dev` server uses the list of releases returned by
36 `<your-package>/releases.js` to generate a bash script with most necessary
37 variables and functions pre-defined.
39 You just fill in the blanks.
41 ### 1. Create Description
43 Just copy the format from any of the existing packages. It's like this:
45 `my-new-package.bash`:
49 # homepage: https://nodejs.org
50 # tagline: JavaScript V8 runtime
52 # Node.jsĀ® is a JavaScript runtime built on Chrome's V8 JavaScript engine
55 # node -e 'console.log("Hello, World!")'
62 All you're doing in this step is just translating from one form of JSON or CSV
63 or TAB or whatever, to a format understood by `webi`.
65 - Using Github releases? See `ripgrep/releases.js` (which uses
67 - Have a special format? See `golang/releases.js` or `node/releases.js`.
74 module.exports = function (request) {
75 return github(request, owner, repo).then(function (all) {
76 // if you need to do something special, you can do it here
85 1. Variables _you_ can set
86 2. Functions _you_ must define
87 3. Convenience / Helper Functions
89 (optional, if needed) Bash variables that you _may_ define:
92 # Define this if the package name is different from the command name (i.e. golang => go)
95 # These are used for symlinks, PATH, and test commands
96 pkg_common_opt="$HOME/.local/opt/foobar"
97 pkg_common_bin="$HOME/.local/opt/foobar/bin"
98 pkg_common_cmd="$HOME/.local/opt/foobar/bin/foobar"
100 # These are the _real_ locations for the above
101 pkg_new_opt="$HOME/.local/opt/foobar-v$WEBI_VERSION"
102 pkg_new_bin="$HOME/.local/opt/foobar-v$WEBI_VERSION/bin"
103 pkg_new_cmd="$HOME/.local/opt/foobar-v$WEBI_VERSION/bin/foobar"
106 (required) A version check function that strips all non-version junk
109 pkg_get_current_version() {
110 # foobar-v1.1.7 => 1.1.7
111 echo "$(foobar --version | head -n 1 | sed 's:foobar-v::')"
115 For the rest of the functions you can like copy/paste from the examples:
118 pkg_format_cmd_version() {} # Optional, pretty prints version
120 pkg_link_new_version() {} # Required, may be empty for $HOME/.local/bin commands
122 pkg_pre_install() { # Required, runs any webi_* commands
123 webi_check # for $HOME/.local/opt tools
124 webi_download # for things that have a releases.js
125 webi_extract # for .xz, .tar.*, and .zip files
128 pkg_install() {} # Required, usually just needs to rename extracted folder to
129 # "$HOME/.local/opt/$pkg_cmd_name-v$WEBI_VERSION"
131 pkg_post_install() { # Required
132 pkg_link_new_version # should probably call pkg_link_new_version()
133 webi_path_add "$pkg_common_bin" # should probably update PATH
136 pkg_post_install_message() {} # Optional, pretty print a success message
141 See `webi/template.bash`
143 These variables will be set by the server:
149 WEBI_HOST=https://webinstall.dev
150 WEBI_RELEASES=https://webinstall.dev/api/releases/example@v1?os=macos&arch=amd64&pretty=true
159 WEBI_PKG_URL=https://cdn.example.com/example-macos-amd64.tar.gz
160 WEBI_PKG_FILE=example-macos-amd64.tar.gz
164 WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-foobar.XXXXXXXX)"}
168 webi_check # Checks to see if the selected version is already installed (and re-links if so)
169 webi_download # Downloads the selected release to $HOME/Downloads/<package-name>.tar.gz
170 webi_extract # Extracts the download to /tmp/<package-name>-<random>/
171 webi_path_add /new/path # Adds /new/path to PATH for bash, zsh, and fish
176 - Wrap release APIs to unify and expose
177 - [x] Golang <https://golang.org/dl/?mode=json>
178 - [x] Node <https://nodejs.org/dist/index.tab>
180 <https://storage.googleapis.com/flutter_infra/releases/releases_linux.json> -
182 <https://github.com/webinstall/packages/blob/master/flutter/versions.js>
184 - Note: do all platforms expose tar/zip releases with the same URLs?
186 - [x] github (see ripgrep)
187 - [x] gitea (see serviceman)
188 - [ ] Support git urls (i.e. `@github.com/node/node`)
189 - (maybe `ghi node/node` for github specifically)