CPackRPM authorize per-component pre/post-[un]install scripts (#0012063)
Merged patch from Chip Christian previously based on the one from winfriedd with some small pruning editing by commiter
This commit is contained in:
parent
400c74f325
commit
cc26a0614a
|
@ -132,24 +132,32 @@
|
||||||
# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
|
# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
|
||||||
# Mandatory : NO
|
# Mandatory : NO
|
||||||
# Default : -
|
# Default : -
|
||||||
# May be used to embbed a pre (un)installation script in the spec file.
|
# May be used to embed a pre (un)installation script in the spec file.
|
||||||
# The refered script file(s) will be read and directly
|
# The refered script file(s) will be read and directly
|
||||||
# put after the %pre or %preun section
|
# put after the %pre or %preun section
|
||||||
|
# If CPACK_RPM_COMPONENT_INSTALL is set to ON the (un)install script for
|
||||||
|
# each component can be overriden with
|
||||||
|
# CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE and
|
||||||
|
# CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE
|
||||||
# One may verify which scriptlet has been included with
|
# One may verify which scriptlet has been included with
|
||||||
# rpm -qp --scripts package.rpm
|
# rpm -qp --scripts package.rpm
|
||||||
# CPACK_RPM_POST_INSTALL_SCRIPT_FILE
|
# CPACK_RPM_POST_INSTALL_SCRIPT_FILE
|
||||||
# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
|
# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
|
||||||
# Mandatory : NO
|
# Mandatory : NO
|
||||||
# Default : -
|
# Default : -
|
||||||
# May be used to embbed a post (un)installation script in the spec file.
|
# May be used to embed a post (un)installation script in the spec file.
|
||||||
# The refered script file(s) will be read and directly
|
# The refered script file(s) will be read and directly
|
||||||
# put after the %post or %postun section
|
# put after the %post or %postun section
|
||||||
|
# If CPACK_RPM_COMPONENT_INSTALL is set to ON the (un)install script for
|
||||||
|
# each component can be overriden with
|
||||||
|
# CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE and
|
||||||
|
# CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE
|
||||||
# One may verify which scriptlet has been included with
|
# One may verify which scriptlet has been included with
|
||||||
# rpm -qp --scripts package.rpm
|
# rpm -qp --scripts package.rpm
|
||||||
# CPACK_RPM_CHANGELOG_FILE
|
# CPACK_RPM_CHANGELOG_FILE
|
||||||
# Mandatory : NO
|
# Mandatory : NO
|
||||||
# Default : -
|
# Default : -
|
||||||
# May be used to embbed a changelog in the spec file.
|
# May be used to embed a changelog in the spec file.
|
||||||
# The refered file will be read and directly put after the %changelog
|
# The refered file will be read and directly put after the %changelog
|
||||||
# section.
|
# section.
|
||||||
|
|
||||||
|
@ -237,6 +245,17 @@ IF(ALIEN_EXECUTABLE)
|
||||||
MESSAGE(STATUS "alien found, we may be on a Debian based distro.")
|
MESSAGE(STATUS "alien found, we may be on a Debian based distro.")
|
||||||
ENDIF(ALIEN_EXECUTABLE)
|
ENDIF(ALIEN_EXECUTABLE)
|
||||||
|
|
||||||
|
# Are we packaging components ?
|
||||||
|
IF(CPACK_RPM_PACKAGE_COMPONENT)
|
||||||
|
SET(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}")
|
||||||
|
SET(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "/${CPACK_RPM_PACKAGE_COMPONENT}")
|
||||||
|
SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${CPACK_RPM_PACKAGE_COMPONENT}")
|
||||||
|
ELSE(CPACK_RPM_PACKAGE_COMPONENT)
|
||||||
|
SET(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "")
|
||||||
|
SET(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "")
|
||||||
|
SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
|
||||||
|
ENDIF(CPACK_RPM_PACKAGE_COMPONENT)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Use user-defined RPM specific variables value
|
# Use user-defined RPM specific variables value
|
||||||
# or generate reasonable default value from
|
# or generate reasonable default value from
|
||||||
|
@ -396,47 +415,77 @@ IF(CPACK_RPM_SPEC_INSTALL_POST)
|
||||||
SET(TMP_RPM_SPEC_INSTALL_POST "%define __spec_install_post ${CPACK_RPM_SPEC_INSTALL_POST}")
|
SET(TMP_RPM_SPEC_INSTALL_POST "%define __spec_install_post ${CPACK_RPM_SPEC_INSTALL_POST}")
|
||||||
ENDIF(CPACK_RPM_SPEC_INSTALL_POST)
|
ENDIF(CPACK_RPM_SPEC_INSTALL_POST)
|
||||||
|
|
||||||
# CPACK_RPM_POST_INSTALL_SCRIPT_FILE
|
# CPACK_RPM_POST_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE)
|
||||||
# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
|
# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE)
|
||||||
# May be used to embbed a post (un)installation script in the spec file.
|
# May be used to embed a post (un)installation script in the spec file.
|
||||||
# The refered script file(s) will be read and directly
|
# The refered script file(s) will be read and directly
|
||||||
# put after the %post or %postun section
|
# put after the %post or %postun section
|
||||||
if(CPACK_RPM_POST_INSTALL_SCRIPT_FILE)
|
if(CPACK_RPM_PACKAGE_COMPONENT)
|
||||||
if(EXISTS ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE})
|
if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE)
|
||||||
file(READ ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE} CPACK_RPM_SPEC_POSTINSTALL)
|
set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE})
|
||||||
else(EXISTS ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE})
|
else()
|
||||||
message("CPackRPM:Warning: CPACK_RPM_POST_INSTALL_SCRIPT_FILE <${CPACK_RPM_POST_INSTALL_SCRIPT_FILE}> does not exists - ignoring")
|
set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE})
|
||||||
endif(EXISTS ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE})
|
endif()
|
||||||
endif(CPACK_RPM_POST_INSTALL_SCRIPT_FILE)
|
if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE)
|
||||||
|
set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE})
|
||||||
|
else(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE)
|
||||||
|
set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE})
|
||||||
|
endif(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE)
|
||||||
|
else(CPACK_RPM_PACKAGE_COMPONENT)
|
||||||
|
set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE})
|
||||||
|
set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE})
|
||||||
|
endif(CPACK_RPM_PACKAGE_COMPONENT)
|
||||||
|
if(CPACK_RPM_POST_INSTALL_READ_FILE)
|
||||||
|
if(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE})
|
||||||
|
file(READ ${CPACK_RPM_POST_INSTALL_READ_FILE} CPACK_RPM_SPEC_POSTINSTALL)
|
||||||
|
else(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE})
|
||||||
|
message("CPackRPM:Warning: CPACK_RPM_POST_INSTALL_SCRIPT_FILE <${CPACK_RPM_POST_INSTALL_READ_FILE}> does not exists - ignoring")
|
||||||
|
endif(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE})
|
||||||
|
endif(CPACK_RPM_POST_INSTALL_READ_FILE)
|
||||||
|
|
||||||
if(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE)
|
if(CPACK_RPM_POST_UNINSTALL_READ_FILE)
|
||||||
if(EXISTS ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE})
|
if(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE})
|
||||||
file(READ ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE} CPACK_RPM_SPEC_POSTUNINSTALL)
|
file(READ ${CPACK_RPM_POST_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_POSTUNINSTALL)
|
||||||
else(EXISTS ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE})
|
else(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE})
|
||||||
message("CPackRPM:Warning: CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE}> does not exists - ignoring")
|
message("CPackRPM:Warning: CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_POST_UNINSTALL_READ_FILE}> does not exists - ignoring")
|
||||||
endif(EXISTS ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE})
|
endif(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE})
|
||||||
endif(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE)
|
endif(CPACK_RPM_POST_UNINSTALL_READ_FILE)
|
||||||
|
|
||||||
# CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
|
# CPACK_RPM_PRE_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE)
|
||||||
# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
|
# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE)
|
||||||
# May be used to embed a pre (un)installation script in the spec file.
|
# May be used to embed a pre (un)installation script in the spec file.
|
||||||
# The refered script file(s) will be read and directly
|
# The refered script file(s) will be read and directly
|
||||||
# put after the %pre or %preun section
|
# put after the %pre or %preun section
|
||||||
if(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE)
|
if(CPACK_RPM_PACKAGE_COMPONENT)
|
||||||
if(EXISTS ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE})
|
if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE)
|
||||||
file(READ ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE} CPACK_RPM_SPEC_PREINSTALL)
|
set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE})
|
||||||
else(EXISTS ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE})
|
else(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE)
|
||||||
message("CPackRPM:Warning: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE}> does not exists - ignoring")
|
set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE})
|
||||||
endif(EXISTS ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE})
|
endif(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE)
|
||||||
endif(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE)
|
if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE)
|
||||||
|
set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE})
|
||||||
|
else(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE)
|
||||||
|
set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE})
|
||||||
|
endif(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE)
|
||||||
|
else(CPACK_RPM_PACKAGE_COMPONENT)
|
||||||
|
set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE})
|
||||||
|
set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE})
|
||||||
|
endif(CPACK_RPM_PACKAGE_COMPONENT)
|
||||||
|
if(CPACK_RPM_PRE_INSTALL_READ_FILE)
|
||||||
|
if(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE})
|
||||||
|
file(READ ${CPACK_RPM_PRE_INSTALL_READ_FILE} CPACK_RPM_SPEC_PREINSTALL)
|
||||||
|
else(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE})
|
||||||
|
message("CPackRPM:Warning: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_INSTALL_READ_FILE}> does not exists - ignoring")
|
||||||
|
endif(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE})
|
||||||
|
endif(CPACK_RPM_PRE_INSTALL_READ_FILE)
|
||||||
|
|
||||||
if(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE)
|
if(CPACK_RPM_PRE_UNINSTALL_READ_FILE)
|
||||||
if(EXISTS ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE})
|
if(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE})
|
||||||
file(READ ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE} CPACK_RPM_SPEC_PREUNINSTALL)
|
file(READ ${CPACK_RPM_PRE_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_PREUNINSTALL)
|
||||||
else(EXISTS ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE})
|
else(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE})
|
||||||
message("CPackRPM:Warning: CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}> does not exists - ignoring")
|
message("CPackRPM:Warning: CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_UNINSTALL_READ_FILE}> does not exists - ignoring")
|
||||||
endif(EXISTS ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE})
|
endif(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE})
|
||||||
endif(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE)
|
endif(CPACK_RPM_PRE_UNINSTALL_READ_FILE)
|
||||||
|
|
||||||
# CPACK_RPM_CHANGELOG_FILE
|
# CPACK_RPM_CHANGELOG_FILE
|
||||||
# May be used to embed a changelog in the spec file.
|
# May be used to embed a changelog in the spec file.
|
||||||
|
@ -478,17 +527,6 @@ SET(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}")
|
||||||
#STRING(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}")
|
#STRING(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}")
|
||||||
SET(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}")
|
SET(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}")
|
||||||
|
|
||||||
|
|
||||||
# Are we packaging components ?
|
|
||||||
IF(CPACK_RPM_PACKAGE_COMPONENT)
|
|
||||||
SET(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}")
|
|
||||||
SET(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "/${CPACK_RPM_PACKAGE_COMPONENT}")
|
|
||||||
SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${CPACK_RPM_PACKAGE_COMPONENT}")
|
|
||||||
ELSE(CPACK_RPM_PACKAGE_COMPONENT)
|
|
||||||
SET(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "")
|
|
||||||
SET(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "")
|
|
||||||
SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
|
|
||||||
ENDIF(CPACK_RPM_PACKAGE_COMPONENT)
|
|
||||||
# Use files tree to construct files command (spec file)
|
# Use files tree to construct files command (spec file)
|
||||||
# We should not forget to include symlinks (thus -o -type l)
|
# We should not forget to include symlinks (thus -o -type l)
|
||||||
# We should include directory as well (thus -type d)
|
# We should include directory as well (thus -type d)
|
||||||
|
|
Loading…
Reference in New Issue