Improve install.sh and documentation
- Don't fail now that archive contains directory - Change default install location to `~/bin` - Suggestion installing in ~/bin - Add instructions to create `~/bin`, install there, and add `~/bin` to the PATH variable. type: distribution pr: https://github.com/casey/intermodal/pull/352
This commit is contained in:
parent
e54bdeb95d
commit
a67eb72848
|
@ -4,7 +4,8 @@ Changelog
|
||||||
|
|
||||||
UNRELEASED - 2020-04-10
|
UNRELEASED - 2020-04-10
|
||||||
-----------------------
|
-----------------------
|
||||||
- :art: [`xxxxxxxxxxxx`](https://github.com/casey/intermodal/commits/master) Remove use of unreachable in favor of internal errors ([#351](https://github.com/casey/intermodal/pull/351)) - Fixes [#188](https://github.com/casey/intermodal/issues/188) - _Casey Rodarmor <casey@rodarmor.com>_
|
- :package: [`xxxxxxxxxxxx`](https://github.com/casey/intermodal/commits/master) Improve install.sh and documentation ([#352](https://github.com/casey/intermodal/pull/352)) - _Casey Rodarmor <casey@rodarmor.com>_
|
||||||
|
- :art: [`e54bdeb95d93`](https://github.com/casey/intermodal/commit/e54bdeb95d932bd5f81870f34999de37b615a69d) Remove use of unreachable in favor of internal errors ([#351](https://github.com/casey/intermodal/pull/351)) - Fixes [#188](https://github.com/casey/intermodal/issues/188) - _Casey Rodarmor <casey@rodarmor.com>_
|
||||||
- :books: [`52b78b90f675`](https://github.com/casey/intermodal/commit/52b78b90f6751a72a64074619fbf19df2988ac14) Improve badges ([#350](https://github.com/casey/intermodal/pull/350)) - _Casey Rodarmor <casey@rodarmor.com>_
|
- :books: [`52b78b90f675`](https://github.com/casey/intermodal/commit/52b78b90f6751a72a64074619fbf19df2988ac14) Improve badges ([#350](https://github.com/casey/intermodal/pull/350)) - _Casey Rodarmor <casey@rodarmor.com>_
|
||||||
|
|
||||||
|
|
||||||
|
|
30
README.md
30
README.md
|
@ -32,9 +32,8 @@ For more about the project and its goals, check out [this post](https://rodarmor
|
||||||
|
|
||||||
#### Supported Operating Systems
|
#### Supported Operating Systems
|
||||||
|
|
||||||
`imdl` supports both unix and Windows. It is tested on Linux, MacOS, and
|
`imdl` supports Linux, MacOS, and Windows, and should work on other unix OSes.
|
||||||
Windows, but should work on other unix OSs. If it does not, please open an
|
If it does not, please open an issue!
|
||||||
issue!
|
|
||||||
|
|
||||||
#### Pre-built binaries
|
#### Pre-built binaries
|
||||||
|
|
||||||
|
@ -42,13 +41,36 @@ Pre-built binaries for Linux, macOS, and Windows can be found on
|
||||||
[the releases page](https://github.com/casey/intermodal/releases).
|
[the releases page](https://github.com/casey/intermodal/releases).
|
||||||
|
|
||||||
You can use the following command to download the latest binary for Linux,
|
You can use the following command to download the latest binary for Linux,
|
||||||
MacOS or Windows, just replace `DEST` with the directory where you'd like to
|
MacOS, or Windows, just replace `DEST` with the directory where you'd like to
|
||||||
install the `imdl` binary:
|
install the `imdl` binary:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://imdl.io/install.sh | bash -s -- --to DEST
|
curl --proto '=https' --tlsv1.2 -sSf https://imdl.io/install.sh | bash -s -- --to DEST
|
||||||
```
|
```
|
||||||
|
|
||||||
|
A good place to install personal binaries is `~/bin`, which `install.sh` uses
|
||||||
|
when `--to` is not supplied. To create the `~/bin` directory and install `imdl`
|
||||||
|
there, do:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://imdl.io/install.sh | bash
|
||||||
|
```
|
||||||
|
|
||||||
|
Additionally, you'll have to add `~/bin` to the `PATH` environment variable,
|
||||||
|
which the system uses to find executables. How to do this depends on the shell.
|
||||||
|
|
||||||
|
For `sh`, `bash`, and `zsh`, it should be done in `~/.profile`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
echo 'export PATH=$HOME/bin:$PATH' >> ~/.profile
|
||||||
|
```
|
||||||
|
|
||||||
|
For `fish`, it should be done in `~/.config/fish/config.fish`:
|
||||||
|
|
||||||
|
```fish
|
||||||
|
echo 'set -gx PATH ~/bin $PATH' >> ~/.config/fish/config.fish
|
||||||
|
```
|
||||||
|
|
||||||
#### Cargo
|
#### Cargo
|
||||||
|
|
||||||
`imdl` is written in [Rust](https://www.rust-lang.org/) and can be built from
|
`imdl` is written in [Rust](https://www.rust-lang.org/) and can be built from
|
||||||
|
|
|
@ -4,7 +4,7 @@ set -eu
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
cat <<'EOF'
|
cat <<'EOF'
|
||||||
Install a binary release of a imdl hosted on GitHub
|
Install a binary release of `imdl` hosted on GitHub
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
install [options]
|
install [options]
|
||||||
|
@ -12,13 +12,14 @@ Usage:
|
||||||
Options:
|
Options:
|
||||||
-h, --help Display this message
|
-h, --help Display this message
|
||||||
-f, --force Force overwriting an existing binary
|
-f, --force Force overwriting an existing binary
|
||||||
--tag TAG Tag (version) of the crate to install (default <latest release>)
|
--tag TAG Tag (version) to install (default <latest release>)
|
||||||
--to LOCATION Where to install the binary (default ~/.cargo/bin)
|
--to LOCATION Where to install the binary (default ~/bin)
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
git=casey/intermodal
|
git=casey/intermodal
|
||||||
crate=imdl
|
crate=imdl
|
||||||
|
bin=imdl
|
||||||
url=https://github.com/casey/intermodal
|
url=https://github.com/casey/intermodal
|
||||||
releases=$url/releases
|
releases=$url/releases
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ while test $# -gt 0; do
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--to)
|
--to)
|
||||||
dest=$2
|
dst=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -89,8 +90,8 @@ if [ -z ${tag-} ]; then
|
||||||
need rev
|
need rev
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z ${dest-} ]; then
|
if [ -z ${dst-} ]; then
|
||||||
dest="$HOME/.cargo/bin"
|
dst="$HOME/bin"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z ${tag-} ]; then
|
if [ -z ${tag-} ]; then
|
||||||
|
@ -103,21 +104,17 @@ say_err "Repository: $url"
|
||||||
say_err "Crate: $crate"
|
say_err "Crate: $crate"
|
||||||
say_err "Tag: $tag"
|
say_err "Tag: $tag"
|
||||||
say_err "Target: $target"
|
say_err "Target: $target"
|
||||||
say_err "Destination: $dest"
|
say_err "Destination: $dst"
|
||||||
say_err "Archive: $archive"
|
say_err "Archive: $archive"
|
||||||
|
|
||||||
td=$(mktemp -d || mktemp -d -t tmp)
|
td=$(mktemp -d || mktemp -d -t tmp)
|
||||||
curl -sL $archive | tar -C $td -xz
|
curl -sL $archive | tar -C $td -xz
|
||||||
|
|
||||||
for f in $(ls $td); do
|
if [ -e "$dst/$bin" ] && [ $force = false ]; then
|
||||||
test -x $td/$f || continue
|
err "$bin already exists in $dst"
|
||||||
|
|
||||||
if [ -e "$dest/$f" ] && [ $force = false ]; then
|
|
||||||
err "$f already exists in $dest"
|
|
||||||
else
|
else
|
||||||
mkdir -p $dest
|
mkdir -p $dst
|
||||||
install -m 755 $td/$f $dest
|
install -m 755 $td/$bin $dst
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
|
|
||||||
rm -rf $td
|
rm -rf $td
|
||||||
|
|
Loading…
Reference in New Issue
Block a user