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.
49 node _webi/test.js ./new-package/
52 ### 1. Create Description
54 Just copy the format from any of the existing packages. It's like this:
60 # homepage: https://nodejs.org
61 # tagline: JavaScript V8 runtime
63 # Node.jsĀ® is a JavaScript runtime built on Chrome's V8 JavaScript engine
66 # node -e 'console.log("Hello, World!")'
73 This is a dumb format. We know. Historical accident (originally these were in
76 It's in the TODOs to replace this with either YAML or Markdown.
80 All you're doing in this step is just translating from one form of JSON or CSV
81 or TAB or whatever, to a format understood by `webi`.
83 - Using Github releases? See `ripgrep/releases.js` (which uses
85 - Have a special format? See `golang/releases.js` or `node/releases.js`.
92 module.exports = function (request) {
93 return github(request, owner, repo).then(function (all) {
94 // if you need to do something special, you can do it here
101 ### 2. Bash Installer
103 1. Variables _you_ can set
104 2. Functions _you_ must define
105 3. Convenience / Helper Functions
107 (optional, if needed) Bash variables that you _may_ define:
110 # Define this if the package name is different from the command name (i.e. golang => go)
111 pkg_cmd_name="foobar"
113 # These are used for symlinks, PATH, and test commands
114 pkg_dst="$HOME/.local/opt/foobar"
115 pkg_dst_bin="$HOME/.local/opt/foobar/bin"
116 pkg_dst_cmd="$HOME/.local/opt/foobar/bin/foobar"
118 # These are the _real_ locations for the above
119 pkg_src="$HOME/.local/opt/foobar-v$WEBI_VERSION"
120 pkg_src_bin="$HOME/.local/opt/foobar-v$WEBI_VERSION/bin"
121 pkg_src_cmd="$HOME/.local/opt/foobar-v$WEBI_VERSION/bin/foobar"
124 (required) A version check function that strips all non-version junk
127 pkg_get_current_version() {
128 # foobar-v1.1.7 => 1.1.7
129 echo "$(foobar --version | head -n 1 | sed 's:foobar-v::')"
133 For the rest of the functions you can like copy/paste from the examples:
136 pkg_format_cmd_version() {} # Override, pretty prints version
138 pkg_link # Override, replaces webi_link()
140 pkg_pre_install() { # Override, runs any webi_* commands
141 webi_check # for $HOME/.local/opt tools
142 webi_download # for things that have a releases.js
143 webi_extract # for .xz, .tar.*, and .zip files
146 pkg_install() {} # Override, usually just needs to rename extracted folder to
147 # "$HOME/.local/opt/$pkg_cmd_name-v$WEBI_VERSION"
149 pkg_post_install() { # Override
150 webi_path_add "$pkg_dst_bin" # should probably update PATH
153 pkg_done_message() {} # Override, pretty print a success message
158 See `webi/template.bash`
160 These variables will be set by the server:
166 WEBI_HOST=https://webinstall.dev
167 WEBI_RELEASES=https://webinstall.dev/api/releases/example@v1?os=macos&arch=amd64&pretty=true
176 WEBI_PKG_URL=https://cdn.example.com/example-macos-amd64.tar.gz
177 WEBI_PKG_FILE=example-macos-amd64.tar.gz
181 WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-foobar.XXXXXXXX)"}
186 webi_check # Checks to see if the selected version is already installed (and re-links if so)
187 webi_download # Downloads the selected release to $HOME/Downloads/<package-name>.tar.gz
188 webi_extract # Extracts the download to /tmp/<package-name>-<random>/
189 webi_path_add /new/path # Adds /new/path to PATH for bash, zsh, and fish
190 webi_pre_install # Runs webi_check, webi_download, and webi_extract
191 webi_install # Moves extracted files from $WEBI_TMP to $pkg_src
192 webi_link # replaces any existing symlink with the currently selected version
193 webi_post_install # Runs `webi_add_path $pkg_dst_bin`
198 - Wrap release APIs to unify and expose
199 - [x] Golang <https://golang.org/dl/?mode=json>
200 - [x] Node <https://nodejs.org/dist/index.tab>
202 <https://storage.googleapis.com/flutter_infra/releases/releases_linux.json> -
204 <https://github.com/webinstall/packages/blob/master/flutter/versions.js>
206 - Note: do all platforms expose tar/zip releases with the same URLs?
208 - [x] github (see ripgrep)
209 - [x] gitea (see serviceman)
210 - [ ] Support git urls (i.e. `@github.com/node/node`)
211 - (maybe `ghi node/node` for github specifically)