2024-07-20 08:36:21 -07:00
|
|
|
#!/bin/bash
|
|
|
|
CRONICLE_DIR=$(dirname "$(realpath "$BASH_SOURCE")")
|
|
|
|
unset CRONICLE_UPGRADE
|
|
|
|
if [[ $1 == "upgrade" ]]; then CRONICLE_UPGRADE=true; shift; fi
|
2024-07-20 09:04:45 -07:00
|
|
|
pushd "$CRONICLE_DIR" || exit
|
2024-07-20 08:36:21 -07:00
|
|
|
if [[ ! -d bin ]] || [[ $CRONICLE_UPGRADE ]] ; then
|
|
|
|
if [[ ! -d $CRONICLE_DIR/cronicle-edge ]]; then
|
|
|
|
git clone https://github.com/cronicle-edge/cronicle-edge.git
|
|
|
|
fi
|
2024-07-20 09:04:45 -07:00
|
|
|
pushd cronicle-edge || exit
|
2024-07-20 08:36:21 -07:00
|
|
|
git pull origin main
|
|
|
|
npm package update
|
2024-07-20 09:04:45 -07:00
|
|
|
./bundle "$@" "$CRONICLE_DIR" -f
|
|
|
|
popd || exit
|
2024-07-20 08:36:21 -07:00
|
|
|
if [[ ! -d "nodejs" ]]; then
|
|
|
|
echo "installing nodejs for cronicle"
|
|
|
|
bash bin/getnode.sh
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
# install systemd service
|
|
|
|
# if [[ ! -f /etc/systemd/system/cronicle.service ]]; then
|
|
|
|
export CRONICLE_DIR=$CRONICLE_DIR
|
|
|
|
sed 's|@BINDIR@|'"$CRONICLE_DIR"'/bin|g' cronicle.service.tpl | sed 's|@CDIR@|'"$CRONICLE_DIR"'|g' | sudo tee /etc/systemd/system/cronicle.service
|
|
|
|
# ls -la /etc/systemd/system | grep cronicle
|
|
|
|
# cat /etc/systemd/system/cronicle.service
|
|
|
|
# fi
|
2024-07-20 09:04:45 -07:00
|
|
|
if [[ ! -d data ]] && [[ $1 == "primary" ]]; then
|
|
|
|
echo "installing as cronicle primary server"
|
2024-07-20 08:36:21 -07:00
|
|
|
bash control setup
|
|
|
|
fi
|
|
|
|
# ln -s $CRONICLE_DIR/conf/ $CRONICLE_DIR/dist
|
|
|
|
# mkdir $CRONICLE_DIR/logs/
|
|
|
|
# ln -s $CRONICLE_DIR/logs/ $CRONICLE_DIR/dist/
|
|
|
|
# mkdir $CRONICLE_DIR/data/
|
|
|
|
# ln -s $CRONICLE_DIR/data/ $CRONICLE_DIR/dist/
|
2024-07-20 09:04:45 -07:00
|
|
|
popd || exit
|