-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.release
34 lines (32 loc) · 1.32 KB
/
Makefile.release
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
OS_NAME:=$(shell grep -E '^ID=' /etc/os-release | cut -d'=' -f2 | tr -d '"')
SHELL:=/bin/bash
ADDUSER_FLAGS:=
ifeq (${OS_NAME},centos)
ADDUSER_FLAGS=-r -d /dev/null -s /sbin/nologin
else ifeq (${OS_NAME},almalinux)
ADDUSER_FLAGS=-r -d /dev/null -s /sbin/nologin
else ifeq (${OS_NAME},ubuntu)
ADDUSER_FLAGS=--system --no-create-home --shell /sbin/nologin --group
else
ADDUSER_FLAGS=--system --no-create-home --shell /sbin/nologin --group
endif
.PHONY: install
install:
cp bin/irodsfs-pool /usr/bin
cp install/irodsfs-pool.service /usr/lib/systemd/system/
id -u irodsfs-pool &> /dev/null || adduser ${ADDUSER_FLAGS} irodsfs-pool
mkdir -p /etc/irodsfs-pool
cp install/config.yaml /etc/irodsfs-pool
chown irodsfs-pool:irodsfs-pool /etc/irodsfs-pool/config.yaml
chmod 660 /etc/irodsfs-pool/config.yaml
mkdir -p $$(awk '/data_root_path:/ {print $$2}' /etc/irodsfs-pool/config.yaml)
chown irodsfs-pool:irodsfs-pool $$(awk '/data_root_path:/ {print $$2}' /etc/irodsfs-pool/config.yaml)
.PHONY: uninstall
uninstall:
rm -f /usr/bin/irodsfs-pool
rm -f /etc/systemd/system/multi-user.target.wants/irodsfs-pool.service || true
rm -f /usr/lib/systemd/system/irodsfs-pool.service
userdel irodsfs-pool || true
groupdel irodsfs-pool || true
rm -rf $$(awk '/data_root_path:/ {print $$2}' /etc/irodsfs-pool/config.yaml)
rm -rf /etc/irodsfs-pool