26 |
# first check if mac is registered |
# first check if mac is registered |
27 |
serial=$(mysqldo "select serial from client_serials where mac='${mac_address}'") |
serial=$(mysqldo "select serial from client_serials where mac='${mac_address}'") |
28 |
|
|
29 |
|
# current mtime |
30 |
|
mtime=$(date +%s) |
31 |
|
|
32 |
if [[ -z ${serial} ]] |
if [[ -z ${serial} ]] |
33 |
then |
then |
|
mtime=$(date +%s) |
|
|
|
|
34 |
# request a new serial; one command now (cause must be done in the same session) |
# request a new serial; one command now (cause must be done in the same session) |
35 |
serial=$(mysqldo "insert into client_serials (mtime, mac) values('${mtime}','${mac_address}'); select last_insert_id();") |
serial=$(mysqldo "insert into client_serials (mtime, mac) values('${mtime}','${mac_address}'); select last_insert_id();") |
36 |
fi |
fi |
55 |
mysqldo "insert into state_connected(serial,ip,mac,mtime) values('${serial}','${ip_address}','${mac_address}','${mtime}');" |
mysqldo "insert into state_connected(serial,ip,mac,mtime) values('${serial}','${ip_address}','${mac_address}','${mtime}');" |
56 |
fi |
fi |
57 |
|
|
58 |
|
# run hardware detection |
59 |
|
if is_provided hardware |
60 |
|
then |
61 |
|
set_hardware_detect "${serial}" |
62 |
|
fi |
63 |
|
|
64 |
return 0 |
return 0 |
65 |
fi |
fi |
66 |
} |
} |