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 4 files:
29 3. Version Check (semi-optional)
32 See these **examples**:
34 - https://github.com/webinstall/packages/blob/master/rg/
35 - https://github.com/webinstall/packages/blob/master/golang/
37 The `webinstall.dev` server uses the list of releases returned by
38 `<your-package>/releases.js` to generate a bash script with most necessary
39 variables and functions pre-defined.
41 You just fill in the blanks.
45 Just create an empty directory and run the tests until you get a good result.
48 git clone git@github.com:webinstall/packages.git
55 node _webi/test.js ./new-package/
58 ### 1. Create Description
60 Just copy the format from any of the existing packages. It's like this:
66 # homepage: https://nodejs.org
67 # tagline: JavaScript V8 runtime
69 # Node.jsĀ® is a JavaScript runtime built on Chrome's V8 JavaScript engine
72 # node -e 'console.log("Hello, World!")'
79 This is a dumb format. We know. Historical accident (originally these were in
82 It's in the TODOs to replace this with either YAML or Markdown.
86 All you're doing in this step is just translating from one form of JSON or CSV
87 or TAB or whatever, to a format understood by `webi`.
89 - Using Github releases? See `ripgrep/releases.js` (which uses
91 - Have a special format? See `golang/releases.js` or `node/releases.js`.
98 module.exports = function (request) {
99 return github(request, owner, repo).then(function (all) {
100 // if you need to do something special, you can do it here
107 ### 2. Bash Installer
109 1. Variables _you_ can set
110 2. Functions _you_ must define
111 3. Convenience / Helper Functions
113 (optional, if needed) Bash variables that you _may_ define:
116 # Define this if the package name is different from the command name (i.e. golang => go)
117 pkg_cmd_name="foobar"
119 # These are used for symlinks, PATH, and test commands
120 pkg_dst="$HOME/.local/opt/foobar"
121 pkg_dst_bin="$HOME/.local/opt/foobar/bin"
122 pkg_dst_cmd="$HOME/.local/opt/foobar/bin/foobar"
124 # These are the _real_ locations for the above
125 pkg_src="$HOME/.local/opt/foobar-v$WEBI_VERSION"
126 pkg_src_bin="$HOME/.local/opt/foobar-v$WEBI_VERSION/bin"
127 pkg_src_cmd="$HOME/.local/opt/foobar-v$WEBI_VERSION/bin/foobar"
130 (required) A version check function that strips all non-version junk
133 pkg_get_current_version() {
134 # foobar-v1.1.7 => 1.1.7
135 echo "$(foobar --version | head -n 1 | sed 's:foobar-v::')"
139 For the rest of the functions you can like copy/paste from the examples:
142 pkg_format_cmd_version() {} # Override, pretty prints version
144 pkg_link # Override, replaces webi_link()
146 pkg_pre_install() { # Override, runs any webi_* commands
147 webi_check # for $HOME/.local/opt tools
148 webi_download # for things that have a releases.js
149 webi_extract # for .xz, .tar.*, and .zip files
152 pkg_install() {} # Override, usually just needs to rename extracted folder to
153 # "$HOME/.local/opt/$pkg_cmd_name-v$WEBI_VERSION"
155 pkg_post_install() { # Override
156 webi_path_add "$pkg_dst_bin" # should probably update PATH
159 pkg_done_message() {} # Override, pretty print a success message
164 See `webi/template.bash`
166 These variables will be set by the server:
172 WEBI_HOST=https://webinstall.dev
173 WEBI_RELEASES=https://webinstall.dev/api/releases/example@v1?os=macos&arch=amd64&pretty=true
182 WEBI_PKG_URL=https://cdn.example.com/example-macos-amd64.tar.gz
183 WEBI_PKG_FILE=example-macos-amd64.tar.gz
187 WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-foobar.XXXXXXXX)"}
192 webi_check # Checks to see if the selected version is already installed (and re-links if so)
193 webi_download # Downloads the selected release to $HOME/Downloads/<package-name>.tar.gz
194 webi_extract # Extracts the download to /tmp/<package-name>-<random>/
195 webi_path_add /new/path # Adds /new/path to PATH for bash, zsh, and fish
196 webi_pre_install # Runs webi_check, webi_download, and webi_extract
197 webi_install # Moves extracted files from $WEBI_TMP to $pkg_src
198 webi_link # replaces any existing symlink with the currently selected version
199 webi_post_install # Runs `webi_add_path $pkg_dst_bin`
204 - Wrap release APIs to unify and expose
205 - [x] Golang <https://golang.org/dl/?mode=json>
206 - [x] Node <https://nodejs.org/dist/index.tab>
208 <https://storage.googleapis.com/flutter_infra/releases/releases_linux.json> -
210 <https://github.com/webinstall/packages/blob/master/flutter/versions.js>
212 - Note: do all platforms expose tar/zip releases with the same URLs?
214 - [x] github (see ripgrep)
215 - [x] gitea (see serviceman)
216 - [ ] Support git urls (i.e. `@github.com/node/node`)
217 - (maybe `ghi node/node` for github specifically)