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
58 # default jessie groups + kvm, systemd-journal, adm
59 usermod -aG adm,cdrom,floppy,sudo,audio,dip,video,plugdev,netdev ian
61 if getent group systemd-journal >/dev/null; then
62 usermod -aG systemd-journal ian
63 # makes the journal be saved to disk.
64 mkdir -p /var/log/journal
65 chmod 755 /var/log/journal
67 # https://askubuntu.com/questions/33416/how-do-i-disable-the-boot-splash-screen-and-only-show-kernel-and-boot-text-inst
68 # it suggests not having plymouth-theme-ubuntu-text, but
69 # making it not installed then kills plymouth, then makes
70 # the system not boot.
71 sed -ri 's/(^ *GRUB_CMDLINE_LINUX.*)quiet splash/\1/' /etc/default/grub
72 # on xenial, no grub is displayed at all. fix that.
73 # found just by noticing this in the config file, and a
74 # warning about it in error.log
75 sed -i '/^ *GRUB_HIDDEN_TIMEOUT/d' /etc/default/grub
80 # reading through the groups that ian is in but traci isn't,
81 for g
in plugdev audio video cdrom
; do
82 $ROOTCMD usermod
-a -G $g traci