Commit ce76dd93 authored by Russ Fish's avatar Russ Fish

Windows polishing.

parent 6f545cf0
......@@ -63,6 +63,8 @@ bin-install: dir-install
$(INSTALL) -m 755 $(SRCDIR)/WSName.exe $(BINDIR)/WSName.exe
$(INSTALL) -m 755 $(SRCDIR)/addusers.exe $(BINDIR)/addusers.exe
$(INSTALL) -m 755 $(SRCDIR)/usrtogrp.exe $(BINDIR)/usrtogrp.exe
# Setx is run under CMD early in the user login to make HOME for Emacs.
$(INSTALL) -m 755 $(SRCDIR)/setx.exe $(SYSTEM32)/setx.exe
# These are used by tmcd/findif.
$(INSTALL) -m 755 $(SYSTEM32)/getmac.exe $(BINDIR)/getmac.exe
$(INSTALL) -m 755 $(WBEM)/framedyn.dll $(BINDIR)/framedyn.dll
......
......@@ -94,6 +94,17 @@ my $DEFSHELL = "/bin/tcsh";
my $winusersfile = "$BOOTDIR/winusers";
my $usershellsfile = "$BOOTDIR/usershells";
#
# system() with error checking.
#
sub mysystem($)
{
my ($cmd) = @_;
if (system($cmd) != 0) {
warning("Failed: ($cmd), $!\n");
}
}
#
# OS dependent part of cleanup node state.
#
......@@ -111,26 +122,18 @@ sub os_account_cleanup()
print "Removing user: $name\n";
# There is always an NT account.
my $cmd = "$NET user $name /delete > /dev/null";
if (system($cmd) != 0) {
warning("Failed: ($cmd), $!\n");
}
mysystem("$NET user $name /delete > /dev/null");
# There will only be an NT homedir if the user has logged in sometime.
$cmd = "$RM -rf C:/Documents and Settings/$name";
if (system($cmd) != 0) {
warning("Failed: ($cmd), $!\n");
}
mysystem("$CHOWN -Rf root C:/'Documents and Settings'/$name");
mysystem("$RM -rf C:/'Documents and Settings'/$name");
# It sometimes also makes user.PCnnn, user.PCnnn.000, etc.
mysystem("$CHOWN -Rf root C:/'Documents and Settings'/$name.*");
mysystem("$RM -rf C:/'Documents and Settings'/$name.*");
# Unmount the homedir so we can get to the mount point.
$cmd = "$UMOUNT /users/$name";
if (system($cmd) != 0) {
warning("Failed: ($cmd), $!\n");
}
$cmd = "$RMDIR /users/$name";
if (system($cmd) != 0) {
warning("Failed: ($cmd), $!\n");
}
mysystem("$UMOUNT /users/$name");
mysystem("$RMDIR /users/$name");
}
closedir(DIRHANDLE);
......@@ -145,19 +148,13 @@ sub os_account_cleanup()
next;
}
$cmd = "$CHOWN -R root /sshkeys/$name";
if (system($cmd) != 0) {
warning("Failed ($cmd): $!");
}
$cmd = "$RM -rf /sshkeys/$name";
if (system($cmd) != 0) {
warning("Failed ($cmd): $!");
}
mysystem("$CHOWN -Rf root /sshkeys/$name");
mysystem("$RM -rf /sshkeys/$name");
}
closedir(DIRHANDLE);
}
# Clean out the /proj directories.
# Clean out the /proj subdirectories.
if (opendir(DIRHANDLE, "/proj")) {
while ($name = readdir(DIRHANDLE)) {
if ($name =~ m/^\.+/) {
......@@ -166,22 +163,13 @@ sub os_account_cleanup()
print "Removing project: $name\n";
# Unmount the project dir so we can get to the mount point.
$cmd = "$UMOUNT /proj/$name";
if (system($cmd) != 0) {
warning("Failed ($cmd): $!");
}
$cmd = "$RMDIR /proj/$name";
if (system($cmd) != 0) {
warning("Failed ($cmd): $!");
}
mysystem("$UMOUNT /proj/$name");
mysystem("$RMDIR /proj/$name");
}
}
# Just unmount /share.
$cmd = "$UMOUNT /share";
if (system($cmd) != 0) {
warning("Failed ($cmd): $!");
}
# Just unmount /share, everybody gets one.
mysystem("$UMOUNT /share");
}
#
......@@ -589,8 +577,7 @@ sub os_samba_mount($$$)
my ($local, $host, $verbose) = @_;
# Unmount each one first, ignore errors.
$cmd = "$UMOUNT $local";
system($cmd);
system("$UMOUNT $local");
# Make the CygWin mount from the Samba path to the local mount point directory.
my $sambapath = $local;
......
......@@ -15,8 +15,9 @@ my @DBFILES = ();
my @VARDIRS = ("logs", "db", "jails", "boot", "lock", "lib/dhcp");
my $LOGDIR = "/var/log";
my $RUNDIR = "/var/run";
my $SOURCES = "~root/flux/testbed";
my $HISTORY = "~root/.bash_history";
my $SOURCES = "/home/root/flux/testbed";
my $OBJS = "/home/root/flux/obj-real";
my $HISTORY = "/home/root/.bash_history";
my $MAILFILE = "/var/spool/mail/root";
my $NTPDRIFT = "/etc/ntp/drift";
......@@ -112,7 +113,7 @@ if (-f $NTPDRIFT) {
close(DRIFT);
}
print "Clearing out testbed sources ...\n";
print "Clearing out testbed sources $SOURCES...\n";
system("rm -rf $SOURCES");
print "Clearing out $RUNDIR ...\n";
......
......@@ -40,7 +40,7 @@ export USER
# 4) / (root)
### Try to get a connection to the Samba host.
/usr/local/etc/emulab/rc/rc.cygwinxp-user
##/usr/local/etc/emulab/rc/rc.cygwinxp-user
### Use a local dir under sshd if the mount failed.
if [ ! -d "$HOME" ]; then
......
......@@ -6,6 +6,9 @@
#
# rc.cygwinxp - CygWin-specific startup. Run by rc.bootsetup on CygWin.
PATH=/usr/local/etc/emulab:/bin:$SYSTEMROOT/system32:$PATH
export PATH
# Enable logging.
logfile=/var/log/EmulabStartup.log
chmod -f g+w $logfile
......@@ -19,16 +22,43 @@ chmod g+w $iscygwin
chmod -f g-w /etc/emulab
# Make sure the computer name is right, reboots to change it if necessary.
nodeid=`$tmcc nodeid`
nodeid=`tmcc nodeid`
hostname=`/bin/hostname`
datehost="`date`: Host name '$hostname'"
if [ $nodeid == $hostname ]; then
echo "$datehost matches nodeid '$nodeid'." >> $logfile
msg="$datehost matches nodeid '$nodeid'."
echo "$msg" >> $logfile
echo "$msg"
else
echo "$datehost differs from nodeid '$nodeid'." >> $logfile
msg="$datehost differs from nodeid '$nodeid'." >> $logfile
echo "$msg" >> $logfile
echo "$msg"
# Change hostname and computername, rename My Computer, reboot on success.
/usr/local/etc/emulab/WSName /N:$nodeid /REBOOT /MCN
# Should never get here! Try /sbin/reboot.
datehost="`date`: Host name '$hostname'"
newhost=`/bin/hostname`
msg="$datehost didn't reboot changing to '$newhost'! Trying reboot."
echo "$msg" >> $logfile
echo "$msg"
/sbin/reboot
# Should never get here either!!! Try /bin/shutdown.
datehost="`date`: Host name '$hostname'"
newhost=`/bin/hostname`
msg="$datehost didn't /sbin/reboot changing to '$newhost'! Trying shutdown."
echo "$msg" >> $logfile
echo "$msg"
/bin/shutdown -r -f now
# Give up.
datehost="`date`: Host name '$hostname'"
newhost=`/bin/hostname`
msg="$datehost failed to reboot changing to '$newhost'."
echo "$msg" >> $logfile
echo "$msg"
fi
# Sometimes the network stack gets out of sync: 'ipconfig /all' reports different
......
......@@ -11,7 +11,7 @@
#
# We also arrange for this to be run by login shells under ssh.
PATH=/usr/local/etc/emulab:/bin:$PATH
PATH=/usr/local/etc/emulab:/bin:$SYSTEMROOT/system32:$PATH
export PATH
# Samba server.
......
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