4 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
6 if [[ $EUID != 0 ]]; then
7 echo "$0: error: expected to be root."
11 if ! type -t fcopy
&>/dev
/null
; then
12 sudo apt-get
-y install fai-client
16 fai_shadow
=$FAI/distro-install-common
/shadow
17 if [[ ! -e $dir && -e $fai_shadow ]]; then
19 mount
-o bind $fai_shadow $dir
21 $FAI/distro-install-common
/end
23 if ifclass STABLE || ifclass LINODESTABLE
; then
24 fcopy
-M /etc
/apt
/preferences
27 if ifclass DEBIAN
; then
28 fcopy
-M /etc
/apt
/preferences.d
/unstable
30 fcopy
-riM /etc
/apt
/sources.list.d
31 $ROOTCMD apt-get update
36 # fcopy -i = ignore nonmatching class error, always return 0.
38 # for lj, this will be empty and fail
39 fcopy
-riM /home
/ian
/.
ssh
41 rm -f $FAI_ROOT/etc
/apt
/sources.list
43 chroot
$FAI_ROOT bash
<<'EOF'
45 mkdir -p /home/ian/.ssh
46 f=/root/.ssh/authorized_keys
50 chown -R 1000:1000 /home/ian/.ssh
51 chmod -R u=Xrw,og= /home/ian/.ssh
53 cp -rL /home/ian/.ssh /root
54 chown -R root:root /root/.ssh
57 # default jessie groups + kvm, systemd-journal, adm
58 usermod -aG adm,cdrom,floppy,sudo,audio,dip,video,plugdev,netdev,systemd-journal ian
60 # https://askubuntu.com/questions/33416/how-do-i-disable-the-boot-splash-screen-and-only-show-kernel-and-boot-text-inst
61 # it suggests not having plymouth-theme-ubuntu-text, but
62 # making it not installed then kills plymouth, then makes
63 # the system not boot.
64 sed -ri 's/(^ *GRUB_CMDLINE_LINUX.*)quiet splash/\1/' /etc/default/grub
65 # on xenial, no grub is displayed at all. fix that.
66 # found just by noticing this in the config file, and a
67 # warning about it in error.log
68 sed -i '/^ *GRUB_HIDDEN_TIMEOUT/d' /etc/default/grub
73 # reading through the groups that ian is in but traci isn't,
74 for g
in plugdev audio video cdrom
; do
75 $ROOTCMD usermod
-a -G $g traci
78 # makes the journal be saved to disk.
79 $ROOTCMD mkdir
-p $FAI_ROOT/var
/log
/journal
80 $ROOTCMD chmod 755 $FAI_ROOT/var
/log
/journal