33 lines
885 B
Bash
33 lines
885 B
Bash
|
#!/bin/bash
|
||
|
set -e
|
||
|
install_path=/usr/local/share/advisorycircular
|
||
|
config_path=/etc/advisorycircular
|
||
|
user=advisorycircular
|
||
|
|
||
|
# Create install and config directories if they doesn't exist.
|
||
|
mkdir -p "$install_path"
|
||
|
mkdir -p "$config_path"
|
||
|
|
||
|
# Create advisory-circular user if it doesn't exist.
|
||
|
if ! id -u ${user} 2>/dev/null
|
||
|
then
|
||
|
adduser --system --home ${install_path} --no-create-home --quiet ${user}
|
||
|
fi
|
||
|
|
||
|
# Compile.
|
||
|
npm install
|
||
|
npx shadow-cljs compile script
|
||
|
|
||
|
# Install
|
||
|
install intervalexec.py advisorycircular "$install_path"/intervalexec
|
||
|
install advisorycircular.sh "$install_path"/advisorycircular
|
||
|
cp -r node_modules "$install_path"
|
||
|
cp -r .shadow-cljs "$install_path"
|
||
|
mkdir -p "$install_path"/out
|
||
|
cp out/advisorycircular.js "$install_path"/out
|
||
|
chown -R "$user" "$install_path"
|
||
|
|
||
|
cp config-skel.yaml "$config_path"
|
||
|
cp secrets-skel.yaml "$config_path"
|
||
|
chown -R "$user" "$config_path"
|