3 # iank: fixed version of /usr/share/prometheus/alertmanager/generate-ui.sh, plus exit if already build
6 if [[ -e /usr
/share
/prometheus
/alertmanager
/ui
/index.html
]]; then
11 ELMDISTURL
=https
://github.com
/elm
/compiler
/releases
/download
/0.19.1/binary-for-linux-64-bit.gz
12 SRCDIR
=/usr
/share
/gocode
/src
/github.com
/prometheus
/alertmanager
/ui
/app
13 DSTDIR
=/usr
/share
/prometheus
/alertmanager
/ui
15 echo "Installing dependencies..." >&2
16 apt
install libjs-bootstrap4 fonts-font-awesome curl uglifyjs \
17 golang-github-prometheus-alertmanager-dev
19 #/usr/share/fonts-font-awesome/
22 echo "Downloading Elm tools..." >&2
24 curl
--location $ELMDISTURL | zcat
>$TMPDIR/elm
27 echo "Compiling source code..." >&2
28 ln -s $SRCDIR/src
$SRCDIR/elm.json
$TMPDIR
29 (cd $TMPDIR; .
/elm
make src
/Main.elm
--optimize --output $TMPDIR/app.js
)
31 echo "Optimising source code..." >&2
32 uglifyjs
$TMPDIR/app.js \
33 --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' \
34 --mangle --output $TMPDIR/script.js
36 echo "Installing in Alertmanager directory..." >&2
39 cp $TMPDIR/script.js
$DSTDIR
40 cp $SRCDIR/index.html
$SRCDIR/favicon.ico
$DSTDIR
41 ln -s /usr
/share
/fonts-font-awesome
$DSTDIR/lib
/font-awesome
42 ln -s /usr
/share
/nodejs
/bootstrap
/dist
$DSTDIR/lib
/bootstrap4
46 echo "Finished! Please, restart prometheus-alertmanager to activate UI." >&2