File: install.sh

package info (click to toggle)
git-lfs 3.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,808 kB
  • sloc: sh: 21,256; makefile: 507; ruby: 417
file content (41 lines) | stat: -rwxr-xr-x 803 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
set -eu

prefix="/usr/local"

if [ "${PREFIX:-}" != "" ] ; then
  prefix=${PREFIX:-}
elif [ "${BOXEN_HOME:-}" != "" ] ; then
  prefix=${BOXEN_HOME:-}
fi

while [[ $# -gt 0 ]]; do
  case "$1" in
    --local)
      prefix="$HOME/.local"
      shift
      ;;
    *)
      echo "Unknown option: $1"
      exit 1
      ;;
  esac
done

# Check if the user has permission to install in the specified prefix
if [ ! -w "$prefix" ]; then
  echo "Error: Insufficient permissions to install in $prefix. Try running with sudo or choose a different prefix.">&2
  exit 1
fi

mkdir -p "$prefix/bin"
rm -rf "$prefix/bin/git-lfs*"

pushd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null
  for g in git*; do
    install "$g" "$prefix/bin/$g"
  done
popd > /dev/null

PATH+=:"$prefix/bin"
git lfs install