Commit 121dee90 authored by Mike Hibler's avatar Mike Hibler
Browse files

Automate one last thing I used to do manually when creating new images:

get rid of all directories in /users and /proj.
parent fcda945c
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -69,6 +69,27 @@ foreach my $dbfile (@DBFILES) {
}
}
#
# Attempt to unmount all NFS filesystem if not already unmounted.
# This allows us to clean up /users and /proj. We only do the cleanup if
# if unmount succeeds and even then, we do it in a safe way.
#
if (-e "/share/freebsd") {
print "Unmounting NFS filesystems ...\n";
# XXX "unmount -t nfs" does not seem to work
if (!system("umount -h fs")) {
#
# Note that this command will not remove anything if the NFS unmounts
# failed (and we didn't catch it) because the directories in question
# will not be empty.
#
system("rmdir /users/* /proj/* /groups/* /scratch/*");
} else {
print "Could not determine if NFS filesystems are unmounted, ".
"NOT cleaning up /proj and /users\n";
}
}
#
# Generate a dumpdates file. Use fstab to find out what filesystems
# need entries, and then put in entries for each filesystem using
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -69,6 +69,26 @@ foreach my $dbfile (@DBFILES) {
}
}
#
# Attempt to unmount all NFS filesystem if not already unmounted.
# This allows us to clean up /users and /proj. We only do the cleanup if
# if unmount succeeds and even then, we do it in a safe way.
#
if (-e "/share/freebsd") {
print "Unmounting NFS filesystems ...\n";
if (!system("umount -t nfs")) {
#
# Note that this command will not remove anything if the NFS unmounts
# failed (and we didn't catch it) because the directories in question
# will not be empty.
#
system("rmdir /users/* /proj/* /groups/* /scratch/*");
} else {
print "Could not determine if NFS filesystems are unmounted, ".
"NOT cleaning up /proj and /users\n";
}
}
#
# Run anacron to bring everything up to date. It never runs again.
#
......
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