-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (40 loc) · 1.28 KB
/
Makefile
File metadata and controls
49 lines (40 loc) · 1.28 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
PREFIX ?= /usr/local
PROG = Xsunaba
SECTION = 1
BIN = bin
MAN = man
BINDIR = ${PREFIX}/${BIN}
MANDIR = ${PREFIX}/${MAN}/man${SECTION}
XSUNABA_USER ?= xsunaba
DOAS_LINE = permit nopass ${USER} as ${XSUNABA_USER}
build:
@echo "Nothing to be built."
install: ${BIN}/${PROG} ${MAN}/${PROG}.${SECTION} install-user install-doas
mkdir -p ${BINDIR}
install -m755 ${BIN}/${PROG} ${BINDIR}
mkdir -p ${MANDIR}
install -m444 ${MAN}/${PROG}.${SECTION} ${MANDIR}
install-user:
id ${XSUNABA_USER} || useradd -m ${XSUNABA_USER}
install-doas:
test -f /etc/doas.conf \
|| touch /etc/doas.conf \
&& chown root:wheel /etc/doas.conf \
&& chmod 600 /etc/doas.conf
grep -q "${DOAS_LINE}" /etc/doas.conf \
|| echo "${DOAS_LINE}" >> /etc/doas.conf
install-sndio-cookie:
@echo "Copying sndio cookie from '${USER}' to '${XSUNABA_USER}'..."
mkdir -p ~${XSUNABA_USER}/.sndio
install -o ${XSUNABA_USER} -g ${XSUNABA_USER} -m 600 ~${USER}/.sndio/cookie ~${XSUNABA_USER}/.sndio/
uninstall: uninstall-doas uninstall-user
rm ${BINDIR}/${PROG}
rm ${MANDIR}/${PROG}.${SECTION}
uninstall-user:
rmuser ${XSUNABA_USER}
uninstall-doas:
test -f /etc/doas.conf \
&& grep -p "${DOAS_LINE}" /etc/doas.conf \
&& sed -i "s/${DOAS_LINE}//g" /etc/doas.conf
uninstall-sndio-cookie:
rm ~${XSUNABA_USER}/.sndio/cookie