advisory-circular/install.sh

33 lines
885 B
Bash
Raw Normal View History

2020-05-04 00:02:26 +00:00
#!/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"