Commit 8d4a784e authored by Mike Hibler's avatar Mike Hibler

Standardize the message put out when adding a swap device to /etc/fstab.

Hopefully, will make it easier for the numerous scripts that want to
mess with the swap device in /etc/fstab.
parent a7d7baeb
...@@ -162,9 +162,11 @@ if (!$noumount) { ...@@ -162,9 +162,11 @@ if (!$noumount) {
} }
# #
# Remove any auto generated fstab swap line # Remove any auto generated fstab swap line.
# XXX assumes there is only one!
# #
print "Removing auto-generated /etc/fstab swap line ...\n"; print "Removing auto-generated /etc/fstab swap line ...\n";
system("sed -i -e '/^# the following swap devices added by /,+1d' $FSTAB");
system("sed -i -e '/^# the following added by .*rc.freebsd/,+1d' $FSTAB"); system("sed -i -e '/^# the following added by .*rc.freebsd/,+1d' $FSTAB");
# #
......
#!/usr/bin/perl -w #!/usr/bin/perl -w
# #
# Copyright (c) 2007-2012 University of Utah and the Flux Group. # Copyright (c) 2007-2016 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -161,7 +161,7 @@ sub addswap($$) ...@@ -161,7 +161,7 @@ sub addswap($$)
print STDERR "*** WARNING: could not add /dev/$dev to $FSTAB, ". print STDERR "*** WARNING: could not add /dev/$dev to $FSTAB, ".
"swap enabled this boot only\n"; "swap enabled this boot only\n";
} }
print FD "# the following added by $script\n"; print FD "# the following swap devices added by $script\n";
print FD "/dev/$dev\t\tnone\tswap\tsw\t0\t0\n"; print FD "/dev/$dev\t\tnone\tswap\tsw\t0\t0\n";
close(FD); close(FD);
print "Swap enabled\n"; print "Swap enabled\n";
......
#!/usr/bin/perl -w #!/usr/bin/perl -w
# #
# Copyright (c) 2007-2012 University of Utah and the Flux Group. # Copyright (c) 2007-2016 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -161,7 +161,7 @@ sub addswap($$) ...@@ -161,7 +161,7 @@ sub addswap($$)
print STDERR "*** WARNING: could not add /dev/$dev to $FSTAB, ". print STDERR "*** WARNING: could not add /dev/$dev to $FSTAB, ".
"swap enabled this boot only\n"; "swap enabled this boot only\n";
} }
print FD "# the following added by $script\n"; print FD "# the following swap devices added by $script\n";
print FD "/dev/$dev\t\tnone\tswap\tsw\t0\t0\n"; print FD "/dev/$dev\t\tnone\tswap\tsw\t0\t0\n";
close(FD); close(FD);
print "Swap enabled\n"; print "Swap enabled\n";
......
#!/usr/bin/perl -w #!/usr/bin/perl -w
# #
# Copyright (c) 2007-2012 University of Utah and the Flux Group. # Copyright (c) 2007-2016 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -161,7 +161,7 @@ sub addswap($$) ...@@ -161,7 +161,7 @@ sub addswap($$)
print STDERR "*** WARNING: could not add /dev/$dev to $FSTAB, ". print STDERR "*** WARNING: could not add /dev/$dev to $FSTAB, ".
"swap enabled this boot only\n"; "swap enabled this boot only\n";
} }
print FD "# the following added by $script\n"; print FD "# the following swap devices added by $script\n";
print FD "/dev/$dev\t\tnone\tswap\tsw\t0\t0\n"; print FD "/dev/$dev\t\tnone\tswap\tsw\t0\t0\n";
close(FD); close(FD);
print "Swap enabled\n"; print "Swap enabled\n";
......
...@@ -267,6 +267,7 @@ sub fix_swap_partitions ...@@ -267,6 +267,7 @@ sub fix_swap_partitions
} }
@buffer = grep {!/^[^#].*\bswap\b.*$/} <FSTAB>; @buffer = grep {!/^[^#].*\bswap\b.*$/} <FSTAB>;
push @buffer, "# the following swap devices added by linux_slicefix\n";
for (@swapdevs) { for (@swapdevs) {
push @buffer, "$_\tnone\tswap\tsw\t0 0\n"; push @buffer, "$_\tnone\tswap\tsw\t0 0\n";
} }
......
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