4 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
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
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:
21 line
='ian ALL=(ALL) NOPASSWD: ALL'
22 if [[ ! -e $f ]] ||
! grep -xF "$line" $f; then
27 dir
=/q
/p
/c
/machine_specific
/$HOSTNAME/.unison
28 $ROOTCMD mkdir
-p $dir
30 $ROOTCMD rm -rf /root
/.unison
31 $ROOTCMD ln -sf $dir /root
32 $ROOTCMD ln -sf /q
/p
/
35 $ROOTCMD chown
1000:1000 $dir
36 $ROOTCMD chmod 700 $dir
38 [[ $dir != /q
]] ||
break
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 ]]