Skip to content

Commit 597c7b6

Browse files
committedDec 28, 2022
Debug install script
1 parent 18cb028 commit 597c7b6

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed
 

‎config/ipwarn-systemd-easy-install.sh

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
set -e
44
set -u
55

6-
if [ $EUID > 0 ]
6+
if [[ $EUID > 0 ]]
77
then echo "Please run as root"
88
exit
99
fi
1010

1111

1212
# Download files (program, config and service)
1313
echo "Downloading files..."
14-
mkdir /tmp/ipwarn-install
14+
mkdir -p /tmp/ipwarn-install
1515
pushd /tmp/ipwarn-install
1616
curl -O https://raw.githubusercontent.com/caldito/ipwarn/master/ipwarn
1717
curl -O https://raw.githubusercontent.com/caldito/ipwarn/master/config/ipwarn.conf
@@ -20,16 +20,16 @@ echo "Files downloaded successfully..."
2020

2121
# Create user
2222
echo "Creating user..."
23-
useradd --system ipwarn
23+
useradd --system ipwarn || true
2424
echo "User created successfully"
2525

2626
# Copy files and set permissions
27-
echo "Copying files and setting permissions"
27+
echo "Copying files and setting permissions..."
2828
cp ./ipwarn /usr/local/bin/ipwarn
2929
chown ipwarn:ipwarn /usr/local/bin/ipwarn
3030
chmod 755 /usr/local/bin/ipwarn
3131

32-
mkdir /etc/ipwarn
32+
mkdir -p /etc/ipwarn
3333
chown ipwarn:ipwarn /etc/ipwarn
3434
chmod 755 /etc/ipwarn
3535

@@ -45,12 +45,12 @@ echo "Files copied and permissions set successfully"
4545

4646
# Prepare systemd service
4747
echo "Preparing systemd service..."
48-
systemctl reload-daemon
48+
systemctl daemon-reload
4949
systemctl start ipwarn.service
50-
echo "Systemd service prepared successfully\n"
50+
printf "Systemd service prepared successfully\n\n"
5151

5252
# Finish
53-
echo "ipwarn installation completed successfully!\n"
53+
printf "ipwarn installation completed successfully!\n\n"
5454

5555
echo "The program is now running with the default config. You can edit the config in \"/etc/ipwarn/ipwarn.conf\" and then restart the ipwarn service runinng \"systemctl restart ipwarn\""
5656
echo "If you wish the service to run on startup run: systemctl enable ipwarn.service"

0 commit comments

Comments
 (0)
Please sign in to comment.