Skip to content

Commit

Permalink
chore: add dkms hook and uninstall target
Browse files Browse the repository at this point in the history
  • Loading branch information
Blaok authored and Lochnair committed Sep 7, 2018
1 parent b5a27c9 commit 3ea743e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 5 deletions.
10 changes: 8 additions & 2 deletions Makefile
Expand Up @@ -14,9 +14,15 @@ install:
clean:
$(MAKE) -C src clean
$(MAKE) -C ipt clean
dkms:
dkms-install:
. ./dkms.conf; \
cp -R . /usr/src/$${PACKAGE_NAME}-$${PACKAGE_VERSION}; \
mkdir /usr/src/$${PACKAGE_NAME}-$${PACKAGE_VERSION}; \
cp -r * /usr/src/$${PACKAGE_NAME}-$${PACKAGE_VERSION}; \
dkms add -m $${PACKAGE_NAME} -v $${PACKAGE_VERSION}; \
dkms build -m $${PACKAGE_NAME} -v $${PACKAGE_VERSION}; \
dkms install -m $${PACKAGE_NAME} -v $${PACKAGE_VERSION}
dkms-uninstall:
. ./dkms.conf; \
dkms uninstall -m $${PACKAGE_NAME} -v $${PACKAGE_VERSION}; \
dkms remove -m $${PACKAGE_NAME} -v $${PACKAGE_VERSION} --all; \
rm -rf /usr/src/$${PACKAGE_NAME}-$${PACKAGE_VERSION}
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -32,7 +32,7 @@ sudo make install
```bash
git clone https://github.com/Lochnair/xt_tls.git
cd xt_tls
sudo make dkms
sudo make dkms-install
```

## Usage
Expand Down
2 changes: 2 additions & 0 deletions dkms.conf
Expand Up @@ -6,3 +6,5 @@ BUILT_MODULE_LOCATION=src/
PACKAGE_NAME=xt_tls
PACKAGE_VERSION=0.2
REMAKE_INITRD=yes
POST_INSTALL=dkms/post-install.sh
POST_REMOVE=dkms/post-remove.sh
3 changes: 3 additions & 0 deletions dkms/post-install.sh
@@ -0,0 +1,3 @@
#!/bin/sh
make -C ipt
make -C ipt install
2 changes: 2 additions & 0 deletions dkms/post-remove.sh
@@ -0,0 +1,2 @@
#!/bin/sh
make -C ipt uninstall
5 changes: 3 additions & 2 deletions ipt/Makefile
Expand Up @@ -2,8 +2,7 @@ CFLAGS = -I../src -fPIC
DESTDIR ?= /
XTABLES_LIB=$(shell pkg-config --variable=xtlibdir xtables)

all:
make libxt_tls.so
all: libxt_tls.so
lib%.so: lib%.o
$(CC) -shared -o $@ $^;
lib%.o: %lib%.c
Expand All @@ -12,3 +11,5 @@ clean:
rm -rf libxt_tls.so
install:
install -D -v -m 644 libxt_tls.so $(DESTDIR)$(XTABLES_LIB)
uninstall:
rm $(DESTDIR)$(XTABLES_LIB)/libxt_tls.so

0 comments on commit 3ea743e

Please sign in to comment.