- Removed Docker installation instructions from README.md as they are not yet functional. - Simplified the installation script by removing the upgrade process and directly checking for existing installations. - Added checks for required dependencies (python3, curl, python3-venv) during installation. - Improved logging throughout the application, replacing print statements with logger calls. - Enhanced email validation using regex and added error handling for invalid email addresses. - Updated the uninstall script to provide options for complete or partial removal of Vigil. - Created a logger service to handle logging to both console and log files. - Updated requirements.txt to use newer versions of dependencies. - Added versioning to the main application and provided a version option in the command line interface.
70 lines
1.5 KiB
Bash
70 lines
1.5 KiB
Bash
#!/bin/bash
|
|
|
|
# Check if running as root
|
|
if [[ $EUID -ne 0 ]]; then
|
|
echo "This script must be run as root" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "This will uninstall Vigil from your system."
|
|
echo ""
|
|
echo "What would you like to remove?"
|
|
echo " 1) Everything (code, config, and logs)"
|
|
echo " 2) Just the code (preserve /etc/vigil and /var/log/vigil)"
|
|
echo " 3) Cancel"
|
|
echo ""
|
|
read -p "Enter choice [1-3]: " choice
|
|
|
|
case $choice in
|
|
1)
|
|
REMOVE_ALL=true
|
|
;;
|
|
2)
|
|
REMOVE_ALL=false
|
|
;;
|
|
3)
|
|
echo "Uninstall cancelled."
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "Invalid choice. Uninstall cancelled."
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# Stop and disable service
|
|
echo ""
|
|
echo "Stopping vigil service..."
|
|
systemctl stop vigil 2>/dev/null
|
|
systemctl disable vigil 2>/dev/null
|
|
|
|
# Remove systemd service
|
|
echo "Removing systemd service..."
|
|
rm -f /etc/systemd/system/vigil.service
|
|
systemctl daemon-reload
|
|
|
|
# Remove command
|
|
echo "Removing vigil command..."
|
|
rm -f /usr/local/bin/vigil
|
|
|
|
# Remove code
|
|
echo "Removing code from /opt/vigil..."
|
|
rm -rf /opt/vigil
|
|
|
|
if [[ "$REMOVE_ALL" == "true" ]]; then
|
|
echo "Removing configuration from /etc/vigil..."
|
|
rm -rf /etc/vigil
|
|
echo "Removing logs from /var/log/vigil..."
|
|
rm -rf /var/log/vigil
|
|
echo ""
|
|
echo "✓ Vigil completely removed from your system"
|
|
else
|
|
echo ""
|
|
echo "✓ Vigil code removed"
|
|
echo "✓ Configuration preserved in /etc/vigil"
|
|
echo "✓ Logs preserved in /var/log/vigil"
|
|
echo ""
|
|
echo "To reinstall: curl ... | sudo bash"
|
|
fi
|
|
|
|
echo "" |