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

[Cmake] Cleaning script (credits: @mattiabiondi)

This commit is contained in:
Davide Berardi 2020-01-31 20:13:00 +01:00
parent 9fb6a8d265
commit 06ac0e5666
3 changed files with 18 additions and 19 deletions

View File

@ -23,11 +23,8 @@ else (WITHEDITOR)
set(EDITOR "/usr/bin/vi") set(EDITOR "/usr/bin/vi")
endif (WITHEDITOR) endif (WITHEDITOR)
if(DEBUILD) # Spool dir for scado files
set(CADO_SPOOL_DIR "/var/spool/cado")
else(DEBUILD)
set(CADO_SPOOL_DIR "/usr/local/var/spool/cado") set(CADO_SPOOL_DIR "/usr/local/var/spool/cado")
endif(DEBUILD)
configure_file( configure_file(
"include/config.h.in" "include/config.h.in"

View File

@ -3,7 +3,8 @@ execute_process(COMMAND bash -c "\
groupadd \ groupadd \
--system \ --system \
_cado; _cado;
fi") fi"
ERROR_QUIET OUTPUT_QUIET)
execute_process(COMMAND bash -c "\ execute_process(COMMAND bash -c "\
if ! getent passwd _cado >/dev/null 2>&1; then if ! getent passwd _cado >/dev/null 2>&1; then
useradd \ useradd \
@ -13,13 +14,14 @@ execute_process(COMMAND bash -c "\
--shell /bin/nologin \ --shell /bin/nologin \
-g _cado \ -g _cado \
_cado; _cado;
fi") fi"
execute_process(COMMAND mkdir -p ${CADO_SPOOL_DIR}) ERROR_QUIET OUTPUT_QUIET)
execute_process(COMMAND chown root:_cado ${CADO_SPOOL_DIR}) execute_process(COMMAND mkdir -p ${CADO_SPOOL_DIR} ERROR_QUIET OUTPUT_QUIET)
execute_process(COMMAND chmod 4770 ${CADO_SPOOL_DIR}) execute_process(COMMAND chown root:_cado ${CADO_SPOOL_DIR} ERROR_QUIET OUTPUT_QUIET)
execute_process(COMMAND chown :_cado ${BINDIR}/scado) execute_process(COMMAND chmod 4770 ${CADO_SPOOL_DIR} ERROR_QUIET OUTPUT_QUIET)
execute_process(COMMAND chmod g+s ${BINDIR}/scado) execute_process(COMMAND chown :_cado ${BINDIR}/scado ERROR_QUIET OUTPUT_QUIET)
execute_process(COMMAND chown _cado: ${BINDIR}/cado) execute_process(COMMAND chmod g+s ${BINDIR}/scado ERROR_QUIET OUTPUT_QUIET)
execute_process(COMMAND chmod u+s ${BINDIR}/cado) execute_process(COMMAND chown _cado: ${BINDIR}/cado ERROR_QUIET OUTPUT_QUIET)
execute_process(COMMAND ldconfig ${LIBDIR}) execute_process(COMMAND chmod u+s ${BINDIR}/cado ERROR_QUIET OUTPUT_QUIET)
execute_process(COMMAND bash -c "${BINDIR}/cado --setcap >/dev/null 2>&1") execute_process(COMMAND ldconfig ${LIBDIR} ERROR_QUIET OUTPUT_QUIET)
execute_process(COMMAND ${BINDIR}/cado --setcap ERROR_QUIET OUTPUT_QUIET)

View File

@ -10,7 +10,7 @@ foreach(file ${files})
message(STATUS "Removing file: '${file}'") message(STATUS "Removing file: '${file}'")
execute_process( execute_process(
COMMAND bash "-c" "rm ${file}" COMMAND rm "${file}"
OUTPUT_VARIABLE remove_file OUTPUT_VARIABLE remove_file
) )
@ -24,7 +24,7 @@ endforeach(file)
message(STATUS "Removing user: '_cado'") message(STATUS "Removing user: '_cado'")
execute_process( execute_process(
COMMAND bash "-c" "userdel _cado" COMMAND userdel _cado
OUTPUT_VARIABLE remove_user OUTPUT_VARIABLE remove_user
) )
if(${remove_user}) if(${remove_user})
@ -33,7 +33,7 @@ endif()
message(STATUS "Removing folder: '${CADO_SPOOL_DIR}'") message(STATUS "Removing folder: '${CADO_SPOOL_DIR}'")
execute_process( execute_process(
COMMAND bash "-c" "rm -r ${CADO_SPOOL_DIR}" COMMAND rm -r "${CADO_SPOOL_DIR}"
OUTPUT_VARIABLE remove_spool_folder OUTPUT_VARIABLE remove_spool_folder
) )
if("${remove_spool_folder}") if("${remove_spool_folder}")