48 lines
1.7 KiB
Makefile
48 lines
1.7 KiB
Makefile
all:
|
|
|
|
deploy: create-users deploy-openrc
|
|
undeploy: remove-users remove-openrc
|
|
|
|
remove-users:
|
|
@grep _auth /etc/passwd >/dev/null && \
|
|
deluser _auth && echo "user _auth has been removed" || \
|
|
echo "user _auth already was deleted"
|
|
@grep _filestorage /etc/passwd >/dev/null && \
|
|
deluser _filestorage && echo "user _filestorage has been removed" || \
|
|
echo "user _filestorage already was deleted"
|
|
@grep _ipc /etc/group >/dev/null && \
|
|
delgroup _ipc && echo "group _ipc has been removed" || \
|
|
echo "group _ipc already was deleted"
|
|
|
|
remove-openrc:
|
|
rm /etc/init.d/authd
|
|
rm /etc/init.d/filestoraged
|
|
|
|
GROUP ?= _ipc
|
|
# BusyBox addgroup [-g GID] [-S] [USER] GROUP
|
|
# -g GID -S (system group)
|
|
group-ipc:
|
|
@grep $(GROUP) /etc/group >/dev/null && echo "group $(GROUP) already exists" || \
|
|
(addgroup -S $(GROUP) && echo "group $(GROUP) has been created")
|
|
|
|
# BusyBox adduser [OPTIONS] USER [GROUP]
|
|
# -S (system user) -H (no mkdir) -s SHELL -g GECOS -G GROUP -D (no pass) -h HOME
|
|
user-auth: group-ipc
|
|
@grep _auth /etc/passwd >/dev/null && echo "user _auth already exists" || \
|
|
(adduser -S -H -s /bin/false -g "IPC auth daemon" -G $(GROUP) -D _auth && \
|
|
echo "user _auth has been created")
|
|
|
|
user-filestorage: group-ipc
|
|
@grep _filestorage /etc/passwd >/dev/null && echo "user _filestorage already exists" || \
|
|
(adduser -S -H -s /bin/false -g "IPC filestorage daemon" -G $(GROUP) -D _filestorage && \
|
|
echo "user _filestorage has been created")
|
|
|
|
create-users: user-auth user-filestorage
|
|
|
|
deploy-openrc-authd:
|
|
install -m0400 openrc/authd /etc/init.d/
|
|
deploy-openrc-filestoraged:
|
|
install -m0400 openrc/filestoraged /etc/init.d/
|
|
|
|
deploy-openrc: deploy-openrc-authd deploy-openrc-filestoraged
|