add config install helper

This commit is contained in:
Andre Puschmann 2018-06-05 11:34:01 +02:00
parent 67e90d5a9b
commit 2c179dd84f
5 changed files with 55 additions and 9 deletions

View File

@ -224,6 +224,13 @@ set(INCLUDE_DIR include)
set(DOC_DIR "share/doc/${CPACK_PACKAGE_NAME}")
set(DATA_DIR share/${CPACK_PACKAGE_NAME})
# Auto-generate config install helper and mark for installation
configure_file(
${CMAKE_SOURCE_DIR}/cmake/modules/SRSLTE_install_configs.sh.in
${CMAKE_BINARY_DIR}/srslte_install_configs.sh
)
install(PROGRAMS ${CMAKE_BINARY_DIR}/srslte_install_configs.sh DESTINATION ${RUNTIME_DIR})
########################################################################
# Compiler specific setup
########################################################################

View File

@ -0,0 +1,39 @@
#!/bin/bash
# Auto-updated by CMake with actual install path
SRSLTE_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_DIR}"
install_file(){
source_path="$SRSLTE_INSTALL_DIR/$1"
dest_path="$HOME/.srs/${1%.example}" # Strip .example from it
# Check if config file already exists in location
if [ -f $dest_path ]; then
echo "$dest_path already exists. Skipping it."
return
fi
# Check if config file exists in source location
if [ -f $source_path ]; then
echo "Installing $1 in $dest_path"
cp $source_path $dest_path
else
echo "$source_path doesn't exist. Skipping it."
fi
return
}
# Install all srsLTE config files
echo "Installing srsLTE configuration files .."
install_file "ue.conf.example"
install_file "enb.conf.example"
install_file "sib.conf.example"
install_file "rr.conf.example"
install_file "drb.conf.example"
install_file "epc.conf.example"
install_file "mbms.conf.example"
install_file "user_db.csv.example"
echo "Done."

View File

@ -52,7 +52,7 @@ add_subdirectory(test)
########################################################################
# Default configuration files
########################################################################
install(FILES enb.conf.example RENAME enb.conf DESTINATION etc/srs)
install(FILES drb.conf.example RENAME drb.conf DESTINATION etc/srs)
install(FILES rr.conf.example RENAME rr.conf DESTINATION etc/srs)
install(FILES sib.conf.example RENAME sib.conf DESTINATION etc/srs)
install(FILES enb.conf.example DESTINATION ${DATA_DIR})
install(FILES drb.conf.example DESTINATION ${DATA_DIR})
install(FILES rr.conf.example DESTINATION ${DATA_DIR})
install(FILES sib.conf.example DESTINATION ${DATA_DIR})

View File

@ -51,7 +51,7 @@ add_subdirectory(src)
########################################################################
# Default configuration files
########################################################################
install(FILES epc.conf.example RENAME epc.conf DESTINATION etc/srs)
install(FILES mbms.conf.example RENAME mbms.conf DESTINATION etc/srs)
install(FILES user_db.csv.example RENAME user_db.csv DESTINATION etc/srs)
install(FILES srsepc_if_masq.sh DESTINATION ${RUNTIME_DIR})
install(FILES epc.conf.example DESTINATION ${DATA_DIR})
install(FILES mbms.conf.example DESTINATION ${DATA_DIR})
install(FILES user_db.csv.example DESTINATION ${DATA_DIR})
install(PROGRAMS srsepc_if_masq.sh DESTINATION ${RUNTIME_DIR})

View File

@ -48,4 +48,4 @@ add_subdirectory(test)
########################################################################
# Default configuration files
########################################################################
install(FILES ue.conf.example RENAME ue.conf DESTINATION etc/srs)
install(FILES ue.conf.example DESTINATION ${DATA_DIR})