Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
0aba0db3
Commit
0aba0db3
authored
Mar 08, 2012
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Look for a /.localized in the root of the MFS to determine if the MFS
is indeed localized.
parent
f6a3c910
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
137 additions
and
122 deletions
+137
-122
clientside/tmcc/freebsd/slicefix
clientside/tmcc/freebsd/slicefix
+137
-122
No files found.
clientside/tmcc/freebsd/slicefix
View file @
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
fi
xit
=
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
fi
xit
=
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment