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