diff --git a/README.md b/README.md index cd5d13b..85d4daf 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,11 @@ ## 📚 Table of Contents +- [📚 Table of Contents](#-table-of-contents) - [About The Project](#about-the-project) - [Built With](#built-with) +- [Getting Started](#getting-started) +- [Uninstalling](#uninstalling) --- @@ -59,7 +62,18 @@ ## Getting Started -Not yet :/ +```bash +wget -qO- https://raw.githubusercontent.com/orus-dev/sentryx/refs/heads/master/install.sh | bash +``` + +## Uninstalling +```bash +sh $HOME/sentryx-server/uninstall.sh +``` +If that fails +```bash +wget -qO- https://raw.githubusercontent.com/orus-dev/sentryx/refs/heads/master/uninstall.sh | bash +``` [contributors-shield]: https://img.shields.io/github/contributors/orus-dev/sentryx.svg?style=flat-square&color=blue&label=contributors [contributors-url]: https://github.com/orus-dev/sentryx/graphs/contributors diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..b30e61f --- /dev/null +++ b/install.sh @@ -0,0 +1,49 @@ +#!/bin/bash +set -e + +REPO_URL="https://github.com/orus-dev/sentryx.git" +INSTALL_DIR="$HOME/sentryx" # expanded +SERVICE_NAME="sentryx" +SERVICE_FILE="/etc/systemd/system/$SERVICE_NAME.service" +NODE_BIN="$(which node)" +RUN_USER="$(whoami)" # change if needed + +# Backup if exists +if [ -d "$INSTALL_DIR" ]; then + echo "Sentryx already exists, backing up..." + rm -rf "$INSTALL_DIR-backup" + mv "$INSTALL_DIR" "$INSTALL_DIR-backup" +fi + +# Clone as current user +git clone "$REPO_URL" "$INSTALL_DIR" + +# Build as current user inside INSTALL_DIR +cd $INSTALL_DIR +npm install +npm run build + +# Create systemd service file with absolute ExecStart path +echo "Creating systemd service..." +sudo tee "$SERVICE_FILE" > /dev/null <