update upstream to 9084a3cbc0a55422beea4a55b530c1f03a910617 feb 2024
[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 fai-sed '/# ReuseConnections: 1/d' /etc/apt-cacher-ng/acng.conf
31 ainsl -v /etc/apt-cacher-ng/acng.conf "ReuseConnections: 1"
32 ainsl -v /etc/apt-cacher-ng/acng.conf "PipelineDepth: 80"
33 ainsl -v /etc/apt-cacher-ng/acng.conf "DlMaxRetries: 6"
34
35 # copy base file for faster building of nfsroot
36 if [ -f /var/tmp/base.tar.xz ]; then
37 cp -p /var/tmp/base.tar.xz $target/var/tmp
38 fi
39
40 if [ -d /media/mirror/pool ]; then
41 mkdir $target/var/cache/apt-cacher-ng/_import
42 cp -p /media/mirror/pool/*/*/*/*.deb $target/var/cache/apt-cacher-ng/_import
43 $ROOTCMD chown -R apt-cacher-ng:apt-cacher-ng /var/cache/apt-cacher-ng/_import
44 fi
45
46 # copy basefiles from CD to config space
47 if [ -d $FAI/basefiles ]; then
48 mkdir -p $target/srv/fai/config/basefiles
49 cp -vp $FAI/basefiles/*.tar.* $target/srv/fai/config/basefiles 2>/dev/null || true
50 fi
51 fi