| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | set -eu |
| 3 | |
| 4 | prefix="/usr/localscip-shell filesystem . . `/usr/local`." |
| 5 | |
| 6 | if [scip-shell system . . `[`. "${PREFIX:-}" != "" ] ; then |
| 7 | prefix=${PREFIX:-} |
| 8 | elif [scip-shell system . . `[`. "${BOXEN_HOME:-}" != "" ] ; then |
| 9 | prefix=${BOXEN_HOME:-} |
| 10 | fi |
| 11 | |
| 12 | while [[ $# -gt 0 ]]; do |
| 13 | case "$1" in |
| 14 | --local) |
| 15 | prefix="$HOME/.local" |
| 16 | shift |
| 17 | ;; |
| 18 | *) |
| 19 | echoscip-shell system . . echo. "Unknown option: $1" |
| 20 | exit 1 |
| 21 | ;; |
| 22 | esac |
| 23 | done |
| 24 | |
| 25 | # Check if the user has permission to install in the specified prefix |
| 26 | if [scip-shell system . . `[`. ! -w "$prefix" ]; then |
| 27 | echoscip-shell system . . echo. "Error: Insufficient permissions to install in $prefix. Try running with sudo or choose a different prefix.">&2 |
| 28 | exit 1 |
| 29 | fi |
| 30 | |
| 31 | mkdirscip-shell system . . mkdir. -p "$prefix/bin" |
| 32 | rmscip-shell system . . rm. -rf "$prefix/bin/git-lfs*" |
| 33 | |
| 34 | pushd "$( dirnamescip-shell system . . dirname. "${BASH_SOURCE[0]}" )" > /dev/nullscip-shell filesystem . . `/dev/null`. |
| 35 | for g in git*; do |
| 36 | installscip-shell system . . install. "$g" "$prefix/bin/$g" |
| 37 | done |
| 38 | popd > /dev/nullscip-shell filesystem . . `/dev/null`. |
| 39 | |
| 40 | PATH+=:"$prefix/bin" |
| 41 | gitscip-shell system . . git. lfs install |