ovirt-node 2.2.0 release
[ovirt-node.git] / scripts / local_boot_trigger.sh
blobe9244c1e24de3ee92fb3e5db8f5e179c18b2b5f1
1 #!/bin/bash
2 # local_boot_trigger.sh - access given URL to signal that node installation
3 # is done
5 # Scripts in /etc/ovirt-config-boot.d/ are executed just before the node is
6 # rebooted. This one calls an URL given as a boot parameter e.g.
7 # local_boot_trigger=http://cobbler.server.example.com/cblr/svc/op/nopxe/system/@HOSTNAME@
8 # where @HOSTNAME@ is replaced by $(hostname)
9 # In this example, Cobbler is triggered to change pxelinux config for that
10 # system to perform a local boot when /etc/cobbler/settings/pxe_just_once
11 # is set to 1.
13 trigger_url=
14 for i in $(cat /proc/cmdline); do
15 case $i in
16 local_boot_trigger=*)
17 trigger_url=${i#local_boot_trigger=}
19 esac
20 done
22 if [ -n "$trigger_url" ]; then
23 trigger_url=$(echo $trigger_url | sed -e "s/@HOSTNAME@/$(hostname)/")
24 wget "$trigger_url" -O /dev/null