修复update rpm时配置文件被覆盖
修复/opt/tsg/etc/tsg_sn.json中配置sn不正确导致重启的BUG
This commit is contained in:
@@ -34,11 +34,16 @@ set(CMAKE_INSTALL_PREFIX /home/mesasoft/sapp_run)
|
|||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
SET(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/preinstall/install.sh")
|
SET(CPACK_RPM_LIBRARY_PRE_INSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/preinstall/install.sh")
|
||||||
SET(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/preinstall/uninstall.sh")
|
SET(CPACK_RPM_LIBRARY_PRE_UNINSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/preinstall/uninstall.sh")
|
||||||
|
|
||||||
set(CPACK_RPM_USER_FILELIST "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/tsgconf/main.conf"
|
set(CPACK_RPM_LIBRARY_USER_FILELIST "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/tsgconf/main.conf"
|
||||||
"%config(noreplace) ${CMAKE_INSTALL_PREFIX}/tsgconf/maat.conf")
|
"%config(noreplace) ${CMAKE_INSTALL_PREFIX}/tsgconf/maat.conf"
|
||||||
|
"%config(noreplace) ${CMAKE_INSTALL_PREFIX}/tsgconf/tsg_static_tableinfo.conf"
|
||||||
|
"%config(noreplace) ${CMAKE_INSTALL_PREFIX}/tsgconf/tsg_dynamic_tableinfo.conf"
|
||||||
|
"%config(noreplace) ${CMAKE_INSTALL_PREFIX}/tsgconf/tsg_log_field.conf"
|
||||||
|
"%config(noreplace) ${CMAKE_INSTALL_PREFIX}/tsgconf/tsg_maat.json"
|
||||||
|
)
|
||||||
|
|
||||||
install(FILES bin/main.conf DESTINATION ${CMAKE_INSTALL_PREFIX}/tsgconf COMPONENT PROFILE)
|
install(FILES bin/main.conf DESTINATION ${CMAKE_INSTALL_PREFIX}/tsgconf COMPONENT PROFILE)
|
||||||
install(FILES bin/maat.conf DESTINATION ${CMAKE_INSTALL_PREFIX}/tsgconf COMPONENT PROFILE)
|
install(FILES bin/maat.conf DESTINATION ${CMAKE_INSTALL_PREFIX}/tsgconf COMPONENT PROFILE)
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
echo " pre install: $1"
|
||||||
|
|
||||||
DST=${RPM_INSTALL_PREFIX}
|
DST=${RPM_INSTALL_PREFIX}
|
||||||
|
|
||||||
mkdir -p ${DST}/plug/platform/
|
mkdir -p ${DST}/plug/platform/
|
||||||
mkdir -p ${DST}/etc/
|
mkdir -p ${DST}/etc/
|
||||||
touch ${DST}/plug/conflist.inf
|
touch ${DST}/plug/conflist.inf
|
||||||
@@ -10,9 +13,10 @@ echo 'POLICY_PRIORITY struct' >> ${DST}/etc/project_list.conf
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z `grep -rn 'ESTABLISH_LATENCY' ${DST}/etc/project_list.conf` ]];then
|
if [[ -z `grep -rn 'ESTABLISH_LATENCY' ${DST}/etc/project_list.conf` ]];then
|
||||||
echo 'TSG_MASTER_INTERNAL_LABEL struct' >> ${DST}/etc/project_list.conf
|
echo 'ESTABLISH_LATENCY long' >> ${DST}/etc/project_list.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z `grep -rn 'tsg_master.inf' ${DST}/plug/conflist.inf` ]];then
|
if [[ -z `grep -rn 'tsg_master.inf' ${DST}/plug/conflist.inf` ]];then
|
||||||
sed -i '/\[platform\]/a\./plug/platform/tsg_master/tsg_master.inf' ${DST}/plug/conflist.inf
|
sed -i '/\[platform\]/a\./plug/platform/tsg_master/tsg_master.inf' ${DST}/plug/conflist.inf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
if [ $1 == 0 ]; then
|
||||||
|
echo "uninstall: $1"
|
||||||
|
|
||||||
DST=${RPM_INSTALL_PREFIX}
|
DST=${RPM_INSTALL_PREFIX}
|
||||||
|
|
||||||
mkdir -p ${DST}/plug/platform/
|
mkdir -p ${DST}/plug/platform/
|
||||||
sed -i '/tsg_master.inf/d' ${DST}/plug/conflist.inf
|
sed -i '/tsg_master.inf/d' ${DST}/plug/conflist.inf
|
||||||
sed -i '/POLICY_PRIORITY/d' ${DST}/etc/project_list.conf
|
sed -i '/POLICY_PRIORITY/d' ${DST}/etc/project_list.conf
|
||||||
sed -i '/TSG_MASTER_INTERNAL_LABEL/d' ${DST}/etc/project_list.conf
|
sed -i '/ESTABLISH_LATENCY/d' ${DST}/etc/project_list.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ static __attribute__((__used__)) const char * GIT_VERSION_UNKNOWN = NULL;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
char TSG_MASTER_VERSION_20200612=0;
|
char TSG_MASTER_VERSION_20200624=0;
|
||||||
const char *tsg_conffile="tsgconf/main.conf";
|
const char *tsg_conffile="tsgconf/main.conf";
|
||||||
g_tsg_para_t g_tsg_para;
|
g_tsg_para_t g_tsg_para;
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ static int tsg_get_sn(char *filename, char *device_sn, int device_sn_len)
|
|||||||
if(object)
|
if(object)
|
||||||
{
|
{
|
||||||
cJSON *item=cJSON_GetObjectItem(object, "sn");
|
cJSON *item=cJSON_GetObjectItem(object, "sn");
|
||||||
if(item && device_sn_len>(int)strlen(item->valuestring))
|
if(item && item->valuestring!=NULL && device_sn_len>(int)strlen(item->valuestring))
|
||||||
{
|
{
|
||||||
flags=1;
|
flags=1;
|
||||||
memcpy(device_sn, item->valuestring, strlen(item->valuestring));
|
memcpy(device_sn, item->valuestring, strlen(item->valuestring));
|
||||||
|
|||||||
Reference in New Issue
Block a user