git ssb

39+

cel / git-ssb



Tree: d0c588a1458e335a592c0b56e50fa581b8592823

Files: d0c588a1458e335a592c0b56e50fa581b8592823 / git-ssb-2.7.0-binary-install.sh

3097 bytesRaw
1#!/bin/sh
2# git-ssb v2.7.0 binary installer.
3
4# Copyright 2020 cel @f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519
5# Usage of the works is permitted provided that this instrument is
6# retained with the works, so that any entity that uses the works is
7# notified of this instrument.
8# DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
9
10{ # Only execute if entire script is read
11
12version=2.7.0
13blobs_prefix=${BLOBS_PREFIX:-http://localhost:8989/blobs/get}
14max_tries=10
15
16is_dir_in_path() { case ":$PATH:" in *:"$dir":*) return 0;; *) return 1;; esac }
17
18# Pick installation directory.
19# $BIN_DIR overrides.
20if [ -n "$BIN_DIR" ]; then
21 dir=$BIN_DIR
22else
23 # If root user, install system-wide.
24 # Prefer $PREFIX/bin if set.
25 if [ ${UID:-$(id -u)} = 0 ]
26 then set -- "${PREFIX:+$PREFIX/bin}" /usr/local/bin /opt/bin
27 else set -- "${PREFIX:+$PREFIX/bin}" ~/.local/bin ~/bin /usr/local/bin /opt/bin
28 fi
29 # Try to find a directory that is writable and in $PATH.
30 for dir; do
31 is_dir_in_path "$dir" && break || false
32 done || for dir; do
33 # Fall back to use or create a sensible directory.
34 mkdir -vp "$dir" && {
35 is_dir_in_path "$dir" || printf 'Warning: install directory is not in $PATH\n' >&2
36 }
37 done || {
38 printf 'Unable to find directory to install to.' >&2
39 exit 1
40 }
41fi
42
43cd "$dir" || exit 1
44
45system=$(uname -sm)
46case "$system" in
47 Linux\ aarch64) set -- \
48 '&FuEB1/cg0lDFQLtTs9ssgZVUsLNGIK4AzeoNWcvczHY=.sha256' \
49 '&htorGp8VGgPm26OX+so4yeTLmefStU0D8I0Nal1L9TM=.sha256' \
50 '&aeAukW57G8IDHw+cZhnWWt612/wTuHlGlxvF6+TKI5E=.sha256' \
51 '&LDJzHMS/WB6d6koLZWTjW2bV40xafZRmUixzMtxQtXI=.sha256' \
52 '&tdxQN/2eqG1jffYhICvm/Jur5alAxg74wwbA/hnHa2k=.sha256';;
53
54 Linux\ i686) set -- \
55 '&9GLKZFDOQcvGKrdIaSZ0Lae2ECTpIutrdLkQvEWCsZQ=.sha256' \
56 '&qNnPksNvZb7Fu3vIxQVSEkuhJkT0Se35ENNOYq0n2d0=.sha256' \
57 '&s+r8iLtDH3omWt0s+TOUjaXNhTTo5T6QOt+uQViVyhA=.sha256';;
58
59 Linux\ armv7l) set -- \
60 '&ChBEP/AQTlpEcHhJIZ/q4NjJUCu4mcTs2fZV5lFdXWw=.sha256' \
61 '&M+0VduMNaixEe3dRS4YtYHS21+dZzZC/na8iTF2dMZ0=.sha256' \
62 '&wYo+DyX0D/Jog24Y4cElta21xwesKF9lSpdWQ8sgRUQ=.sha256' \
63 '&Xu3D6uHGm6nhnGMVTke/T6Wc/tOXZndBVevaQCvLLCM=.sha256';;
64
65 Linux\ x86_64) set -- \
66 '&i3zGqeyKY/kiPB16QEoYyNfhaTlUp6SMpWnoUMC3QDI=.sha256' \
67 '&/iwz3UVEV+tcF/E7t8h8XIAIyMiCZc+949jJV4EbTUk=.sha256' \
68 '&SAA+m3ha1EIzRp7tHKSDDdWe3jJZ4RhgGuhpSs5wqhc=.sha256' \
69 '&d7M41GGbclGr9I7lrV2WABfiYcC1nztYoEH1z+epKEA=.sha256';;
70
71 Darwin*\ x86_64) set -- \
72 '&29FiLMMYVKaq9BAx9FCRpwh+Z3vjivaZlX93PqvQIOk=.sha256' \
73 '&4cUioC57AHK0NBo5lIyawWJhn0EQFzovqgKIfCfiTp4=.sha256' \
74 '&XYKxDOrVnDfaijhojKC6mPzBtyF5mczNOEpJXElhzcg=.sha256';;
75
76 *)
77 printf 'System not recognized: %s\n' "$system" >&2
78 exit 1
79 ;;
80esac
81
82printf 'Installing git-ssb %s to %s\n' "$version" "$dir"
83
84# Want each blob in parallel
85for id; do curl -sSI -o /dev/null "$blobs_prefix/$id" & done
86
87# Fetch, concat, and extract blobs
88tries=0
89while ! for id
90do
91 printf "%s\n" "$id" >&2
92 curl -sS "$blobs_prefix/$id"
93done | tar xvz
94do
95 if [ $((tries = tries + 1)) -ge $max_tries ]
96 then
97 printf 'Unable to get blobs\n' >&2
98 exit 1
99 fi
100 sleep 1
101done
102
103echo 'Installation complete.'
104
105}
106

Built with git-ssb-web