CPack: '%S' in a shell script breaks RPM spec
I have this line in my pre/post scripts
echo "[`date '+%Y-%m-%d %H:%M:%S'`] [${Prefix}] $1" >> "${LOG_DIR}/package_script.log"
Even if I do this:
#echo "[`date '+%Y-%m-%d %H:%M:%S'`] [${Prefix}] $1" >> "${LOG_DIR}/package_script.log"
I think the project used to use CMake 3.12. I upgraded to CMake 3.22 and now I get:
CPackRPM:Debug: *** error: /tmp/tools_linux.sh.LprkqY/_CPack_Packages/linux/RPM/SPECS/rmmagent.spec: line 111: %S: argument expected
Replacing the above line with:
CurrentTime=$(date '+%Y-%m-%d %T')
echo "[${CurrentTime}] [${Prefix}] $1" >> "${LOG_DIR}/package_script.log"
fixes the issue.
Edited by H-G-Hristov