From 30d1c9ee11ad5d436711e561d22f53b361052507 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Tue, 11 Feb 2025 19:15:48 +0100 Subject: [PATCH] add --prefix option to installer --- content/index.smd | 7 +++---- install | 23 ++++++++++------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/content/index.smd b/content/index.smd index 8ca0499..66bfdd0 100644 --- a/content/index.smd +++ b/content/index.smd @@ -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) diff --git a/install b/install index 13184fa..ade90d1 100644 --- a/install +++ b/install @@ -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 - ;; - *) - ;; - esac +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