add devbyid dependency
[automated-distro-installer] / live-kexec
1 #!/bin/bash
2 #
3 # You can copy this to a http server, then wget -O- url|sudo bash
4 # or curl|bash, if curl is installed.
5 #
6 # This has been tested on trisquel belanos and ubuntu xenial.
7 #
8 # If the screen just sits in a weird color inverted, corrupted looking state,
9 # it's probably nothing wrong with the computer, but a problem
10 # with the fai server. If you can do this from a virtual terminal,
11 # it will print out more info (I know from running it on a vm).
12
13 set -ex
14 if grep -q ID=ubuntu /etc/os-release; then
15 sed -ri '/^\s*deb/{/universe/!s/$/ universe/}' /etc/apt/sources.list
16 fi
17 if ! type -p pxe-kexec &>/dev/null; then
18 apt-get update
19 apt-get install -y debconf
20 debconf-set-selections <<EOF
21 kexec-tools kexec-tools/load_kexec boolean false
22 EOF
23 apt-get install -y pxe-kexec
24 fi
25 # running this piped to bash on belanos, the apt-get goes
26 # into the background while it's still installing, and pxe-kexec
27 # just exits right away. sleep calls are strangely ignored.
28 # I don't know whats going on, but just running the same
29 # command again once it finishes works, and this is only
30 # rarely used and done manually anyways, so whatever.
31 pxe-kexec -n --ignore-whitelist -l fai-generated faiserver