summaryrefslogtreecommitdiffstats
path: root/server/ipxe
diff options
context:
space:
mode:
authorJannik Schönartz2018-10-11 23:02:32 +0200
committerJannik Schönartz2018-10-11 23:02:32 +0200
commitb2a6274c13a49a5d1e9362850df2cc32b1b7a183 (patch)
treecf25c5ff097c8acb9fc2ae5456db08fac95f0189 /server/ipxe
parent[configloader] add missing line to make the dynamic menu selectable (diff)
downloadbas-b2a6274c13a49a5d1e9362850df2cc32b1b7a183.tar.gz
bas-b2a6274c13a49a5d1e9362850df2cc32b1b7a183.tar.xz
bas-b2a6274c13a49a5d1e9362850df2cc32b1b7a183.zip
[registration] Set registration state when client is added
[configloader] Add functionality to boot the ipxe script or minilinux. Add ipxe script, which boots the minilinux. Add script to grep the hw data with dmidecode
Diffstat (limited to 'server/ipxe')
-rw-r--r--server/ipxe/grepSystemInfo.sh75
-rw-r--r--server/ipxe/minilinux.ipxe6
2 files changed, 81 insertions, 0 deletions
diff --git a/server/ipxe/grepSystemInfo.sh b/server/ipxe/grepSystemInfo.sh
new file mode 100644
index 0000000..024fb52
--- /dev/null
+++ b/server/ipxe/grepSystemInfo.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+
+#dmidecode | grep -i UUID
+
+# MAC
+MAC=$(ip addr show | grep -Eo -m 1 'ether\s.*\sbrd')
+MAC=${MAC#"ether "}
+MAC=${MAC%" brd"}
+echo "MAC: $MAC"
+
+# UUID
+UUID=$(dmidecode -q -s system-uuid | grep -v '^#' | head -n 1 | tr '[a-z]' '[A-Z]')
+echo "UUID: $UUID"
+
+# System Information
+echo ""
+echo "######## System Informations ########"
+MANUFACTURER=$(dmidecode -q -s system-manufacturer)
+echo "Manufacturer: $MANUFACTURER"
+
+MODEL=$(dmidecode -q -s system-product-name)
+echo "Model: $MODEL"
+
+SERIAL=$(dmidecode -q -s system-serial-number)
+echo "Serial number: $SERIAL"
+
+VENDOR=$(dmidecode | grep -Eo '(Vendor).*')
+VENDOR=${VENDOR#Vendor: }
+echo "Vendor: $VENDOR"
+
+# Mainboard
+echo ""
+echo "######## Mainboard Informations ########"
+MAINBOARD_MANUFACTURER=$(dmidecode -q -s baseboard-manufacturer)
+echo "Manufacturer: $MAINBOARD_MANUFACTURER"
+MAINBOARD_MODEL=$(dmidecode -q -s baseboard-product-name)
+echo "Model: $MAINBOARD_MODEL"
+MAINBOARD_SERIAL_NUMBER=$(dmidecode -q -s baseboard-serial-number)
+echo "Serial: $MAINBOARD_SERIAL_NUMBER"
+
+# CPU
+echo ""
+echo "######## CPU Informations ########"
+CPU_MODEL=$(dmidecode -q -s processor-version)
+echo "Model: $CPU_MODEL"
+CPU_MANUFACTURER=$(dmidecode -q -s processor-manufacturer)
+echo "Manufacturer: $CPU_MANUFACTURER"
+CPU_TYPE=$(dmidecode -q -s processor-family)
+echo "Type: $CPU_TYPE"
+CPUCORES=$(cat /sys/devices/system/cpu/cpu*/topology/thread_siblings_list | sort -u | wc -l)
+echo "$CPUCORES Cores"
+#CPUMODEL=$(grep -m1 '^model name\s*:' /proc/cpuinfo | sed 's/^model name\s*:\s*//;s/\s\s*/ /g;s/^ //;s/ $//')
+#echo "$CPUMODEL"
+CPU_FREQUENCY=$(dmidecode -q -s processor-frequency)
+echo "Frequency: $CPU_FREQUENCY"
+
+# RAM
+echo ""
+echo "######## RAM Informations ########"
+RAM=$(grep -m1 '^MemTotal:' /proc/meminfo | awk '{print $2}')
+RAM=$(( $RAM / 1024 ))
+if [ -z "$RAM" ] || [ "$RAM" -lt 500 ]; then
+ # Fallback to dmidecode
+ RAM=0
+ for c in $(dmidecode -t 17 | grep -o 'Size:.*MB$' | awk '{print $2}'); do
+ RAM=$(( $RAM + $c ))
+ done
+fi
+echo "$RAM MB RAM"
+
+echo ""
+#echo "######## CURL ########"
+#curl --data "state=6" --insecure https://bas.stfu-kthx.net:8888/api/registrations/$UUID/state
+#echo ""
+#echo ""
diff --git a/server/ipxe/minilinux.ipxe b/server/ipxe/minilinux.ipxe
new file mode 100644
index 0000000..9d05ccc
--- /dev/null
+++ b/server/ipxe/minilinux.ipxe
@@ -0,0 +1,6 @@
+#!ipxe
+
+kernel tftp://10.8.102.124/kernel/kernel
+initrd tftp://10.8.102.124/initramfs-stage31-bss
+imgargs kernel ip=${net0/ip}:10.8.102.124:${net0/gateway}:${net0/netmask} BOOTIF=01-${net0/mac} bas=bas.stfu-kthx.net:8888
+boot \ No newline at end of file