upstream 00f2ea2b8 as of 2018-09-02
[automated-distro-installer] / fai / config / scripts / FAIBASE / 10-misc
1 #! /bin/bash
2
3 # (c) Thomas Lange, 2001-2012, lange@debian.org
4
5 error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
6
7 echo $TIMEZONE > $target/etc/timezone
8 if [ -L $target/etc/localtime ]; then
9 ln -sf /usr/share/zoneinfo/${TIMEZONE} $target/etc/localtime
10 else
11 cp -f /usr/share/zoneinfo/${TIMEZONE} $target/etc/localtime
12 fi
13
14 if [ -n "$IPADDR" ]; then
15 ifclass DHCPC || ainsl -s /etc/hosts "$IPADDR $HOSTNAME.$DOMAIN $HOSTNAME"
16 else
17 ifclass DHCPC && ainsl -s /etc/hosts "127.0.0.1 $HOSTNAME"
18 fi
19
20 if [ -f $target/etc/hosts.orig ]; then
21 mv $target/etc/hosts.orig $target/etc/hosts
22 fi
23 fcopy -iM /etc/hosts /etc/motd
24
25 # make /root accessible only by root
26 chmod -c 0700 $target/root
27 chown -c root:root $target/root
28 # copy default dotfiles for root account
29 fcopy -ir /root
30
31 # use tmpfs for /tmp
32 ainsl /etc/fstab "tmpfs /tmp tmpfs nodev,nosuid,size=50%,mode=1777 0 0"
33 chmod -c 1777 ${target}/tmp
34 chown -c 0:0 ${target}/tmp
35
36 exit $error