#! /bin/bash

#获取机器IP
ip route show default | awk '/default/ {print $5}' > /tmp/net.info
cat /tmp/net.info | while read line
do
	iptmp=`LANG=C ifconfig $line | awk '/inet /{ print $2 }'`
	ipinfo="$iptmp@$ipinfo"
	echo "${ipinfo%?}" >/tmp/ip.data
    mac=`cat /sys/class/net/$line/address`
	macinfo="$mac@$macinfo"
	echo "${macinfo%?}" >/tmp/mac.data
done
ip=`cat /tmp/ip.data`

#获取机器标签
label=`cat /var/tmp/name_info`

#获取MAC地址
mac=`cat /tmp/mac.data`

#获取机器SN码
sn=`dmidecode -s system-serial-number`

#获取机器激活码
org=`kylin_gen_register`

#获取服务序列号
kysn=`dbus-send --system --type=method_call --print-reply --dest=org.freedesktop.activation /org/freedesktop/activation org.freedesktop.activation.interface.serial_number | grep string | cut -d '"' -f2|cut -d '"' -f1
`

#获取机器激活码
key=`kylin_gen_register`

#获取系统uuid
uuid=`dmidecode -s system-uuid`

eval echo '{\"ip\":\"$ip\", \"mac\": \"$mac\", \"label\": \"$label\", \"sn\":\"$sn\", \"org\": \"$org\", \"kysn\": \"$kysn\", \"key\": \"$key\", \"uuid\": \"$uuid\"}'



