upstream 00f2ea2b8 as of 2018-09-02
[automated-distro-installer] / fai / config / hooks / debconf.IMAGE
1 #! /bin/bash
2
3 # hook for installing a file system image (tar file)
4 # this works for Ubuntu 14.04
5 #
6 # Copyright (C) 2015 Thomas Lange, lange@informatik.uni-koeln.de
7
8
9 # I use this tar command to create the image of an already running and configured machine
10 # tar -cf /tmp/IMAGE.tar --exclude /tmp/\* --exclude /run/\* --exclude /proc/\* --exclude /sys/\* --exclude /dev/\* /
11 # add --xattrs --selinux --acls if needed (for CentOS 7)
12 # Then copy this image to /srv/fai/config/basefiles/IMAGE.tar and make sure your client belongs to the class IMAGE
13
14 skiptask extrbase debconf repository updatebase instsoft
15 skiptask configure # do not run the usual configure scripts
16
17 # we assume, that the new host will get its hostname and IP via DHCP
18 # remove old hostname
19 fgrep -v 127.0.1.1 $target/etc/hosts >> /tmp/fai/hosts
20 mv /tmp/fai/hosts $target/etc/hosts
21 rm $target/etc/hostname
22
23 #install grub
24 mount -t proc proc $FAI_ROOT/proc
25 mount -t sysfs sysfs $FAI_ROOT/sys
26 mount --bind /dev $FAI_ROOT/dev
27
28 if [ -f $target/etc/debian_version ]; then
29 $ROOTCMD grub-install $BOOT_DEVICE
30 $ROOTCMD update-grub
31 fi
32 if [ -f $target/etc/centos-release ]; then
33 rm $target/etc/grub2/device.map
34 $FAI/scripts/CENTOS/40-install-grub
35 $FAI/scripts/CENTOS/30-mkinitrd
36 $ROOTCMD fixfiles onboot # this fixes the SELinux security contexts during the first boot
37 fi
38
39
40 # things that may be adjusted:
41 #
42 # MAC address ?? (not needed for Ubuntu, it uses iftab(5)
43 # /etc/hosts may contain the IP and name of the original host
44 # /etc/hostname (for Ubuntu just remove it)
45 # /var/lib/NetworkManager/dhclient-eth0.conf?