Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/include/daemon.global.class.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2555 by niro, Thu Sep 17 07:27:10 2015 UTC revision 2811 by niro, Fri Apr 7 07:31:40 2017 UTC
# Line 38  stop_service() Line 38  stop_service()
38   done   done
39  }  }
40    
 # # import_resource $table $serial $resource $value  
 # import_resource()  
 # {  
 # local table="$1"  
 # local serial="$2"  
 # local resource="$3"  
 # local value="$4"  
 #  
 # if [[ ${DEBUG} = 1 ]]  
 # then  
 # echo "${table}->${resource}=${value}" >> /root/lala.log  
 # echo "mysqldo \"update ${table} set ${resource}='${value}' where serial=${serial};\"" >> /root/lala.log  
 # fi  
 #  
 # mysql_insert "${table}",serial="${serial}","${resource}"="${value}"  
 # }  
   
41  # run_class $method $caller $argv1 $argv2 ... $argvN  # run_class $method $caller $argv1 $argv2 ... $argvN
42  run_class()  run_class()
43  {  {
# Line 98  run_class() Line 81  run_class()
81    
82  run_push_config()  run_push_config()
83  {  {
84     local serial="$1"
85   local config   local config
86    
87   for config in $(print_push_config)   if [[ -z ${serial} ]]
88     then
89     eecho "missing serial"
90     return 1
91     fi
92    
93     for config in $(NOCOLORS=1 print_push_config)
94   do   do
95   if [[ -n $(typeset -f push_config_${config}) ]]   if [[ -n $(typeset -f push_config_${config}) ]]
96   then   then
97   push_config_"${config}"   decho "running: 'push_config_${config} ${serial}'"
98     push_config_"${config}" "${serial}"
99   else   else
100   decho "no function 'push_config_${config}' for '${config}' found."   decho "no function 'push_config_${config}' for '${config}' found."
101   fi   fi
102   done   done
103  }  }
104    
105    run_push_firstboot()
106    {
107     local serial="$1"
108     local config
109    
110     if [[ -z ${serial} ]]
111     then
112     eecho "missing serial"
113     return 1
114     fi
115    
116     for config in $(NOCOLORS=1 print_push_firstboot)
117     do
118     if [[ -n $(typeset -f push_firstboot_${config}) ]]
119     then
120     decho "running: 'push_firstboot_${config} ${serial}'"
121     push_firstboot_"${config}" "${serial}"
122     else
123     decho "no function 'push_firstboot_${config}' for '${config}' found."
124     fi
125     done
126    }
127    
128  help_topics()  help_topics()
129  {  {
130   local i   local i
# Line 156  require() Line 170  require()
170    
171   for i in ${requires}   for i in ${requires}
172   do   do
173   # check for duplicate provides   # check for duplicate require
174   if no_duplicate "${PROVIDE}" "${i}"   if no_duplicate "${REQUIRE}" "${i}"
175   then   then
176   export REQUIRE="${REQUIRE} ${i}"   export REQUIRE="${REQUIRE} ${i}"
177   else   else
178   decho "duplicate provide '${i}' detected!"   decho "duplicate require '${i}' detected!"
179   fi   fi
180   done   done
181  }  }
# Line 283  print_push_config() Line 297  print_push_config()
297   # do not escape, or CRLFS get printed to screen too   # do not escape, or CRLFS get printed to screen too
298   rvecho ${sorted}   rvecho ${sorted}
299  }  }
300    
301    push_firstboot()
302    {
303     local push_firstboots="$@"
304     local i
305    
306     for i in ${push_firstboots}
307     do
308     # check for duplicate provides
309     if no_duplicate "${PUSH_FIRSTBOOT}" "${i}"
310     then
311     export PUSH_FIRSTBOOT="${PUSH_FIRSTBOOT} ${i}"
312     else
313     decho "duplicate push_firstboot '${i}' detected!"
314     fi
315     done
316    }
317    
318    print_push_firstboot()
319    {
320     local sorted
321    
322     # sort them alpabetically
323     sorted=$(for i in ${PUSH_FIRSTBOOT}; do echo "${i}"; done | sort)
324     # do not escape, or CRLFS get printed to screen too
325     rvecho ${sorted}
326    }
327    
328  help_daemon_mroot()  help_daemon_mroot()
329  {  {

Legend:
Removed from v.2555  
changed lines
  Added in v.2811