gitpack is a utility that other applications can use to provide one-line installs and auto-update functionality. The core premise is that gitpack based applications are installed and updated simply by pulling a git repository. gitpack manages the entire repository lifecycle:
- clones the repo and installs the application
- keeps the local copy of the repo updated and re-triggers the applications setup scripts as needed
- provides a facility for removing applications
Configuring is as simple as creating a .gitpack.yml file in the root of your project:
# .gitpack.yml
name: my-app # The name your app will be installed as
entrypoint: bin/my-app.sh # The executable to start your app
setup: bin/setup.sh # A setup script to install dependencies
The executable defined by setup should be idempotent. It will be run both on initial install, but also any time the application is self-updated.
The executable defined by entrypoint will be added to your users' PATH under the name specified in the config file.
There are two options for creating an install script for a gitpack based application:
This method uses an official hosted copy of gitpack to handle the install. Simply replace [Git URL] with the URL of your projects repository, and this command as-is will install it:
curl -fsSL https://gitpack.htlc.io | sh -s -- install <git url>
If you don't want to trust the official hosted copy of gitpack, you can easily vendor it yourself with a few extra steps:
- Download a copy of gitpack from this repository and choose a URL you will host it at.
- Open
gitpackand modify thegitpack_urlat the top of the file to match your chosen URL. - Host your modified gitpack file at your chosen URL
Your single-line install command is then:
curl -fsSL <your URL> | sh -s -- install <git url>