This commit is contained in:
Mikhail novosyolov 2018-08-01 02:59:02 +03:00
parent ffb162c415
commit 237c65b7a0
5 changed files with 39 additions and 34 deletions

33
Makefile Normal file
View File

@ -0,0 +1,33 @@
#
PREFIX = /
all:
@ echo "Nothing to compile. Use: make install, make uninstall, make systemd"
install:
install -d $(DESTDIR)/$(PREFIX)/usr/sbin
install -m0755 ./nohang $(DESTDIR)/$(PREFIX)/usr/sbin/nohang
install -d $(DESTDIR)/$(PREFIX)/etc/nohang
install -m0644 ./nohang.conf $(DESTDIR)/$(PREFIX)/etc/nohang
install -m0644 ./default_values_backup.conf $(DESTDIR)/$(PREFIX)/etc/nohang
install -d $(DESTDIR)/$(PREFIX)/usr/share/man/man1
gzip -k -c nohang.1 > $(DESTDIR)/$(PREFIX)/usr/share/man/man1/nohang.1.gz
install -d $(DESTDIR)/$(PREFIX)/lib/systemd/system
install -m0644 ./nohang.service $(DESTDIR)/$(PREFIX)/lib/systemd/system/nohang.service
uninstall:
# 'make uninstall' must not fail with error if systemctl is unavailable or returns error
systemctl disable nohang.service || true
rm -fv $(PREFIX)/usr/sbin/nohang
rm -fv $(PREFIX)/usr/share/man/man1/nohang.1.gz
rm -fv $(PREFIX)/lib/systemd/system/nohang.service
rm -fvr $(PREFIX)/etc/nohang/
systemd:
systemctl daemon-reload
systemctl enable nohang.service
systemctl restart nohang

View File

@ -67,13 +67,16 @@ $ cd nohang
## Installation and start for systemd users ## Installation and start for systemd users
```bash ```bash
$ sudo ./install.sh # to install:
$ sudo make install
# to enable and start systemd units:
$ sudo make systemd
``` ```
## Purge ## Purge
```bash ```bash
$ sudo ./purge.sh $ sudo make uninstall
``` ```
## Command line options ## Command line options

View File

@ -1,24 +0,0 @@
#!/bin/sh -v
cp nohang /usr/local/bin/
chmod 755 /usr/local/bin/nohang
mkdir /etc/nohang
chmod 755 /etc/nohang
cp nohang.conf /etc/nohang/
cp default_values_backup.conf /etc/nohang/
chmod 644 /etc/nohang/nohang.conf
chmod 644 /etc/nohang/default_values_backup.conf
gzip -k nohang.1
mkdir /usr/local/share/man/man1
chmod 755 /usr/local/share/man/man1
cp nohang.1.gz /usr/local/share/man/man1/
chmod 644 /usr/local/share/man/man1/nohang.1.gz
rm nohang.1.gz
cp nohang.service /etc/systemd/system/
chmod 644 /etc/systemd/system/nohang.service
systemctl daemon-reload
systemctl enable nohang
systemctl restart nohang

View File

@ -4,7 +4,7 @@ After=sysinit.target
Documentation=man:nohang(1) https://github.com/hakavlad/nohang Documentation=man:nohang(1) https://github.com/hakavlad/nohang
[Service] [Service]
ExecStart=/usr/local/bin/nohang ExecStart=/usr/sbin/nohang
Restart=always Restart=always
[Install] [Install]

View File

@ -1,7 +0,0 @@
#!/bin/sh -v
systemctl stop nohang
systemctl disable nohang
rm /usr/local/bin/nohang
rm /usr/local/share/man/man1/nohang.1.gz
rm /etc/systemd/system/nohang.service
rm -r /etc/nohang