Fixes
This commit is contained in:
1 parent
51ec6f451c
commit
1c056de3b0
1 file changed
+15
-12
+15
-12
@@ -36,9 +36,9 @@ check_dependencies() {
|
|||||||
for dep in "${missing[@]}"; do
|
for dep in "${missing[@]}"; do
|
||||||
if yes_no_prompt "📦 Do you want to install $dep?"; then
|
if yes_no_prompt "📦 Do you want to install $dep?"; then
|
||||||
case $dep in
|
case $dep in
|
||||||
curl ) apt-get install -y curl ;;
|
curl ) sudo apt-get install -y curl ;;
|
||||||
node ) curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh && bash nodesource_setup.sh && apt-get install -y nodejs && rm -f nodesource_setup.sh ;;
|
node ) curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh && sudo bash nodesource_setup.sh && sudo apt-get install -y nodejs && rm -f nodesource_setup.sh ;;
|
||||||
git ) add-apt-repository ppa:git-core/ppa && apt-get update && apt-get -y install git ;;
|
git ) sudo add-apt-repository ppa:git-core/ppa && sudo apt-get update && sudo apt-get -y install git ;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
echo "❌ Cannot proceed without $dep. Exiting..."
|
echo "❌ Cannot proceed without $dep. Exiting..."
|
||||||
@@ -81,7 +81,7 @@ validate_token() {
|
|||||||
if [[ ! -f /var/log/ufw.log ]]; then
|
if [[ ! -f /var/log/ufw.log ]]; then
|
||||||
read -r -p "🔍 /var/log/ufw.log not found. Please enter the path to your log file: " ufw_log_path
|
read -r -p "🔍 /var/log/ufw.log not found. Please enter the path to your log file: " ufw_log_path
|
||||||
if [[ -f $ufw_log_path ]]; then
|
if [[ -f $ufw_log_path ]]; then
|
||||||
echo "✅ Log file found at $ufw_log_path."
|
echo "✅ Log file found at $ufw_log_path"
|
||||||
else
|
else
|
||||||
echo "❌ Provided log file path does not exist. Exiting..."
|
echo "❌ Provided log file path does not exist. Exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
@@ -116,7 +116,7 @@ done
|
|||||||
# Prompt for system update and upgrade
|
# Prompt for system update and upgrade
|
||||||
if yes_no_prompt "🛠️ Do you want the script to run apt update and apt upgrade for you?"; then
|
if yes_no_prompt "🛠️ Do you want the script to run apt update and apt upgrade for you?"; then
|
||||||
echo "🔧 Updating and upgrading the system..."
|
echo "🔧 Updating and upgrading the system..."
|
||||||
apt-get update && apt-get upgrade
|
sudo apt-get update && sudo apt-get upgrade
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clone repository & set permissions
|
# Clone repository & set permissions
|
||||||
@@ -164,7 +164,7 @@ fi
|
|||||||
|
|
||||||
# Change permissions for UFW log file
|
# Change permissions for UFW log file
|
||||||
echo "🔒 Changing permissions for $ufw_log_path..."
|
echo "🔒 Changing permissions for $ufw_log_path..."
|
||||||
chmod 644 "$ufw_log_path"
|
sudo chmod 644 "$ufw_log_path"
|
||||||
|
|
||||||
# Uninstall corepack
|
# Uninstall corepack
|
||||||
echo "🗑️ Uninstalling corepack..."
|
echo "🗑️ Uninstalling corepack..."
|
||||||
@@ -179,14 +179,17 @@ echo "📂 Creating /var/log/ufw-abuseipdb directory..."
|
|||||||
sudo mkdir -p /var/log/ufw-abuseipdb
|
sudo mkdir -p /var/log/ufw-abuseipdb
|
||||||
sudo chown "$USER":"$USER" /var/log/ufw-abuseipdb -R
|
sudo chown "$USER":"$USER" /var/log/ufw-abuseipdb -R
|
||||||
|
|
||||||
# Configure pm2
|
# Configure PM2
|
||||||
echo "⚙️ Configuring PM2..."
|
echo "⚙️ Configuring PM2..."
|
||||||
pm2 start
|
startup_command=$(pm2 startup | grep "sudo env PATH" | sed 's/^[^s]*sudo/sudo/')
|
||||||
pm2 startup
|
|
||||||
|
|
||||||
# Execute the command generated by pm2 startup
|
if [ -n "$startup_command" ]; then
|
||||||
echo "🔧 Complete pm2 startup configuration (for $USER):"
|
echo "🔧 Executing PM2 startup command..."
|
||||||
sudo env PATH="$PATH":/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u "$USER" --hp /opt/"$USER"
|
echo "📝 $startup_command"
|
||||||
|
eval "$startup_command"
|
||||||
|
else
|
||||||
|
echo "❌ Failed to find the command generated by 'pm2 startup'! PM2 was not added to autostart."
|
||||||
|
fi
|
||||||
|
|
||||||
pm2 save
|
pm2 save
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user