Installing
On Linux or macOS, deploy/install.sh installs the latest GitHub release:
curl -fsSLO https://raw.githubusercontent.com/OttoOps/drawbar/main/deploy/install.sh
bash install.sh # latest release; add --timers on Linux for the maintenance timers
bash install.sh --uninstall # runs drawbar uninstall
The script downloads drawbar-<version>-<target>.tar.gz and SHA256SUMS, stops
before it changes anything when the archive’s checksum does not match, and
checks the build attestation with gh attestation verify when gh is signed
in. It then runs drawbar install from the unpacked archive and passes it the
--force, --adopt-legacy, --timers and --drawbard flags you gave the script. Linux gets the static musl build.
--version vX.Y.Z picks a release, --target picks a build, and
--archive <file> --sums <SHA256SUMS> installs an archive already on disk.
DRAWBAR_RELEASES_URL replaces the GitHub release URL, as an https URL or a
plain http one on 127.0.0.1 or localhost.
drawbar install copies the running binary to ~/.local/opt/drawbar/drawbar
and links ~/.local/bin/drawbar and ~/.local/bin/git to that copy, so every
shell or service with ~/.local/bin ahead of /usr/bin on its PATH runs git
through the shim:
$ ./target/release/drawbar install
drawbar: installed /home/acme/.local/opt/drawbar/drawbar
drawbar: linked /home/acme/.local/bin/git
drawbar: linked /home/acme/.local/bin/drawbar
drawbar: set init.defaultRefFormat=files in /home/acme/.gitconfig
The copy goes through a temporary file and a rename, and each link is a new symlink renamed over the old path, so a git call that runs during install gets either the old file or the shim. Running install again replaces the copy and leaves the links alone, which is how you upgrade after a rebuild.
Install checks everything before it changes anything. It refuses, and changes
nothing, when ~/.local/bin/git or ~/.local/bin/drawbar holds something
drawbar did not make, unless you pass one of these:
| Flag | What it replaces |
|---|---|
--adopt-legacy | A ~/.local/bin/git symlink that resolves to the agent-git wrapper at ~/.local/opt/agent-git/git, which must still exist. |
--force | Any file or symlink. Install never replaces a directory. |
Install hard-links the entry it replaces into ~/.local/opt/drawbar/displaced/
before it swaps in its own link, and uninstall moves that entry back. When the
replaced entry is a symlink whose target no longer exists, uninstall deletes it
instead, so it never leaves a dangling link.
When git’s global config file leaves init.defaultRefFormat unset, counting
any [include] files, install appends this block to it and records that it did
in ~/.local/opt/drawbar/gitconfig.marker:
[init]
defaultRefFormat = files
The file is the one git config --global writes to: GIT_CONFIG_GLOBAL when it
is set, else ~/.gitconfig, else $XDG_CONFIG_HOME/git/config when only that
file exists. A value you set yourself, files or any other, stays as it is.
Install never sets worktree.useRelativePaths, because git older than 2.48
cannot read worktrees created with relative paths.
drawbar uninstall removes both links, puts back what install replaced, strips
the block install appended so the config file returns byte for byte, and
deletes ~/.local/opt/drawbar. When you have edited the config file and the
block is no longer at its end, uninstall runs
git config --unset init.defaultRefFormat '^files$' instead, which removes
the value only while it is still files and keeps your other settings. It leaves alone a ~/.local/bin entry that no longer points at
drawbar. Run hash -r in open shells afterwards, or bash keeps trying the
cached ~/.local/bin/git path.
drawbar install --timers also installs the systemd user units described in
Scheduled maintenance, and --drawbard the
drawbard.service unit described in Running drawbard. Uninstall
stops and removes them, along with drawbard’s socket directory. Both are Linux
only.
Both commands exit 0 on success, 1 when they refuse or a step fails, and
2 for a bad argument. See
ADR 0008.