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 |
{ |
{ |
79 |
fi |
fi |
80 |
} |
} |
81 |
|
|
82 |
|
run_push_config() |
83 |
|
{ |
84 |
|
local serial="$1" |
85 |
|
local config |
86 |
|
|
87 |
|
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 |
95 |
|
if [[ -n $(typeset -f push_config_${config}) ]] |
96 |
|
then |
97 |
|
decho "running: 'push_config_${config} ${serial}'" |
98 |
|
push_config_"${config}" "${serial}" |
99 |
|
else |
100 |
|
decho "no function 'push_config_${config}' for '${config}' found." |
101 |
|
fi |
102 |
|
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 |
133 |
topics=$(typeset -f | grep '^help_' | sed 's:help_\(.*\)\ .*():\1:' | sed 's:_:\.:' | sort) |
topics=$(typeset -f | grep '^help_' | sed 's:help_\(.*\)\ .*():\1:' | sed 's:_:\.:' | sort) |
134 |
mecho "Global commands:" |
mecho "Global commands:" |
135 |
mecho "\timport - import settings to database" |
mecho "\timport - import settings to database" |
136 |
mecho "\tget - shows current value for a settings" |
mecho "\tget - shows current value for a setting" |
137 |
mecho "\tset - sets value for a setting" |
mecho "\tset - sets value for a setting" |
138 |
mecho "\tauth - authenticate to the daemon" |
mecho "\tauth - authenticate to the daemon" |
139 |
mecho "\tcertauth - authenticate to the daemon via fingerprint" |
mecho "\tcertauth - authenticate to the daemon via fingerprint" |
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 |
} |
} |
271 |
return "${retval}" |
return "${retval}" |
272 |
} |
} |
273 |
|
|
274 |
|
push_config() |
275 |
|
{ |
276 |
|
local push_configs="$@" |
277 |
|
local i |
278 |
|
|
279 |
|
for i in ${push_configs} |
280 |
|
do |
281 |
|
# check for duplicate provides |
282 |
|
if no_duplicate "${PUSH_CONFIG}" "${i}" |
283 |
|
then |
284 |
|
export PUSH_CONFIG="${PUSH_CONFIG} ${i}" |
285 |
|
else |
286 |
|
decho "duplicate push_config '${i}' detected!" |
287 |
|
fi |
288 |
|
done |
289 |
|
} |
290 |
|
|
291 |
|
print_push_config() |
292 |
|
{ |
293 |
|
local sorted |
294 |
|
|
295 |
|
# sort them alpabetically |
296 |
|
sorted=$(for i in ${PUSH_CONFIG}; do echo "${i}"; done | sort) |
297 |
|
# do not escape, or CRLFS get printed to screen too |
298 |
|
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 |
{ |
{ |
330 |
mecho "get daemon.mroot" |
mecho "get daemon.mroot" |