#!/bin/bash MCLIBDIR="/usr/lib/mcored" # globals source ${MCLIBDIR}/include/daemon.global.class source ${MCLIBDIR}/include/sessionauth.global.class #source ${MCLIBDIR}/include/mysqlfunctions.global.class source ${MCLIBDIR}/include/hwdetection.global.class # client specific for i in ${MCLIBDIR}/include/*.client.class do source ${i} || echo "error loading ${i}" done # config settings source /etc/mcore/config.rc #source /etc/mcore/serial # import_hardware_resource() # { # local resource="$1" # local value # # # special cases # case ${resource} in # gfxcard) value="$(get_x11_driver_modules)" ;; # *) value="$(get_hwinfo --with-description ${resource})" ;; # esac # # # if [[ ${DEBUG} = 1 ]] # # then # # echo "${resource}=${value}" >> /root/lala.log # # echo "mysqldo \"update status set ${resource}='${value}' where serial=${ALX_SERIAL};\"" >> /root/lala.log # # fi # # mysql_insert status,serial="${ALX_SERIAL}","${resource}"="${value}" # # import_resource status "${ALX_SERIAL}" "${resource}" "${value}" # } # set_init_state() # { # local ip # ip=$(ifconfig | grep -A1 eth0 | grep inet | sed 's/.*inet\ addr:\(.*\) Bcast.*/\1/;') # # } DEBUG=1 run=run valid_session=no while [[ ${run} = run ]] do read line case ${line} in quit) run=quit ;; # only react on the globals -> import|get|set|auth import*) run_class ${line} ;; get*) run_class ${line} ;; set*) run_class ${line} ;; auth*) validate_auth ${line/auth /} ;; provide) valid_session && print_provide ;; require) valid_session && verify_requirements ;; nocolors) export NOCOLORS="true" ;; webcrlf) export WEBCRLF="true" ;; help*) if valid_session then if [[ ${line} = help ]] then help_topics else run_class ${line} fi else mecho "You must authenticate yourself first!" mecho " auth [username] [password]" fi ;; *) mecho "Unkown command '${line}'" mecho "Type 'help' for more information." echo "$line" >> /root/lala.log ;; esac done