add support for trisquel belanos
[automated-distro-installer] / fai / config / scripts / GRUB_PC / 11-ian
1 #!/bin/bash -x
2
3 set -eE -o pipefail
4 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
5
6 if [[ $EUID != 0 ]]; then
7 echo "$0: error: expected to be root."
8 exit 1
9 fi
10
11 if ! type -t fcopy &>/dev/null; then
12 sudo apt-get -y install fai-client
13 fi
14
15 dir=/q/root/shadow
16 fai_shadow=$FAI/distro-install-common/shadow
17 if [[ ! -e $dir && -e $fai_shadow ]]; then
18 mkdir -p $dir
19 mount -o bind $fai_shadow $dir
20 fi
21 $FAI/distro-install-common/end
22
23 if ifclass STABLE || ifclass LINODESTABLE; then
24 fcopy -M /etc/apt/preferences
25 fi
26
27 if ifclass DEBIAN; then
28 fcopy -M /etc/apt/preferences.d/unstable
29 fi
30 fcopy -riM /etc/apt/sources.list.d
31 $ROOTCMD apt-get update
32
33
34
35 # note:
36 # fcopy -i = ignore nonmatching class error, always return 0.
37
38 # for lj, this will be empty and fail
39 fcopy -riM /home/ian/.ssh
40
41 rm -f $FAI_ROOT/etc/apt/sources.list
42
43 chroot $FAI_ROOT bash <<'EOF'
44 set -eE -o pipefail
45 mkdir -p /home/ian/.ssh
46 f=/root/.ssh/authorized_keys
47 if [[ -e $f ]]; then
48 cp $f /home/ian/.ssh
49 fi
50 chown -R 1000:1000 /home/ian/.ssh
51 chmod -R u=Xrw,og= /home/ian/.ssh
52 rm -rf /root/.ssh
53 cp -rL /home/ian/.ssh /root
54 chown -R root:root /root/.ssh
55 chmod 700 /root/.ssh
56
57
58 # default jessie groups + kvm, systemd-journal, adm
59 usermod -aG adm,cdrom,floppy,sudo,audio,dip,video,plugdev,netdev ian
60
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
66 fi
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
76 update-grub2
77 EOF
78
79
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
83 done
84