-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbs-bashpatch.sh
More file actions
executable file
·47 lines (36 loc) · 894 Bytes
/
bs-bashpatch.sh
File metadata and controls
executable file
·47 lines (36 loc) · 894 Bytes
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
#!/bin/bash
set -eux
URL="https://www.bluesound.com/downloads/"
# Create directories
tmp=$(realpath $(mktemp -d bluos-controller.XXX))
cleanup() {
rm -rf "$tmp"
}
trap cleanup INT QUIT TERM
# Find latest version
archive_url=$(lynx -dump -listonly -nonumbers "$URL" |
grep -e '/BluOS-Controller-.*dmg' |
sort -r |
tail -n 1)
# Download
mkdir -p downloads
wget -N -P downloads "$archive_url"
# Unpack
7z e "downloads/${archive_url##*/}" -r app.asar -o"$tmp"
npm add --save-dev npx
npx asar extract "$tmp/app.asar" "$tmp/app"
# Install dependencies
cd "$tmp/app"
npm install --save-dev electron-builder electron@^9.0.0 js-beautify
# Apply patches
npx js-beautify -r www/app.js
for patch_file in "$OLDPWD"/patches/*.patch
do
patch -p0 < "$patch_file"
done
# Build
npx electron-builder -l AppImage
# Move results
mv dist/*.AppImage "$OLDPWD/output"
# Cleanup
cleanup