upstream 00f2ea2b8 as of 2018-09-02
[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 myip=$(ip addr show up| grep -w inet | cut -d t -f 2 | cut -d ' ' -f 2 | cut -d / -f 1 | grep -v 127.0.0.1)
22 ainsl /etc/hosts "$myip faiserver" # that's me
23 ainsl /etc/hosts "192.168.33.100 demohost"
24 ainsl /etc/hosts "192.168.33.101 xfcehost"
25 # add entries for 10 hosts called client 01 .. 10
26 perl -e 'for (1..10) {printf "192.168.33.%s client%02s\n",101+$_,$_;}' >> $target/etc/hosts
27
28 sed -i -e '/# ReuseConnections: 1/d' $target/etc/apt-cacher-ng/acng.conf
29 ainsl -v /etc/apt-cacher-ng/acng.conf "ReuseConnections: 0"
30
31 # copy base file for faster building of nfsroot
32 if [ -f /var/tmp/base.tar.xz ]; then
33 cp -p /var/tmp/base.tar.xz $target/var/tmp
34 fi
35
36 if [ -d /media/mirror/pool ]; then
37 mkdir $target/var/cache/apt-cacher-ng/_import
38 cp -p /media/mirror/pool/*/*/*/*.deb $target/var/cache/apt-cacher-ng/_import
39 $ROOTCMD chown -R apt-cacher-ng.apt-cacher-ng /var/cache/apt-cacher-ng/_import
40 fi
41
42 # copy basefiles from CD to config space
43 if [ -d $FAI/basefiles ]; then
44 mkdir -p $target/srv/fai/config/basefiles
45 cp -vp $FAI/basefiles/*.tar.* $target/srv/fai/config/basefiles 2>/dev/null || true
46 fi
47 fi