add --prefix option to installer

This commit is contained in:
CJ van den Berg 2025-02-11 19:15:48 +01:00
parent 1a05a9e469
commit 30d1c9ee11
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 13 additions and 17 deletions

View file

@ -33,14 +33,13 @@ Flow Control is under active development, but usually very stable.
### Installer ### Installer
Install latest release: Install the latest release to `/usr/local/bin`:
``` curl -fsSL https://flow-control.dev/install | sh ``` ``` curl -fsSL https://flow-control.dev/install | sh ```
Install latest nightly build: Install latest nightly build and specify the install prefix:
``` curl -fsSL https://flow-control.dev/install | sh -s -- --nightly ```
``` curl -fsSL https://flow-control.dev/install | sh -s -- --nightly --prefix ~/.local/bin ```
### Prebuilt Binaries ### Prebuilt Binaries
- Stable: [Releases](https://github.com/neurocyte/flow/releases) - Stable: [Releases](https://github.com/neurocyte/flow/releases)

21
install
View file

@ -5,22 +5,19 @@ install_dir="/usr/local/bin"
add_alias=0 add_alias=0
nightly=0 nightly=0
# parse command-line arguments for alias option only while true
for arg in "$@"; do do
case "$arg" in case "${1}" in
--alias|-a) -a|--alias) add_alias=1; shift 1;;
add_alias=1 -n|--nightly) nightly=1; shift 1;;
;; -p|--prefix) install_dir=/$2; shift 2;;
--nightly|-n) --) shift 1; break ;;
nightly=1 *) break ;;
;;
*)
;;
esac esac
done done
# prompt for nightly build option if interactive # prompt for nightly build option if interactive
if [ -t 0 ]; then if [ "$nightly" -eq 0 ] && [ -t 0 ]; then
printf "do you want to install a Nightly build? [y/N]: " printf "do you want to install a Nightly build? [y/N]: "
read -r answer_nightly read -r answer_nightly
if [ "$answer_nightly" = "y" ] || [ "$answer_nightly" = "Y" ]; then if [ "$answer_nightly" = "y" ] || [ "$answer_nightly" = "Y" ]; then