update to 31b795ca71189b326b80666076398f31aea4f2be
[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 [ -f $target/etc/hosts.orig ]; then
15 mv $target/etc/hosts.orig $target/etc/hosts
16 fi
17 if [ -n "$IPADDR" ]; then
18 ifclass DHCPC || ainsl -s /etc/hosts "$IPADDR $HOSTNAME.$DOMAIN $HOSTNAME"
19 else
20 ifclass DHCPC && ainsl -s /etc/hosts "127.0.0.1 $HOSTNAME"
21 fi
22 fcopy -iM /etc/hosts /etc/motd
23
24 # make /root accessible only by root
25 chmod -c 0700 $target/root
26 chown -c root:root $target/root
27 # copy default dotfiles for root account
28 fcopy -ir /root
29
30 # use tmpfs for /tmp if not defined in disk_config
31 if ! grep -Pq '\s/tmp\s' $target/etc/fstab; then
32 ainsl /etc/fstab "tmpfs /tmp tmpfs nodev,nosuid,size=50%,mode=1777 0 0"
33 fi
34 chmod -c 1777 ${target}/tmp
35 chown -c 0:0 ${target}/tmp
36
37 exit $error