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
Install latest release:
Install the latest release to `/usr/local/bin`:
``` curl -fsSL https://flow-control.dev/install | sh ```
Install latest nightly build:
``` curl -fsSL https://flow-control.dev/install | sh -s -- --nightly ```
Install latest nightly build and specify the install prefix:
``` curl -fsSL https://flow-control.dev/install | sh -s -- --nightly --prefix ~/.local/bin ```
### Prebuilt Binaries
- Stable: [Releases](https://github.com/neurocyte/flow/releases)

21
install
View file

@ -5,22 +5,19 @@ install_dir="/usr/local/bin"
add_alias=0
nightly=0
# parse command-line arguments for alias option only
for arg in "$@"; do
case "$arg" in
--alias|-a)
add_alias=1
;;
--nightly|-n)
nightly=1
;;
*)
;;
while true
do
case "${1}" in
-a|--alias) add_alias=1; shift 1;;
-n|--nightly) nightly=1; shift 1;;
-p|--prefix) install_dir=/$2; shift 2;;
--) shift 1; break ;;
*) break ;;
esac
done
# 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]: "
read -r answer_nightly
if [ "$answer_nightly" = "y" ] || [ "$answer_nightly" = "Y" ]; then