--- mcore-src/trunk/mcore-tools/src/modules/hwinfo/hardware.control.class.in 2015/09/10 13:53:32 2496 +++ mcore-src/trunk/mcore-tools/src/modules/hwinfo/hardware.control.class.in 2015/09/11 07:36:40 2499 @@ -1,11 +1,12 @@ # $Id$ +provide hardware require hwdetection require mysql -set_hardware_detect() +run_hardware_detect() { - local serial="${CLASS_ARGV[0]}" + local serial="$1" local cmd local netcard_driver @@ -15,6 +16,23 @@ local graphic_driver local monitor_info local monitor_resolution + local hwdetected + + if [[ -z ${serial} ]] + then + decho "No serial given" + return 1 + fi + + # first check if hardware detect was already done + hwdetected=$(mysqldo "select hwdetected from client_serials where serial=${serial};") + if [[ ${hwdetected} = 1 ]] + then + decho "hardware detection already run, aborting" + return 0 + else + decho "running hardware detection" + fi nsslsay_queue_init nsslsay_queue_add "nocolors" @@ -73,4 +91,30 @@ else decho "no monitor_resolution found" fi + + # update the hwdetected flags + import_resource client_serials "${serial}" hwdetected 1 +} + +set_hardware_detect() +{ + local serial="${CLASS_ARGV[0]}" + + local cmd + local netcard_driver + local networking + local hostname + local domain + local graphic_driver + local monitor_info + local monitor_resolution + local hwdetected + + if [[ -z ${serial} ]] + then + eecho "No serial given" + return 1 + fi + + run_hardware_detect "${serial}" }