2011-06-17 15:47:37 +00:00
|
|
|
root=1
|
|
|
|
rootok=1
|
|
|
|
netroot=xcat
|
|
|
|
clear
|
|
|
|
echo '[ -e $NEWROOT/proc ]' > /initqueue-finished/xcatroot.sh
|
2011-06-17 20:16:38 +00:00
|
|
|
udevd --daemon
|
|
|
|
udevadm trigger
|
|
|
|
mkdir -p /var/lib/dhclient/
|
2011-06-17 21:00:46 +00:00
|
|
|
ip link set lo up
|
2011-06-17 20:16:38 +00:00
|
|
|
if [ ! -z "$BOOTIF" ]; then
|
|
|
|
BOOTIF=`echo $BOOTIF|sed -e s/01-// -e s/-/:/g`
|
|
|
|
echo -n "Waiting for device with address $BOOTIF to appear.."
|
|
|
|
gripeiter=300
|
|
|
|
while [ -z "$bootnic" ]; do
|
|
|
|
bootnic=`ip link show|grep -B1 $BOOTIF|grep mtu|awk '{print $2}'`
|
|
|
|
sleep 0.1
|
|
|
|
if [ $gripeiter = 0 ]; then
|
|
|
|
echo "ERROR"
|
|
|
|
echo "Unable to find boot device (maybe the nbroot is missing the driver for your nic?)"
|
|
|
|
while :; do sleep 365d; done
|
|
|
|
fi
|
|
|
|
gripeiter=$((gripeiter-1))
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
echo "Done"
|
|
|
|
if [ -z "$bootnic" ]; then
|
|
|
|
echo "ERROR: BOOTIF missing, can't detect boot nic"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r /sys/devices/virtual/dmi/id/product_uuid ]; then
|
|
|
|
duid='default-duid "\\000\\004';
|
|
|
|
for i in `sed -e s/-//g -e 's/\(..\)/\1 /g' /sys/devices/virtual/dmi/id/product_uuid`; do
|
|
|
|
octnum="\\"`printf "\\%03o" 0x$i`
|
|
|
|
duid=$duid$octnum
|
|
|
|
done
|
|
|
|
duid=$duid'";'
|
|
|
|
echo $duid > /var/lib/dhclient/dhclient6.leases
|
|
|
|
fi
|
2011-06-17 15:47:37 +00:00
|
|
|
#/bin/dash
|
|
|
|
mkdir -p /etc/ssh
|
|
|
|
mkdir -p /var/empty/sshd
|
2011-06-17 20:16:38 +00:00
|
|
|
echo root:x:0:0::/:/bin/sh >> /etc/passwd
|
2011-06-17 15:47:37 +00:00
|
|
|
echo sshd:x:30:30:SSH User:/var/empty/sshd:/sbin/nologin >> /etc/passwd
|
|
|
|
ssh-keygen -q -t rsa -f /etc/ssh/ssh_host_rsa_key -C '' -N ''
|
|
|
|
ssh-keygen -q -t dsa -f /etc/ssh/ssh_host_dsa_key -C '' -N ''
|
|
|
|
echo 'Protocol 2' >> /etc/ssh/sshd_config
|
|
|
|
/usr/sbin/sshd
|
2011-06-17 20:16:38 +00:00
|
|
|
dhclient $bootnic &
|
|
|
|
dhclient -6 $bootnic -lf /var/lib/dhclient/dhclient6.leases &
|
2011-07-08 18:46:24 +00:00
|
|
|
mkdir -p /etc/xcat
|
2011-07-13 18:13:11 +00:00
|
|
|
mkdir -p /etc/pki/tls
|
|
|
|
touch /etc/pki/tls/openssl.cnf
|
2011-07-08 18:46:24 +00:00
|
|
|
openssl genrsa -out /etc/xcat/privkey.pem 1024
|
|
|
|
PUBKEY=`openssl rsa -in /etc/xcat/privkey.pem -pubout|grep -v "PUBLIC KEY"`
|
|
|
|
PUBKEY=`echo $PUBKEY|sed -e 's/ //g'`
|
2011-07-11 18:52:03 +00:00
|
|
|
export PUBKEY
|
2011-07-08 18:46:24 +00:00
|
|
|
mkdir -p /var/lib/lldpad
|
|
|
|
echo 'lldp :' >> /var/lib/lldpad/lldpad.conf
|
|
|
|
echo '{' >> /var/lib/lldpad/lldpad.conf
|
2011-07-14 16:44:38 +00:00
|
|
|
for iface in `ip link |grep -v '^ '|awk '{print $2}'|sed -e 's/:$//'|grep -v lo`; do
|
2011-07-08 18:46:24 +00:00
|
|
|
echo "$iface :" >> /var/lib/lldpad/lldpad.conf
|
|
|
|
echo "{" >> /var/lib/lldpad/lldpad.conf
|
2011-07-14 16:50:46 +00:00
|
|
|
echo "tlvid00000005 :" >> /var/lib/lldpad/lldpad.conf
|
|
|
|
echo "{" >> /var/lib/lldpad/lldpad.conf
|
|
|
|
echo 'enableTx = true;' >> /var/lib/lldpad/lldpad.conf
|
|
|
|
echo '};' >> /var/lib/lldpad/lldpad.conf
|
2011-07-08 18:46:24 +00:00
|
|
|
echo "tlvid00000006 :" >> /var/lib/lldpad/lldpad.conf
|
|
|
|
echo "{" >> /var/lib/lldpad/lldpad.conf
|
|
|
|
echo info = '"'$PUBKEY'";' >> /var/lib/lldpad/lldpad.conf
|
2011-07-14 16:36:29 +00:00
|
|
|
echo 'enableTx = true;' >> /var/lib/lldpad/lldpad.conf
|
2011-07-08 18:46:24 +00:00
|
|
|
echo '};' >> /var/lib/lldpad/lldpad.conf
|
|
|
|
echo 'adminStatus = 3;' >> /var/lib/lldpad/lldpad.conf
|
|
|
|
echo '};' >> /var/lib/lldpad/lldpad.conf
|
|
|
|
done
|
|
|
|
echo '};' >> /var/lib/lldpad/lldpad.conf
|
|
|
|
lldpad -d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-17 20:16:38 +00:00
|
|
|
gripeiter=101
|
|
|
|
echo -n "Acquiring network addresses.."
|
|
|
|
while ! ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet > /dev/null; do
|
|
|
|
sleep 0.1
|
|
|
|
if [ $gripeiter = 1 ]; then
|
|
|
|
echo
|
|
|
|
echo "It seems to be taking a while to acquire an IPv4 address, you may want to check spanning tree..."
|
|
|
|
fi
|
|
|
|
gripeiter=$((gripeiter-1))
|
|
|
|
done
|
|
|
|
echo -n "Acquired IPv4 address "
|
|
|
|
ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet|awk '{print $2}'
|
2011-06-17 21:00:46 +00:00
|
|
|
if [ "$destiny" = "discover" ]; then #skip a query to xCAT when /proc/cmdline will do
|
|
|
|
/bin/dodiscovery
|
|
|
|
fi
|
2011-06-17 20:16:38 +00:00
|
|
|
/bin/dash
|