summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2018-11-21 14:29:51 +0100
committerJonathan Bauer2018-11-21 14:29:51 +0100
commita8ecd1d48a53a9a565112f5e8dcef7508b0833d2 (patch)
treeba0d3673051ce5a63f6c15ed94c0e42738a8f85d
parent[s31-bss] add system-uuid (diff)
downloadmltk-bss-system-info.tar.gz
mltk-bss-system-info.tar.xz
mltk-bss-system-info.zip
[bss] main network scripts bootstraperbss-system-info
-rw-r--r--core/rootfs/rootfs-stage31/data/network-hooks.d/00_execute_hooks32
1 files changed, 32 insertions, 0 deletions
diff --git a/core/rootfs/rootfs-stage31/data/network-hooks.d/00_execute_hooks b/core/rootfs/rootfs-stage31/data/network-hooks.d/00_execute_hooks
new file mode 100644
index 0000000..6f57545
--- /dev/null
+++ b/core/rootfs/rootfs-stage31/data/network-hooks.d/00_execute_hooks
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+BAS=$(grep -oE 'bas=\S*' /proc/cmdline)
+BAS=${BAS#'bas='}
+export BAS
+UUID=$(dmidecode -q -s system-uuid)
+
+mkdir /tmp/nexthook
+cd /tmp/nexthook
+while true
+do
+ curl -s -D header -o script --insecure https://$BAS/api/registrations/$UUID/nexthook
+ if [ -s script ]
+ then
+ echo ""
+ if sh script
+ then
+ ID=$(grep -oE 'id:\s\S+' header)
+ ID=${ID#'id: '}
+ curl -s --data "id=$ID" --insecure https://$BAS/api/registrations/$UUID/success > /dev/null
+ echo ""
+ echo "Script with id $ID finished."
+ echo ""
+ fi
+ else
+ break
+ fi
+
+ drop_shell
+done
+
+reboot -f