aboutsummaryrefslogtreecommitdiff
path: root/binary-install-1.5.1.sh
blob: a6fed1ef38c45afb6d8a4626e403a18673a81670 (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
155
#!/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 -- \
    '&Jc9/FPgceGCuFXuNqwKKGZ8L473eROk+hC77/ASoJXo=.sha256' \
    '&PNIHuOe1UQbXlYQEeUSjWaqed89Ofnm/9rvRKn2UZx8=.sha256' \
    '&qHjyUv4KXapV9Ov18Dpe8JE2m+HADwa4renY5s/s4yA=.sha256' \
    '&V8nCNHM+qehWik635M3eOECGjJCdFlCmT26tFZPSeyc=.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": "&QgahmPYImelvhuCkBlpGwAIAYz0n6Wf5saxhC443bcw=.sha256",
      "size": 2006279
    }
  ],
  "vfsBlobs": [
    {
      "link": "&5FR5YRjuivUISmFAgUFjCwNyPEQtKCPgvODy1MjN0ro=.sha256",
      "size": 170580
    }
  ],
  "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": "&xkfpCir6wO2O+H+5fX4yUDglEO9BSENzsDAsEU8jn0w=.sha256",
          "size": 350840
        }
      ],
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/linux-x64/node.abi72.node": [
        {
          "link": "&jmU1pe8u2k8T7RorVuVranTiHRDU0slhOle4FaslkWE=.sha256",
          "size": 258696
        }
      ]
    },
    "linux-arm": {
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/linux-arm/libsodium.so.23": [
        {
          "link": "&RQlPII/l+Wi+RRfhZhGHUHy4oBHAdza+fpKR0X6r7ZY=.sha256",
          "size": 316988
        }
      ],
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/linux-arm/node.abi72.node": [
        {
          "link": "&o4YuWR2yE6UgTYkMhKYu7sv9LC9aJCD3dnCw0rDvOyo=.sha256",
          "size": 208092
        }
      ]
    },
    "linux-arm64": {
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/linux-arm64/libsodium.so.23": [
        {
          "link": "&yd3bUP7LOKp0bupg1uVdcrG76pHgNQQZwXKZr39aLIY=.sha256",
          "size": 186456
        }
      ],
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/linux-arm64/node.abi72.node": [
        {
          "link": "&CU0SgLTi6yDE/cu0FHwTyNdV8YcGI6SkPwDLMk7rO80=.sha256",
          "size": 262552
        }
      ]
    },
    "linux-ia32": {
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/linux-ia32/libsodium.so.23": [
        {
          "link": "&OJ3FP9WsuTfVWqRZxTALEs+2ySz5GD9FI4p7WqzeYok=.sha256",
          "size": 427400
        }
      ],
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/linux-ia32/node.abi72.node": [
        {
          "link": "&T/ypp7mNF7nJILu6hPgvRJ5hkw87ljeEHKEzl/EUXdc=.sha256",
          "size": 268932
        }
      ]
    },
    "darwin-x64": {
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/darwin-x64/libsodium.dylib": [
        {
          "link": "&OwrqYgZTxwX7Atiw82wg7kl7nERCnY76BPsO7RuEiD4=.sha256",
          "size": 395136
        }
      ],
      "/snapshot/patchfoo/node_modules/sodium-native/prebuilds/darwin-x64/node.abi72.node": [
        {
          "link": "&C8jvyOk2eRXuuYmqyKBNh1BKfIIyMchfk3x2m1L/7uc=.sha256",
          "size": 214848
        }
      ]
    }
  }
}
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