From a8ecd1d48a53a9a565112f5e8dcef7508b0833d2 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 21 Nov 2018 14:29:51 +0100 Subject: [bss] main network scripts bootstraper --- .../data/network-hooks.d/00_execute_hooks | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 core/rootfs/rootfs-stage31/data/network-hooks.d/00_execute_hooks 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 00000000..6f57545c --- /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 -- cgit v1.2.3-55-g7522