arch use by-id and various fixes
[automated-distro-installer] / fai / config / distro-install-common / end
1 #!/bin/bash -x
2
3 set -eE -o pipefail
4 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
5
6
7
8
9 # based on unison error, with 8192 from
10 # sysctl -a | grep fs.inotify.max_user_watches
11 #http://stackoverflow.com/questions/535768/what-is-a-reasonable-amount-of-inotify-watches-with-linux
12
13 f=$target/etc/sysctl.d/99-sysctl.conf
14 key=fs.inotify.max_user_watches
15 if [[ -e $f ]]; then sed -ri "/^\s*$key\s*=/d" $f; fi
16 echo "fs.inotify.max_user_watches = 1000000" >> $f
17 # if we weren't rebooting, you could apply it now with:
18 # sysctl --system
19
20 f=$target/etc/sudoers
21 line='ian ALL=(ALL) NOPASSWD: ALL'
22 if [[ ! -e $f ]] || ! grep -xF "$line" $f; then
23 echo "$line" >> $f
24 fi
25
26
27 dir=/q/p/c/machine_specific/$HOSTNAME/.unison
28 $ROOTCMD mkdir -p $dir
29
30 $ROOTCMD rm -rf /root/.unison
31 $ROOTCMD ln -sf $dir /root
32 $ROOTCMD ln -sf /q/p /
33
34 while true; do
35 $ROOTCMD chown 1000:1000 $dir
36 $ROOTCMD chmod 700 $dir
37 dir=$(dirname $dir)
38 [[ $dir != /q ]] || break
39 done
40
41 # kvm is normally created by some package,
42 # but unison doesn't like unknown groups, so make it now so initial sync works.
43 $ROOTCMD groupadd -r kvm || [[ $? == 9 ]]