aboutsummaryrefslogtreecommitdiff
path: root/binary-install-1.6.0.sh
blob: fb950bd248add6e9ded0eabc2272c1811a9fa872 (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/sh
blobs_base=${SSB_BLOBS_BASE:-http://localhost:8989/blobs/get/}

system=$(uname -sm) || exit 1
case "$system" in
  Linux\ x86_64) set -- \
    '&hZbFmTg0iAA2A8oFsa9h0xnUaQcwha3Uc3L3UqXGRLQ=.sha256' \
    '&ZZ5WetGZ8XE+EDV1WpnFTnvC+bwwna7GJAh71moEZdo=.sha256' \
    '&9yI3nXRAnvHL8CHRjBekuNAX49Mr62x3ED5pJCeox8E=.sha256' \
    '&mvroGi396ddexK8P8rG7LB7Aa7tSy41HWOUKkcj/f70=.sha256';;

  Linux\ armv7l) set -- \
    '&6wUnJemNZL4shqMtY9WuAVvawLDd2FTJ41rRK8UHmnk=.sha256' \
    '&zCLxOnVldm15btsYdE+I4oBx8qBS1vik1Li2vBOq6+w=.sha256' \
    '&u7VGC7ZGAPmWVdOK4TrPUy8aZJdEEIdEhZCKiZr+sww=.sha256';;

  Linux\ aarch64) set -- \
    '&YipJtv476bRmvbTinajIqj9s61h7/ltqwYpANup3Kb0=.sha256' \
    '&2Sy49KEmcNoLSOTUoqE6ZAA1qABRvEzpJlQijt5f3Mk=.sha256' \
    '&q4Fv+iiL+px4GIr0Zpwk1MFf1/DlT/5smU2ErpxQMp0=.sha256';;

  Linux\ i686) set -- \
    '&irNubuQ8WiKiRqurQa/jg1bs31Y28WOn1qfX7Ht2D34=.sha256' \
    '&9H8hgabAi6HDmbiNBGPuly7WxDzpR+3S8/jNcbFWPJE=.sha256' \
    '&fbFIoiLnYOmrj6nbgtdbPOUtllfc9i9VOMaLZiWMgrQ=.sha256' \
    '&E/lR2RF3arDd6YU41lcjSalNFCf/ZuB/kQDz0zOtrwk=.sha256';;

  Darwin*\ x86_64) set -- \
    '&ZAhFFGRgf14kUiRlUx0wMOoL7yGluiLUME2XxmiLNt0=.sha256' \
    '&vjbdlUdW0MtVO7iRseEWpMYZlk4fefVsO5+ljYL7ckE=.sha256' \
    '&Ork3//T8ogpZ3lOQRg0Z5Uw+MdJLNpWTo6OWysqIrkE=.sha256';;

  *)
    printf 'System not recognized: %s\n' "$system" >&2
    exit 1
    ;;
esac

install_js_blob='&Tf/6MqAfPUhyEpL6nLzyLoosc/h9qIvG0YM2FxTTYkU=.sha256'
exec 3<<EOF
{
  "preludeBlobs": [
    {
      "link": "&2AMoW67mf2KJjmi5Krjkh9klw2vlQtXKbAYwPFKM75M=.sha256",
      "size": 58477
    }
  ],
  "payloadBlobs": [
    {
      "link": "&l2ZcJ6A5MqgbX0JXkVRBBU2dgBdDnM47tJImpF+bOk8=.sha256",
      "size": 2052334
    }
  ],
  "vfsBlobs": [
    {
      "link": "&CDhy5HTLjEpbzxzM5GbYLwRvBBs5sUhOjitYcADoIwo=.sha256",
      "size": 172228
    }
  ],
  "binName": "patchfoo",
  "entrypoint": "/snapshot/patchfoo/server.js",
  "otherEntrypoints": {},
  "bakes": [],
  "fileBlobs": {
    "linux-x64": {
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/linux-x64/libsodium.so.23": [
        {
          "link": "&NZls/6/XCnKGgR8G7VYp/HREnqcdzRo1UKzUjA5EUPc=.sha256",
          "size": 359032
        }
      ],
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/linux-x64/node.napi.node": [
        {
          "link": "&o5lfdscfDSox8T4tGovJ4LRtuoB/OZQUf/tmp6pxbq0=.sha256",
          "size": 237040
        }
      ]
    },
    "linux-arm": {
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/linux-arm/libsodium.so.23": [
        {
          "link": "&WDmqytxRg6+8feJmaYQmj557uyL0pdH9a7fS7tMK81I=.sha256",
          "size": 271860
        }
      ],
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/linux-arm/node.napi.node": [
        {
          "link": "&5zQDiOhdAvDhpJ3kqW61EjF5ahAszqOksA/sslmDq/0=.sha256",
          "size": 236068
        }
      ]
    },
    "linux-arm64": {
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/linux-arm64/libsodium.so.23": [
        {
          "link": "&n3I5o8LPUEXuymEkEEhVlMAr6gUDL2geyXadZ2FyTH0=.sha256",
          "size": 202904
        }
      ],
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/linux-arm64/node.napi.node": [
        {
          "link": "&k2m6kezfzS63pB95QsnebTVMM7zhebPC+sNlryq2iPc=.sha256",
          "size": 216320
        }
      ]
    },
    "linux-ia32": {
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/linux-ia32/libsodium.so.23": [
        {
          "link": "&lWEU2O5wovfATth0ubNU6q9avv02ohJGhXyhcBmaDls=.sha256",
          "size": 435696
        }
      ],
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/linux-ia32/node.napi.node": [
        {
          "link": "&YT33d/f0xwvHDouy58Y+PoIzrMjUSeuEuB24vYwTaJ8=.sha256",
          "size": 210972
        }
      ]
    },
    "darwin-x64": {
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/darwin-x64/libsodium.dylib": [
        {
          "link": "&C9yYrmAyE5sRSn/clYUk8oQWPd2H8duE99xGwiNv+ac=.sha256",
          "size": 413328
        }
      ],
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/darwin-x64/node.napi.node": [
        {
          "link": "&ypNp9SnCsVyCsp0pccKf3Oc2hGgt1xCxylKF8ki3Jmw=.sha256",
          "size": 200692
        }
      ]
    }
  }
}
EOF

tmp_dir=$(mktemp -d "${TMPDIR:-/tmp}/ssb-pkg.XXXXXXXXX") || exit 1
node_bin="$tmp_dir/ssb-pkg-node-$$"
install_js="$tmp_dir/ssb-pkg-install-$$"

while ! for id; do
  echo "$id" >&2
  curl -sS "$blobs_base$id"
done | gunzip > "$node_bin"; do sleep 2; done
chmod +x "$node_bin"

while ! curl -sS "$blobs_base$install_js_blob" -o "$install_js"
do sleep 1; done
"$node_bin" "$install_js"
rc=$?
rm -rf "$tmp_dir"
exit $rc