1
0
mirror of https://github.com/rd235/cado synced 2024-12-26 14:03:07 +01:00

[CMake] PostInstall refactoring

PostInstall was refactored to mimick the debian installer.
This commit is contained in:
Davide Berardi 2020-01-31 18:00:51 +01:00
parent 5e294e0a8c
commit 14c8d46714

View File

@ -1,11 +1,25 @@
execute_process(COMMAND bash "-c"
"(useradd -r -s /bin/nologin -g `getent passwd | grep cado | cut -f 3 -d ':'` cado || useradd -r -s /bin/nologin -U cado) || true;\
mkdir -p /usr/local/var/spool/cado;\
chown root:cado /usr/local/var/spool/cado && chmod 4770 /usr/local/var/spool/cado;\
chown :cado ${BINDIR}/scado;\
chmod g+s ${BINDIR}/scado;\
chown cado ${BINDIR}/cado;\
chmod u+s ${BINDIR}/cado;\
ldconfig ${LIBDIR};\
${BINDIR}/cado -s"
)
execute_process(COMMAND bash -c "\
if ! getent group _cado >/dev/null 2>&1; then
groupadd \
--system \
_cado;
fi")
execute_process(COMMAND bash -c "\
if ! getent passwd _cado >/dev/null 2>&1; then
useradd \
--no-create-home \
--home-dir /nonexistent \
--system \
--shell /bin/nologin \
-g _cado \
_cado;
fi")
execute_process(COMMAND mkdir -p /usr/local/var/spool/cado)
execute_process(COMMAND chown root:_cado /usr/local/var/spool/cado)
execute_process(COMMAND chmod 4770 /usr/local/var/spool/cado)
execute_process(COMMAND chown :_cado ${BINDIR}/scado)
execute_process(COMMAND chmod g+s ${BINDIR}/scado)
execute_process(COMMAND chown _cado: ${BINDIR}/cado)
execute_process(COMMAND chmod u+s ${BINDIR}/cado)
execute_process(COMMAND ldconfig ${LIBDIR})
execute_process(COMMAND ${BINDIR}/cado --setup)