Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
68190010
Commit
68190010
authored
Jan 04, 2011
by
Mike Hibler
Browse files
Further hackary (actually less hacky) to get working in GEOM world.
parent
9140cebc
Changes
1
Hide whitespace changes
Inline
Side-by-side
tmcd/freebsd/mkextrafs.pl
View file @
68190010
#!/usr/bin/perl -w
#!/usr/bin/perl -w
#
#
# EMULAB-COPYRIGHT
# EMULAB-COPYRIGHT
# Copyright (c) 2000-201
0
University of Utah and the Flux Group.
# Copyright (c) 2000-201
1
University of Utah and the Flux Group.
# All rights reserved.
# All rights reserved.
#
#
use
English
;
use
English
;
...
@@ -67,13 +67,12 @@ $ENV{'PATH'} = "/tmp:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:".
...
@@ -67,13 +67,12 @@ $ENV{'PATH'} = "/tmp:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:".
delete
@ENV
{'
IFS
',
'
CDPATH
',
'
ENV
',
'
BASH_ENV
'};
delete
@ENV
{'
IFS
',
'
CDPATH
',
'
ENV
',
'
BASH_ENV
'};
#
#
# Determine if we
need the magic to enable writing the active disk
.
# Determine if we
should use the "geom" tools to make everything happen
.
# Empirically, this seems to only be needed for FreeBSD 8 and above.
# Empirically, this seems to only be needed for FreeBSD 8 and above.
#
#
my
$needsysctl
=
0
;
my
$usegeom
=
0
;
my
$didsysctl
=
0
;
if
(`
uname -r
`
=~
/^(\d+)\./
&&
$
1
>
7
)
{
if
(`
uname -r
`
=~
/^(\d+)\./
&&
$
1
>
7
)
{
$
needsysctl
=
$
1
;
$
usegeom
=
$
1
;
}
}
#
#
...
@@ -244,9 +243,12 @@ if (!$forceit) {
...
@@ -244,9 +243,12 @@ if (!$forceit) {
#
#
# Dark magic to allow us to modify the open boot disk
# Dark magic to allow us to modify the open boot disk
#
#
if
(
$needsysctl
)
{
if
(
$usegeom
&&
$slice
!=
0
)
{
mysystem
("
sysctl kern.geom.debugflags=16
");
if
(
$stype
!=
0
)
{
$didsysctl
=
1
;
mysystem
("
gpart delete -i
$slice
$disk
");
}
mysystem
("
gpart add -i
$slice
-t freebsd
$disk
");
$stype
=
165
;
}
}
#
#
...
@@ -269,20 +271,11 @@ elsif ($stype != 165) {
...
@@ -269,20 +271,11 @@ elsif ($stype != 165) {
# If not recreating the filesystems, just try to mount it
# If not recreating the filesystems, just try to mount it
#
#
elsif
(
$noinit
)
{
elsif
(
$noinit
)
{
if
(
$didsysctl
)
{
system
("
sysctl kern.geom.debugflags=0
");
$didsysctl
=
0
;
}
mysystem
("
mount
$fsdevice
$mountpoint
");
mysystem
("
mount
$fsdevice
$mountpoint
");
mysystem
("
echo
\"
$fsdevice
$mountpoint
ufs rw 0 2
\"
>> /etc/fstab
");
mysystem
("
echo
\"
$fsdevice
$mountpoint
ufs rw 0 2
\"
>> /etc/fstab
");
exit
(
0
);
exit
(
0
);
}
}
if
(
$didsysctl
)
{
system
("
sysctl kern.geom.debugflags=0
");
$didsysctl
=
0
;
}
#
#
# Now create the disklabel
# Now create the disklabel
#
#
...
@@ -380,8 +373,6 @@ sub mysystem($)
...
@@ -380,8 +373,6 @@ sub mysystem($)
print
"
'
$command
'
\n
";
print
"
'
$command
'
\n
";
my
$rv
=
system
(
$command
);
my
$rv
=
system
(
$command
);
if
(
$rv
)
{
if
(
$rv
)
{
system
("
sysctl kern.geom.debugflags=0
")
if
(
$didsysctl
);
die
("
*** $0:
\n
"
.
die
("
*** $0:
\n
"
.
"
Failed (
$rv
): '
$command
'
\n
");
"
Failed (
$rv
): '
$command
'
\n
");
}
}
...
...
Write
Preview
Supports
Markdown
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