update to 72d79e141d3aaf430bb44f6036a2980f3f5865bd
[automated-distro-installer] / fai / config / scripts / FAISERVER / 10-conffiles
1 #! /bin/bash
2
3 fcopy -BvrS /etc/fai
4 fcopy -BvS /etc/dhcp/dhcpd.conf
5
6 if [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ] ; then
7
8 # use the same sources.list for the server itself and the clients
9 cp -a $target/etc/fai/apt $target/etc/
10
11 if ifclass DHCPC; then
12 rm -f $target/etc/resolv.conf
13 else
14 echo 127.0.0.1 > $target/etc/resolv.conf
15 fi
16
17 # faiserver uses its own apt cache
18 ainsl -av /etc/apt/apt.conf.d/02proxy 'Acquire::http::Proxy "http://127.0.0.1:3142";'
19
20 # create some host entries
21 _nic=$(ip route | awk '/^default/ {print $5}'|head -1)
22 myip=$(ip -br ad sh $_nic | awk '{print $3}')
23 myip=${myip%/*}
24 ainsl /etc/hosts "$myip faiserver" # that's me
25 ainsl /etc/hosts "192.168.33.100 demohost"
26 ainsl /etc/hosts "192.168.33.101 xfcehost"
27 # add entries for 10 hosts called client 01 .. 10
28 perl -e 'for (1..10) {printf "192.168.33.%s client%02s\n",101+$_,$_;}' >> $target/etc/hosts
29
30 sed -i -e '/# ReuseConnections: 1/d' $target/etc/apt-cacher-ng/acng.conf
31 ainsl -v /etc/apt-cacher-ng/acng.conf "ReuseConnections: 0"
32
33 # copy base file for faster building of nfsroot
34 if [ -f /var/tmp/base.tar.xz ]; then
35 cp -p /var/tmp/base.tar.xz $target/var/tmp
36 fi
37
38 if [ -d /media/mirror/pool ]; then
39 mkdir $target/var/cache/apt-cacher-ng/_import
40 cp -p /media/mirror/pool/*/*/*/*.deb $target/var/cache/apt-cacher-ng/_import
41 $ROOTCMD chown -R apt-cacher-ng.apt-cacher-ng /var/cache/apt-cacher-ng/_import
42 fi
43
44 # copy basefiles from CD to config space
45 if [ -d $FAI/basefiles ]; then
46 mkdir -p $target/srv/fai/config/basefiles
47 cp -vp $FAI/basefiles/*.tar.* $target/srv/fai/config/basefiles 2>/dev/null || true
48 fi
49 fi