From aa479f9543117d30b44163506aa40fac61c8a2c4 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Wed, 6 Jun 2018 15:13:59 +0200 Subject: [PATCH] fix config install script (cmake, create dest folder and fix permissions) --- cmake/modules/SRSLTE_install_configs.sh.in | 28 +++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/cmake/modules/SRSLTE_install_configs.sh.in b/cmake/modules/SRSLTE_install_configs.sh.in index 8e143f74f..c6d731804 100755 --- a/cmake/modules/SRSLTE_install_configs.sh.in +++ b/cmake/modules/SRSLTE_install_configs.sh.in @@ -3,29 +3,45 @@ # Auto-updated by CMake with actual install path SRSLTE_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_DIR}" +# Default folder where configs go +dest_folder="$HOME/.srs" + install_file(){ source_path="$SRSLTE_INSTALL_DIR/$1" - dest_path="$HOME/.srs/${1%.example}" # Strip .example from it - + dest_path=$(echo "$dest_folder/$1" | sed 's/\.[^.]*$//') # Strip .example from filename + # Check if config file already exists in location if [ -f $dest_path ]; then - echo "$dest_path already exists. Skipping it." + 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" + echo " - Installing $1 in $dest_path" cp $source_path $dest_path + + # Set file ownership to user calling sudo + if [ $SUDO_USER ]; then + user=$SUDO_USER + chown $user:$user $dest_path + fi else - echo "$source_path doesn't exist. Skipping it." + echo " - $source_path doesn't exists. Skipping it." fi return } # Install all srsLTE config files -echo "Installing srsLTE configuration files .." +echo "Installing srsLTE configuration files:" + +# Make sure the target directory exists +if [ ! -d "$dest_folder" ]; then + echo " - Creating srsLTE config folder $dest_folder" + mkdir $dest_folder +fi + install_file "ue.conf.example" install_file "enb.conf.example"