blob: 87b02ad3a3800e305488e0524e0b41948d0fe444 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
#!/bin/bash
# Copyright 2008 Eric Thibodeau <kyron@neuralbs.com>
# All rights reserved. Released under the GPL v2 license.
# This script is written so parts can be reused for liveCD mounting...eventually ;)
. /mnt/livecd/sbin/functions.sh
CDROOT=/mnt/livecd/
MKDIR=${CDROOT}/bin/mkdir
MODPROBE=${CDROOT}/sbin/modprobe
conf_error() {
eerror "CONFIG_OK is not set to 'yes' in $1"
eerror "Please edit ALL files in $(dirname $1)"
eerror "and re-run $0"
einfo "If there are some files in $(dirname $1)"
einfo "which don't need configuration, hid them with"
einfo "a '.' before the name of the file"
exit 1
}
aufs_mount() {
$MODPROBE aufs || eerror "Got $? while probing for aufs module!"
# Looping this simply because it should replace the current tmpfs mounting of the liveCD :P
for I in tftproot
do
einfo "Setting up AUFS mount for /$I"
${MKDIR} -p /mnt/aufs/$I /$I
mount -t tmpfs tmpfs_$I /mnt/aufs/$I
mount -n -t aufs -o br:/mnt/aufs/${I}=rw:/mnt/livecd/${I} aufs_mount /${I}
done
}
do_conf() {
. $1
shift
einfo "Calling $* "
$*
if [ $? != 0 ]; then
eerror "Call to $* did not returne 0 errors (there were some!)"
ewarn "Look above this message for clues."
exit 1
fi
}
# This could have been inlined into do_conf but we would rather check configs _before_
# we do anything...we could be a little mode selective than /etc/gentoo/* though
check_conf() {
einfo "Checking config files.."
for I in /etc/gentoo/*
do
. $I
[[ $CONFIG_OK == "yes" ]] || conf_error $I
done
}
# speed up the dev cycle by automating some tasks:
if [[ "$1" == "--test" ]]; then
ewarn
ewarn "Yeah...you know what you're doing right?"
ewarn "Warranty void if used ;)"
ewarn
cat >> /etc/conf.d/net <<-EOF
# These lines were added by 'cluster-setup --test'
config_eth1=( "10.0.0.1 broadcast 10.0.0.255 netmask 255.255.255.0" )
modules_eth1=( "!plug" )
# End of 'added by cluster-setup --test'
EOF
/etc/init.d/net.eth1 restart
echo root:test | chpasswd
/etc/init.d/sshd start
sed -i -e's:CONFIG_OK="no":CONFIG_OK="yes":' /etc/gentoo/*
fi
check_conf
aufs_mount
# After this, all paths should be ok (no need to use relative paths with ${CDROOT}
do_conf /etc/gentoo/ldap_auth.conf "emerge --config =net-nds/ldap-auth-0.1"
/etc/init.d/slapd start || ewarn "Slapd did not start! See above for error messages...continuing"
. /etc/gentoo/cluster.conf
einfo "Making sure $CLUSTER_ETH is configured correctly.."
if [[ "$CLUSTER_ETH" =~ eth.* && $1 != "--test" ]]; then
echo "The cluster's NIC is set as $CLUSTER_ETH with the following config:"
/sbin/ifconfig $CLUSTER_ETH
until [[ $ANS == "y" || $ANS == "n" ]]
do
echo -n "Do you want to change this now? [y/n]: "
read ANS
done
if [[ $ANS == "y" ]]; then
net-setup $CLUSTER_ETH
einfo "Adding modules_${CLUSTER_ETH}=( \"!plug\" ) to /etc/conf.d/net (required for the system's consistency)"
echo "modules_${CLUSTER_ETH}=( \"!plug\" )" >> /etc/conf.d/net
einfo "$CLUSTER_ETH will have to be restarted to be in a consistent state"
/etc/init.d/net.$CLUSTER_ETH restart
fi
[[ $ANS == "n" ]] && einfo "You know what you're doing..."
else
einfo "CLUSTER_ETH is not set to an eth? device: $CLUSTER_ETH"
einfo "Hope you know what you're doing!"
fi
do_conf /etc/gentoo/cluster.conf "emerge --config =sys-cluster/beowulf-head-0.1"
einfo "Setting up auth on the $NFSROOT "
USE=-authmaster ROOT="$NFSROOT" emerge --config =net-nds/ldap-auth-0.1
|