| 40 |
#url=/mnt # format for a mounted directory |
#url=/mnt # format for a mounted directory |
| 41 |
dversion=2_2 |
dversion=2_2 |
| 42 |
dname=potato |
dname=potato |
| 43 |
verbose=1 |
verbose= |
| 44 |
# Additional packages that are install to nfsroot |
# Additional packages that are install to nfsroot |
| 45 |
packages="dhcp-client debconf file rdate cfengine bootpc wget rsh-client less ssh dump ext2resize raidtools2 lvm" |
packages="dhcp-client file rdate cfengine bootpc wget rsh-client less ssh dump ext2resize raidtools2 lvm" |
| 46 |
|
|
| 47 |
|
|
| 48 |
basetgz=base${dversion}.tgz |
basetgz=base${dversion}.tgz |
| 58 |
fi |
fi |
| 59 |
|
|
| 60 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 61 |
|
setup_ssh() { |
| 62 |
|
|
| 63 |
|
mkdir -p -m 700 $root/root/.ssh |
| 64 |
|
echo "To get remote access to the install client via ssh" |
| 65 |
|
echo "without a password, copy your ssh identity.pub to" |
| 66 |
|
echo "$root/root/.shh/authorized_keys" |
| 67 |
|
} |
| 68 |
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 69 |
recreate_nfsroot() { |
recreate_nfsroot() { |
| 70 |
|
|
| 71 |
echo Removing old nfsroot $root |
echo "Removing old nfsroot $root" |
| 72 |
rm -rf $root/* |
rm -rf $root/* |
| 73 |
cd $root |
cd $root |
| 74 |
echo Unpacking $basetgz |
get_basetgz |
| 75 |
|
echo "Unpacking $basetgz" |
| 76 |
tar zxpf /tmp/$basetgz |
tar zxpf /tmp/$basetgz |
| 77 |
touch etc/fstab etc/raidtab # dump and raidtool2 needs these files |
touch etc/fstab etc/raidtab # dump and raidtool2 needs these files |
|
mkdir -p etc/ssh |
|
|
touch etc/ssh/NOSERVER # don't start sshd on the host where fai is installed |
|
| 78 |
mkdir -p lib/modules/`uname -r` # dirty trick to hoax lvm |
mkdir -p lib/modules/`uname -r` # dirty trick to hoax lvm |
| 79 |
touch lib/modules/`uname -r`/modules.dep # dirty trick to hoax lvm |
touch lib/modules/`uname -r`/modules.dep # dirty trick to hoax lvm |
| 80 |
|
mkdir -p $root/etc/ssh ; touch $root/etc/ssh/NOSERVER |
| 81 |
upgrade_nfsroot |
upgrade_nfsroot |
| 82 |
perl -pi -e "s/^root::/root:${rootpw}:/" etc/passwd |
perl -pi -e "s/^root::/root:${rootpw}:/" etc/passwd |
| 83 |
mkdir -p $root/fai/fai_config |
mkdir -p $root/fai/fai_config |
| 104 |
EOF |
EOF |
| 105 |
chmod a+rx $root/etc/rc2.d/S01fai_abort |
chmod a+rx $root/etc/rc2.d/S01fai_abort |
| 106 |
|
|
| 107 |
touch $root/fai/BOOTP && echo "enable BOOTP method for fai" |
touch $root/fai/BOOTP && echo "fai now using BOOTP protocol" |
| 108 |
# touch $root/fai/DHCP && echo "enable DHCP method for fai" |
# touch $root/fai/DHCP && echo "fai now using DHCP protocol" |
| 109 |
|
setup_ssh |
| 110 |
|
|
| 111 |
} |
} |
| 112 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 113 |
upgrade_nfsroot() { |
upgrade_nfsroot() { |
| 114 |
|
|
| 115 |
echo Upgrading $root |
echo "Upgrading $root" |
| 116 |
apt-get -c $aptconf update > $devnull |
apt-get -c $aptconf update > $devnull |
| 117 |
apt-get -c $aptconf check > $devnull |
apt-get -c $aptconf check > $devnull |
| 118 |
chroot $root mount -n -t proc proc /proc |
chroot $root mount -n -t proc proc /proc |
| 119 |
apt-get -c $aptconf -y remove pcmcia-cs </dev/null > $devnull |
rm -rf $root/etc/pcmcia $root/etc/apm 2> $devnull |
| 120 |
|
apt-get -c $aptconf -y remove pcmcia-cs </dev/null 2>$devnull > $devnull |
| 121 |
|
|
| 122 |
# because start-stop-dameon must be faked do it here |
# because start-stop-dameon must be faked do it here |
| 123 |
apt-get -c $aptconf -y install dpkg </dev/null > $devnull |
apt-get -c $aptconf -y install dpkg </dev/null > $devnull |
| 124 |
cp -p /usr/lib/fai/sbin/start-stop-daemon $root/sbin |
cp -p /usr/lib/fai/sbin/start-stop-daemon $root/sbin |
| 125 |
|
|
| 126 |
apt-get -c $aptconf -y upgrade </dev/null > $devnull |
apt-get -c $aptconf -y upgrade </dev/null > $devnull |
| 127 |
echo Adding additional packages to $root |
echo "Adding additional packages to $root:" |
| 128 |
|
echo "$packages" |
| 129 |
apt-get -c $aptconf -y --fix-missing install $packages </dev/null > $devnull |
apt-get -c $aptconf -y --fix-missing install $packages </dev/null > $devnull |
| 130 |
chroot $root umount -n /proc >/dev/null |
chroot $root umount -n /proc >/dev/null |
| 131 |
} |
} |
| 132 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 133 |
|
get_basetgz() { |
| 134 |
|
|
| 135 |
# create installation filesystem that will be |
# TODO: parse sources.list and guess location for baseX_X.tgz |
| 136 |
# mounted readonly by all clients during installation process |
if [ ! -f /tmp/$basetgz ]; then |
| 137 |
# get base2_2.tgz via wget from ftp.debian.org (default no) |
case $url in |
| 138 |
|
ftp:*|http:*) |
| 139 |
|
echo "Getting base${dversion}.tgz from $url via wget" |
| 140 |
# TODO: parse sources.list and guess location for baseX_X.tgz |
echo "This may take some time" |
| 141 |
if [ ! -f /tmp/$basetgz ]; then |
wget -q -P/tmp $url/dists/$dname/main/disks-i386/current/base${dversion}.tgz |
| 142 |
case $url in |
;; |
| 143 |
ftp:*|http:*) |
*) cp -p $url/dists/$dname/main/disks-i386/current/base${dversion}.tgz /tmp |
| 144 |
echo "Getting base${dversion}.tgz from $url via wget" |
;; |
| 145 |
echo "This may take some time" |
esac |
| 146 |
wget -q -P/tmp $url/dists/$dname/main/disks-i386/current/base${dversion}.tgz |
fi |
| 147 |
;; |
if [ ! -f /tmp/$basetgz ]; then |
| 148 |
*) cp -p $url/dists/$dname/main/disks-i386/current/base${dversion}.tgz /tmp |
echo "Please copy the Debian $basetgz file into /tmp before creating nfsroot for fai." |
| 149 |
;; |
exit 1 |
| 150 |
esac |
fi |
| 151 |
fi |
} |
| 152 |
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
if [ ! -f /tmp/$basetgz ]; then |
|
|
echo "Please put the Debian $basetgz file into /tmp before creating nfsroot for fai." |
|
|
exit 1 |
|
|
fi |
|
| 153 |
|
|
| 154 |
if [ -d $root/fai ]; then |
if [ -d $root/fai ]; then |
| 155 |
echo $root/fai already exists |
echo $root/fai already exists |