diff options
Diffstat (limited to 'systemservice/config/library/system_manager_config/xml')
5 files changed, 280 insertions, 0 deletions
diff --git a/systemservice/config/library/system_manager_config/xml/Makefile b/systemservice/config/library/system_manager_config/xml/Makefile new file mode 100755 index 0000000..e11288c --- /dev/null +++ b/systemservice/config/library/system_manager_config/xml/Makefile @@ -0,0 +1,53 @@ +# +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#HOST TOOLS +HOST_CPP = cpp +HOST_LAUNCH_XML2CFG = ./launch_xml2cfg.sh + +CONF_DIR = $(SDKTARGETSYSROOT)/usr/agl/conf +CONF_THREAD_H = $(SDKTARGETSYSROOT)/usr/agl/include/agl_thread.h + +LAUNCH_XMLFILES = $(shell cd $(CONF_DIR)/sm_launch; ls *.xml) +LAUNCH_CFGFILES = $(LAUNCH_XMLFILES:%.xml=%.cfg) + +INST_CONFDIR = $(SDKTARGETSYSROOT)/usr/agl/conf/systemmanager + +CLEAN_FILES = system_launcher_body.xml $(LAUNCH_CFGFILES) + +VPATH = $(CONF_DIR)/sm_launch + +install:install-pre install-cfg + +install-pre: + install -d -m 775 $(DESTDIR)/usr/agl/conf;\ + install -d -m 775 $(DESTDIR)/usr/agl/conf/sm_launch;\ + install -d -m 775 $(DESTDIR)/usr/agl/conf/systemmanager;\ + install -m 644 -t $(DESTDIR)/usr/agl/conf/sm_launch sm_launch_agl.xml + +install-cfg:$(LAUNCH_CFGFILES) + set -e ;\ + install -d -m 775 $(INST_CONFDIR) ;\ + for cfgfile in $(LAUNCH_CFGFILES);do \ + install -m 644 -t $(INST_CONFDIR) $$cfgfile;\ + done ;\ + +#Create CFG file +# %.cfg:%.xml # defined in agl.mk + +PHONY:install-cfg + +include ../../../../system_service.mk diff --git a/systemservice/config/library/system_manager_config/xml/launch_cfg2xml.sh b/systemservice/config/library/system_manager_config/xml/launch_cfg2xml.sh new file mode 100755 index 0000000..57b6ee2 --- /dev/null +++ b/systemservice/config/library/system_manager_config/xml/launch_cfg2xml.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +# +# Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +export infile=$1 +export g_group=1 + +if ! [[ "$infile" =~ .+\.cfg ]] ;then + echo "$infile is not *.cfg" + exit 1 +elif ! [ -e $infile ];then + echo "$infile not found" + exit 1 +fi + +#GROUP extraction +cat ${infile} | while read line +do + if ! [[ "${line}" =~ ^[#\[] ]]; then #Remove first #[ + echo $line | sed 's/Launch[0-9]\+=//g' | cut -d '|' -f1-4 + fi +done | uniq | while read line +do + echo "<!-- group_id=$g_group -->" + echo "<group name=\"`echo $line | cut -d '|' -f1`\" wait_time=\"`echo $line | cut -d '|' -f3`\" trigger=\"`echo $line | cut -d '|' -f4`\" >" + + cat ${infile} | while read line + do + if ! [[ "${line}" =~ ^[#\[] ]]; then #Remove first #[ + l_group=`echo $line | sed 's/Launch[0-9]\+=//g' | cut -d '|' -f2` + + #Extract only LAUNCH applicable to g_group + if [ ${l_group} = ${g_group} ]; then + echo $line | sed 's/Launch[0-9]\+=//g' | cut -d '|' -f5- + fi + fi + done | while read line + do + echo " <launch " + echo " name=\"`echo $line | cut -d '|' -f1`\" path=\"`echo $line | cut -d '|' -f2`\" priority=\"`echo $line | cut -d '|' -f3`\"" + echo " critical=\"`echo $line | cut -d '|' -f4`\" retry_cnt=\"`echo $line | cut -d '|' -f5`\" arguments=\"`echo $line | cut -d '|' -f6`\"" + echo " logging_mask=\"`echo $line | cut -d '|' -f7`\" restart=\"`echo $line | cut -d '|' -f8`\" is_start_required=\"`echo $line | cut -d '|' -f9`\"" + echo " shutdown_critical=\"`echo $line | cut -d '|' -f10`\" shutdown_wait_time=\"`echo $line | cut -d '|' -f11`\" fast_shutdown_wait_time=\"`echo $line | cut -d '|' -f12`\"" + echo " user_name=\"`echo $line | cut -d '|' -f13`\"" + echo " />" + done + + echo "</group>" + + g_group=$(($g_group + 1)) +done + + + + diff --git a/systemservice/config/library/system_manager_config/xml/launch_xml2cfg.sh b/systemservice/config/library/system_manager_config/xml/launch_xml2cfg.sh new file mode 100755 index 0000000..20fa097 --- /dev/null +++ b/systemservice/config/library/system_manager_config/xml/launch_xml2cfg.sh @@ -0,0 +1,116 @@ +#!/bin/bash + +# +# Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#xpath is slow, so use sed as much as possible + +infile=$1 + +main_file=system_launcher_main.xml +body_file=system_launcher_body.xml + + +#check xmllint is exist +if ! which xmllint > /dev/null ; then + echo "It need xmllint. Please install it." + exit 1; +fi + +#check xpath is exist +if ! which xpath > /dev/null ; then + echo "It need xpath Please install it." + exit 1; +fi + +#arg check +if ! [[ "$infile" =~ .+\.xml ]] ;then + echo "$infile is not *.xml" + exit 1 +elif ! [ -e $infile ];then + echo "$infile not found" + exit 1 +fi + +cp -f $infile $body_file + +#check xml vaild +if ! xmllint --noout --valid $main_file ;then + echo "XML is Invalid. " + exit 1; +fi + +#Read into memory after shaping with xpath +xmem=`xpath -q -e /system_launcher $main_file` + +echo "# This file is created from $infile." +echo "# created date : `LANG=en date`" +echo "[ModulesLaunchConfig]" + +#GROUP LOOP +group_num=`echo $xmem | xpath -e /system_launcher/group 2>&1 | grep Found | cut -d ' ' -f2` + +l_idx=1 +cur_group=1 +until [ $cur_group -gt $group_num ]; +do + #LAUNCH LOOP + group_text=`echo $xmem | xpath -q -e /system_launcher/group[$cur_group]` #group full XML text + group_attr=`echo $group_text | sed 's/\(<group[^>]\+>\)\(.*\)/\1/g'` + + g_name=`echo $group_attr | sed 's/\(.* name="\)\([^"]*\)\(.*\)/\2/g'` + g_wait_time=`echo $group_attr | sed 's/\(.* wait_time="\)\([^"]*\)\(.*\)/\2/g'` + g_trigger=`echo $group_attr | sed 's/\(.* trigger="\)\([^"]*\)\(.*\)/\2/g'` + +# echo $g_name $g_wait_time $g_trigger + l_launch_num=`echo $xmem | xpath -e /system_launcher/group[$cur_group]/launch 2>&1 | grep Found | cut -d ' ' -f2` + + cur_launch=1; + until [ $cur_launch -gt $l_launch_num ]; do + launch_text=`echo $xmem | xpath -q -e /system_launcher/group[$cur_group]/launch[$cur_launch]` + + l_attr="Launch${l_idx}=$g_name|$cur_group|$g_wait_time|$g_trigger" + l_attr+="|"`echo $launch_text | sed 's/\(.* name="\)\([^"]*\)\(.*\)/\2/g'` + l_attr+="|"`echo $launch_text | sed 's/\(.* path="\)\([^"]*\)\(.*\)/\2/g'` + l_attr+="|"`echo $launch_text | sed 's/\(.* priority="\)\([^"]*\)\(.*\)/\2/g'` + l_attr+="|"`echo $launch_text | sed 's/\(.* critical="\)\([^"]*\)\(.*\)/\2/g'` + l_attr+="|"`echo $launch_text | sed 's/\(.* retry_cnt="\)\([^"]*\)\(.*\)/\2/g'` + l_attr+="|"`echo $launch_text | sed 's/\(.* arguments="\)\([^"]*\)\(.*\)/\2/g'` + l_attr+="|"`echo $launch_text | sed 's/\(.* logging_mask="\)\([^"]*\)\(.*\)/\2/g'` + l_attr+="|"`echo $launch_text | sed 's/\(.* restart="\)\([^"]*\)\(.*\)/\2/g'` + l_attr+="|"`echo $launch_text | sed 's/\(.* is_start_required="\)\([^"]*\)\(.*\)/\2/g'` + l_attr+="|"`echo $launch_text | sed 's/\(.* shutdown_critical="\)\([^"]*\)\(.*\)/\2/g'` + l_attr+="|"`echo $launch_text | sed 's/\(.* shutdown_wait_time="\)\([^"]*\)\(.*\)/\2/g'` + l_attr+="|"`echo $launch_text | sed 's/\(.* fast_shutdown_wait_time="\)\([^"]*\)\(.*\)/\2/g'` + l_attr+="|"`echo $launch_text | sed 's/\(.* user_name="\)\([^"]*\)\(.*\)/\2/g'` + if echo "$launch_text" | grep -sq 'env_cond=' ; then + l_attr+="|"`echo $launch_text | sed 's/\(.* env_cond="\)\([^"]*\)\(.*\)/\2/g'` + else + l_attr+="|" + fi + + echo $l_attr + + cur_launch=$(($cur_launch+1)) + l_idx=$(($l_idx+1)) + done + + cur_group=$(($cur_group+1)) +done + + + + diff --git a/systemservice/config/library/system_manager_config/xml/sm_launch_agl.cfg b/systemservice/config/library/system_manager_config/xml/sm_launch_agl.cfg new file mode 100755 index 0000000..876ab41 --- /dev/null +++ b/systemservice/config/library/system_manager_config/xml/sm_launch_agl.cfg @@ -0,0 +1,7 @@ +# This file is created from sm_launch_agl.xml.tmp. +# created date : Tue Aug 29 13:31:32 JST 2017 +[ModulesLaunchConfig] +Launch1=CoreModules|1|0|False|NS_NPPService|/usr/agl/bin/NS_NPPService|25|True|0|-a SS_SysManager -r output=0x2|NULL|NULL|False|True|20|1000|| +Launch2=CoreModules|1|0|False|NS_BackupMgr|/usr/agl/bin/NS_BackupMgr|25|True|0|-l console|NULL|NULL|True|True|15|1000|| +Launch3=SS_Logger|2|0|False|SS_DevDetectSrv|/tmp/SS_DeviceDetectionService|20|True|0|-l console|NULL|NULL|True|False|1|1000|| +Launch4=SS_Logger|2|0|False|SS_LoggerSrv|/usr/agl/bin/SS_LoggerService|0|True|0|-l console -p thrd=pdg.LogQueReader:30,thrd=pdg.TransmitQueReader:30,thrd=pdg.DumpQueReader:11,thrd=pdg.PerformanceQueReader:11,thrd=pdg.LogQueWriter:30,thrd=pdg.TransmitQueWriter:30,thrd=pdg.EvntLogQue:8,thrd=pdg.UdpQueWriter:10|NULL|NULL|True|True|10|1000|| diff --git a/systemservice/config/library/system_manager_config/xml/sm_launch_agl.xml b/systemservice/config/library/system_manager_config/xml/sm_launch_agl.xml new file mode 100755 index 0000000..a433be3 --- /dev/null +++ b/systemservice/config/library/system_manager_config/xml/sm_launch_agl.xml @@ -0,0 +1,35 @@ +<!-- group_id=1 --> +<group name="CoreModules" wait_time="0" trigger="False" > + <launch + name="NS_NPPService" path="/usr/agl/bin/NS_NPPService" priority="25" + critical="True" retry_cnt="0" arguments="-a SS_SysManager -r output=0x2" + logging_mask="NULL" restart="NULL" is_start_required="False" + shutdown_critical="True" shutdown_wait_time="20" fast_shutdown_wait_time="1000" + user_name="" + /> + <launch + name="NS_BackupMgr" path="/usr/agl/bin/NS_BackupMgr" priority="25" + critical="True" retry_cnt="0" arguments="-l console" + logging_mask="NULL" restart="NULL" is_start_required="True" + shutdown_critical="True" shutdown_wait_time="15" fast_shutdown_wait_time="1000" + user_name="" + /> +</group> +<!-- group_id=2 --> +<group name="SS_Logger" wait_time="0" trigger="False" > + <launch + name="SS_DevDetectSrv" path="/tmp/SS_DeviceDetectionService" priority="20" + critical="True" retry_cnt="0" arguments="-l console" + logging_mask="NULL" restart="NULL" is_start_required="True" + shutdown_critical="False" shutdown_wait_time="1" fast_shutdown_wait_time="1000" + user_name="" + /> + <launch + name="SS_LoggerSrv" path="/usr/agl/bin/SS_LoggerService" priority="0" + critical="True" retry_cnt="0" arguments="-l console -p thrd=pdg.LogQueReader:30,thrd=pdg.TransmitQueReader:30,thrd=pdg.DumpQueReader:11,thrd=pdg.PerformanceQueReader:11,thrd=pdg.LogQueWriter:30,thrd=pdg.TransmitQueWriter:30,thrd=pdg.EvntLogQue:8,thrd=pdg.UdpQueWriter:10" + logging_mask="NULL" restart="NULL" is_start_required="True" + shutdown_critical="True" shutdown_wait_time="10" fast_shutdown_wait_time="1000" + user_name="" + /> +</group> + |