Commit a0a8b1b2 authored by Leigh B Stoller's avatar Leigh B Stoller

Merge branch 'mymaster'

parents 04f64b66 0aba0db3
......@@ -104,6 +104,17 @@ else
setboss=0
fi
# Indicates the MFS has been properly localized and we can copy stuff
# into the image.
LOCALIZED="/.localized"
islocalized() {
if [ -e $LOCALIZED ]; then
return 0;
fi
return 1;
}
dofreebsd() {
#
# ARGH! FreeBSD 5, which primarily uses UFS2, internally converts
......@@ -295,62 +306,64 @@ dofreebsd() {
fi
fi
# Check the certs.
if [ -e $ETCDIR/emulab.pem ]; then
cmp -s $ETCDIR/emulab.pem /mnt/etc/emulab/emulab.pem
if islocalized; then
# Check the certs.
if [ -e $ETCDIR/emulab.pem ]; then
cmp -s $ETCDIR/emulab.pem /mnt/etc/emulab/emulab.pem
if [ $? -ne 0 ]; then
changecerts=1
fixit=1
if [ $? -ne 0 ]; then
changecerts=1
fixit=1
fi
fi
fi
if [ -e $ETCDIR/client.pem ]; then
cmp -s $ETCDIR/client.pem /mnt/etc/emulab/client.pem
if [ -e $ETCDIR/client.pem ]; then
cmp -s $ETCDIR/client.pem /mnt/etc/emulab/client.pem
if [ $? -ne 0 ]; then
changecerts=1
fixit=1
if [ $? -ne 0 ]; then
changecerts=1
fixit=1
fi
fi
fi
# Check the root keys
if [ -e /root/.ssh/authorized_keys2 ]; then
cmp -s /root/.ssh/authorized_keys2 /mnt/root/.ssh/authorized_keys
if [ $? -ne 0 ]; then
changerootkeys=1
fixit=1
# Check the root keys
if [ -e /root/.ssh/authorized_keys2 ]; then
cmp -s /root/.ssh/authorized_keys2 /mnt/root/.ssh/authorized_keys
if [ $? -ne 0 ]; then
changerootkeys=1
fixit=1
fi
fi
fi
# Check the host keys.
if [ -e /etc/ssh/ssh_host_key -a -d /mnt/etc/ssh ]; then
cmp -s /etc/ssh/ssh_host_key /mnt/etc/ssh/ssh_host_key
if [ $? -ne 0 ]; then
changehostkeys=1
fixit=1
# Check the host keys.
if [ -e /etc/ssh/ssh_host_key -a -d /mnt/etc/ssh ]; then
cmp -s /etc/ssh/ssh_host_key /mnt/etc/ssh/ssh_host_key
if [ $? -ne 0 ]; then
changehostkeys=1
fixit=1
fi
fi
fi
if [ -e /etc/ssh/ssh_host_rsa_key -a -d /mnt/etc/ssh ]; then
cmp -s /etc/ssh/ssh_host_rsa_key /mnt/etc/ssh/ssh_host_rsa_key
if [ $? -ne 0 ]; then
changehostkeys=1
fixit=1
if [ -e /etc/ssh/ssh_host_rsa_key -a -d /mnt/etc/ssh ]; then
cmp -s /etc/ssh/ssh_host_rsa_key /mnt/etc/ssh/ssh_host_rsa_key
if [ $? -ne 0 ]; then
changehostkeys=1
fixit=1
fi
fi
fi
if [ -e /etc/ssh/ssh_host_dsa_key -a -d /mnt/etc/ssh ]; then
cmp -s /etc/ssh/ssh_host_dsa_key /mnt/etc/ssh/ssh_host_dsa_key
if [ $? -ne 0 ]; then
changehostkeys=1
fixit=1
if [ -e /etc/ssh/ssh_host_dsa_key -a -d /mnt/etc/ssh ]; then
cmp -s /etc/ssh/ssh_host_dsa_key /mnt/etc/ssh/ssh_host_dsa_key
if [ $? -ne 0 ]; then
changehostkeys=1
fixit=1
fi
fi
fi
# Check the time zone.
if [ -e /etc/localtime ]; then
cmp -s /etc/localtime /mnt/etc/localtime
if [ $? -ne 0 ]; then
changezone=1
fixit=1
# Check the time zone.
if [ -e /etc/localtime ]; then
cmp -s /etc/localtime /mnt/etc/localtime
if [ $? -ne 0 ]; then
changezone=1
fixit=1
fi
fi
fi
......@@ -725,107 +738,109 @@ dolinux() {
fi
# Check the certs.
if [ ! -d /mnt/etc/emulab ]; then
mkdir -m 755 /mnt/etc/emulab || {
echo "Failed to mkdir /mnt/etc/emulab"
umount $rootdev
return 1
}
fi
if [ -e $ETCDIR/emulab.pem ]; then
cmp -s $ETCDIR/emulab.pem /mnt/etc/emulab/emulab.pem
if [ $? -ne 0 ]; then
echo " updating /mnt/etc/emulab/emulab.pem"
cp -p $ETCDIR/emulab.pem /mnt/etc/emulab || {
echo "Failed to create $ETCDIR/emulab.pem"
if islocalized; then
if [ ! -d /mnt/etc/emulab ]; then
mkdir -m 755 /mnt/etc/emulab || {
echo "Failed to mkdir /mnt/etc/emulab"
umount $rootdev
return 1
}
fi
fi
if [ -e $ETCDIR/client.pem ]; then
cmp -s $ETCDIR/client.pem /mnt/etc/emulab/client.pem
if [ -e $ETCDIR/emulab.pem ]; then
cmp -s $ETCDIR/emulab.pem /mnt/etc/emulab/emulab.pem
if [ $? -ne 0 ]; then
echo " updating /mnt/etc/emulab/client.pem"
cp -p $ETCDIR/client.pem /mnt/etc/emulab || {
echo "Failed to create $ETCDIR/client.pem"
umount $rootdev
return 1
}
if [ $? -ne 0 ]; then
echo " updating /mnt/etc/emulab/emulab.pem"
cp -p $ETCDIR/emulab.pem /mnt/etc/emulab || {
echo "Failed to create $ETCDIR/emulab.pem"
umount $rootdev
return 1
}
fi
fi
fi
if [ -e $ETCDIR/client.pem ]; then
cmp -s $ETCDIR/client.pem /mnt/etc/emulab/client.pem
# Check the root keys
if [ -e /root/.ssh/authorized_keys2 ]; then
cmp -s /root/.ssh/authorized_keys2 /mnt/root/.ssh/authorized_keys
if [ $? -ne 0 ]; then
echo " updating /root/.ssh/authorized_keys2"
if [ $? -ne 0 ]; then
echo " updating /mnt/etc/emulab/client.pem"
cp -p $ETCDIR/client.pem /mnt/etc/emulab || {
echo "Failed to create $ETCDIR/client.pem"
umount $rootdev
return 1
}
fi
fi
if [ ! -d /mnt/root/.ssh ]; then
mkdir -m 700 /mnt/root/.ssh || {
echo "Failed to mkdir /root/.ssh"
# Check the root keys
if [ -e /root/.ssh/authorized_keys2 ]; then
cmp -s /root/.ssh/authorized_keys2 /mnt/root/.ssh/authorized_keys
if [ $? -ne 0 ]; then
echo " updating /root/.ssh/authorized_keys2"
if [ ! -d /mnt/root/.ssh ]; then
mkdir -m 700 /mnt/root/.ssh || {
echo "Failed to mkdir /root/.ssh"
umount $rootdev
return 1
}
fi
cp -p /root/.ssh/authorized_keys2 /mnt/root/.ssh || {
echo "Failed to create /root/.ssh/authorized_keys2"
umount $rootdev
return 1
}
fi
cp -p /root/.ssh/authorized_keys2 /mnt/root/.ssh || {
echo "Failed to create /root/.ssh/authorized_keys2"
umount $rootdev
return 1
}
fi
fi
changehostkeys=0
# Check the host keys.
if [ -e /etc/ssh/ssh_host_key -a -d /mnt/etc/ssh ]; then
cmp -s /etc/ssh/ssh_host_key /mnt/etc/ssh/ssh_host_key
if [ $? -ne 0 ]; then
changehostkeys=1
changehostkeys=0
# Check the host keys.
if [ -e /etc/ssh/ssh_host_key -a -d /mnt/etc/ssh ]; then
cmp -s /etc/ssh/ssh_host_key /mnt/etc/ssh/ssh_host_key
if [ $? -ne 0 ]; then
changehostkeys=1
fi
fi
fi
if [ -e /etc/ssh/ssh_host_rsa_key -a -d /mnt/etc/ssh ]; then
cmp -s /etc/ssh/ssh_host_rsa_key /mnt/etc/ssh/ssh_host_rsa_key
if [ $? -ne 0 ]; then
changehostkeys=1
if [ -e /etc/ssh/ssh_host_rsa_key -a -d /mnt/etc/ssh ]; then
cmp -s /etc/ssh/ssh_host_rsa_key /mnt/etc/ssh/ssh_host_rsa_key
if [ $? -ne 0 ]; then
changehostkeys=1
fi
fi
fi
if [ -e /etc/ssh/ssh_host_dsa_key -a -d /mnt/etc/ssh ]; then
cmp -s /etc/ssh/ssh_host_dsa_key /mnt/etc/ssh/ssh_host_dsa_key
if [ $? -ne 0 ]; then
changehostkeys=1
if [ -e /etc/ssh/ssh_host_dsa_key -a -d /mnt/etc/ssh ]; then
cmp -s /etc/ssh/ssh_host_dsa_key /mnt/etc/ssh/ssh_host_dsa_key
if [ $? -ne 0 ]; then
changehostkeys=1
fi
fi
fi
if [ $changehostkeys -eq 1 ]; then
echo " updating /etc/ssh/hostkeys"
if [ $changehostkeys -eq 1 ]; then
echo " updating /etc/ssh/hostkeys"
if [ ! -d /mnt/etc/ssh ]; then
mkdir -m 755 /mnt/etc/ssh || {
echo "Failed to mkdir /mnt/etc/ssh"
if [ ! -d /mnt/etc/ssh ]; then
mkdir -m 755 /mnt/etc/ssh || {
echo "Failed to mkdir /mnt/etc/ssh"
umount $rootdev
return 1
}
fi
cp -p /etc/ssh/ssh_host_* /mnt/etc/ssh || {
echo "Failed to create /etc/ssh/hostkeys"
umount $rootdev
return 1
}
fi
cp -p /etc/ssh/ssh_host_* /mnt/etc/ssh || {
echo "Failed to create /etc/ssh/hostkeys"
umount $rootdev
return 1
}
fi
# Check the time zone.
if [ -e /etc/localtime ]; then
cmp -s /etc/localtime /mnt/etc/localtime
if [ $? -ne 0 ]; then
echo " updating /etc/localtime"
# Check the time zone.
if [ -e /etc/localtime ]; then
cmp -s /etc/localtime /mnt/etc/localtime
if [ $? -ne 0 ]; then
echo " updating /etc/localtime"
cp -p /etc/localtime /mnt/etc/localtime || {
echo "Failed to create /etc/localtime"
umount $rootdev
return 1
}
cp -p /etc/localtime /mnt/etc/localtime || {
echo "Failed to create /etc/localtime"
umount $rootdev
return 1
}
fi
fi
fi
......
......@@ -96,7 +96,7 @@ $xminfo{"disksizes"} = "";
#
# Copy the kernel into the directory and change xminfo.
#
if (-e $xminfo{"kernel"}) {
if (! -e $xminfo{"kernel"}) {
Fatal($xminfo{"kernel"} . " does not exist");
}
my $kernel = $EXTRAFS;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment