diff --git a/assets/install b/assets/install index 7ff9e9b..4575a28 100644 --- a/assets/install +++ b/assets/install @@ -8,7 +8,6 @@ nightly=${NIGHTLY:-0} verify=${VERIFY:-0} local=${LOCAL:-0} use_sudo=${USE_SUDO:-0} -force_update=${FORCE_UPDATE:-0} usage() { echo "Options:" @@ -18,7 +17,6 @@ usage() { echo " -d , --dest Set install destination (default /usr/local/bin)" echo " -V, --verify Verify gpg signature" echo " -l, --local Verify gpg signature with local keychain" - echo " -F, --force Force re-install even if flow is up-to-date" exit 1 } @@ -33,7 +31,7 @@ while true; do shift 1 ;; -d | --dest) - install_dir=$2 + install_dir=/$2 shift 2 ;; -V | --verify) @@ -44,10 +42,6 @@ while true; do local=1 shift 1 ;; - -F | --force) - force_update=1 - shift 1 - ;; -h | --help) usage ;; @@ -88,6 +82,21 @@ if [ -z "$need_sudo" ] && [ -e "$install_dir/f" ]; then fi fi +if [ "$use_sudo" -eq 0 ] && [ -n "$need_sudo" ]; then + printf "%s is not writable. Permissions will be requested with sudo.\n" "$need_sudo" + use_sudo=1 +fi + +SUDOCMD="" +if [ -n "$need_sudo" ]; then + if [ "$use_sudo" -eq 1 ]; then + SUDOCMD=sudo + else + echo "error: '$need_sudo' is not writable." + exit 1 + fi +fi + # prompt for nightly build option if interactive if [ "$nightly" -eq 0 ] && [ "$have_term" -eq 1 ]; then printf "do you want to install a Nightly build? [y/N]: " @@ -145,33 +154,6 @@ version=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | grep '" } title="$title $version" -if [ "$force_update" -eq 0 ] && [ -e "$install_dir/flow" ]; then - current_version=$(flow --version 2>/dev/null | grep version: | cut -f2 -d ' ') - if [ "$current_version" = "$version" ]; then - echo "flow is up-to-date (version $version @ $install_dir/flow)" - exit 0 - else - if [ -n "$current_version" ]; then - echo "updating flow from $current_version to $version" - fi - fi -fi - -if [ "$use_sudo" -eq 0 ] && [ -n "$need_sudo" ]; then - printf "%s is not writable. Permissions will be requested with sudo.\n" "$need_sudo" - use_sudo=1 -fi - -SUDOCMD="" -if [ -n "$need_sudo" ]; then - if [ "$use_sudo" -eq 1 ]; then - SUDOCMD=sudo - else - echo "error: '$need_sudo' is not writable." - exit 1 - fi -fi - # construct download url # note: nightly assets are named like "flow---." filename="flow-$version-$os-$arch"