Commit e7a497f8 authored by Russ Fish's avatar Russ Fish

First installment of cygwinxp support.

parent 3f1d56ac
......@@ -1542,6 +1542,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tmcd/linux9/GNUmakefile tmcd/linux9/supfile \
tmcd/freebsd5/GNUmakefile tmcd/freebsd5/supfile \
tmcd/openbsd/GNUmakefile tmcd/ron/GNUmakefile tmcd/plab/GNUmakefile \
tmcd/cygwinxp/GNUmakefile \
utils/GNUmakefile utils/vlandiff utils/vlansync utils/delay_config \
utils/sshtb utils/create_image utils/node_admin utils/webcreateimage \
utils/firstuser utils/export_tables utils/eventping \
......
......@@ -29,6 +29,7 @@ CFLAGS += -DETCDIR='"$(INSTALL_ETCDIR)"'
SSLFLAGS = -DWITHSSL
TMLIBS += -lssl -lcrypto
SSLOBJ = ssl.o
ifeq ($(SYSTEM),Linux)
RHLVERSION := $(shell cat /etc/redhat-release | sed -e 's/Red Hat Linux release \([0-9]\).*/Linux\1/')
NEEDKERB := $(shell nm /usr/lib/libssl.a | grep -q krb; echo $$?)
......@@ -43,6 +44,7 @@ else
MDSUBDIR = linux
endif
endif
ifeq ($(SYSTEM),FreeBSD)
FBSDVERSION := $(shell uname -v | sed -e 's/FreeBSD \([0-9]\).*/FreeBSD\1/')
ifeq ($(FBSDVERSION),FreeBSD5)
......@@ -52,6 +54,11 @@ MDSUBDIR = freebsd
endif
endif
ifeq ($(SYSTEM),CYGWIN_NT-5.1)
# Cygwin on Windows XP (a.k.a. NT 5.1) - resembles the Linux case.
MDSUBDIR = cygwinxp
endif
ifeq ($(EVENTSYS),1)
TMCDCFLAGS = `elvin-config --cflags vin4c` \
-I$(TESTBED_SRCDIR)/event/lib -DEVENTSYS
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
#
# XXX ONLY RUN THIS INSTALL ON A CYGWIN / WINDOWS XP NODE!
# Similar to linux9, cygwinxp is an overlay on linux, which is an overlay on common.
#
# Trivial. These things just need to be installed into the right place
# on a testbed node before cutting an image.
#
#
SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ../..
SUBDIR = tmcd/cygwinxp
include $(OBJDIR)/Makeconf
SCRIPTS =
#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
#
all: $(SCRIPTS)
include $(TESTBED_SRCDIR)/GNUmakerules
DESTDIR =
SYSETCDIR = $(DESTDIR)/etc
ETCDIR = $(DESTDIR)$(CLIENT_ETCDIR)
BINDIR = $(DESTDIR)$(CLIENT_BINDIR)
VARDIR = $(DESTDIR)$(CLIENT_VARDIR)
RCDIR = $(SYSETCDIR)/rc.d
INSTALL = /usr/bin/install -c
COMMON = $(SRCDIR)/../common
install client-install: baselinux-install common-install etc-install \
sup-install script-install bin-install
@echo "Remember to install the PEM files if necessary"
simple-install: common-install script-install bin-install
dir-install:
baselinux-install: dir-install
(cd ../linux; $(MAKE) client-install)
rm -f $(BINDIR)/rc/rc.healthd
rm -f $(BINDIR)/rc/rc.slothd
common-install: dir-install
(cd ../common; $(MAKE) local-install)
sup-install: dir-install
bin-install: dir-install
etc-install: dir-install sysetc-remove sysetc-install
sysetc-install: dir-install ###ifcfgs
sysetc-remove:
script-install: dir-install $(SCRIPTS)
$(INSTALL) -m 755 $(SRCDIR)/rc.cygwinxp-user $(BINDIR)/rc/rc.cygwinxp-user
$(INSTALL) -m 755 $(SRCDIR)/rc.cygwinxp $(BINDIR)/rc/rc.cygwinxp
$(INSTALL) -m 755 $(SRCDIR)/liblocsetup.pm $(BINDIR)/liblocsetup.pm
$(INSTALL) -m 755 $(SRCDIR)/emount $(BINDIR)/emount
$(INSTALL) -m 755 $(SRCDIR)/eumount $(BINDIR)/eumount
sfs-install:
# create ifcfg-eth? files
ifcfgs: $(SRCDIR)/mkifcfgs $(SRCDIR)/ifcfg.template
$(SRCDIR)/mkifcfgs $(SRCDIR)/ifcfg.template
#!/usr/bin/perl -w
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
use Getopt::Std;
#
# Emulab NFS mount command, called by rc.mounts .
#
# Args are the remote and local mount points, for example:
# eumount fs.emulab.net:/q/proj/testbed /proj/testbed
# With no args, reports the current mounts with "net use".
#
# Since this is Windows, mounts go through drive letters, like this:
# S: \\fs.emulab.net\share # Share
# P: \\fs.emulab.net\q\proj\testbed # Project
# Q: \\fs.emulab.net\groups\testbed\TG1 # Group
# H: \\fs.emulab.net\users\fish # Creator
# I: \\fs.emulab.net\users\mike # Swapper
#
# Creator/swapper information comes from tmcc via TMCREATOR()/TMSWAPPER() files.
# Any other user mounts require specifying the drive letter with the -d option.
#
# The Services For Unix (SFU 3.5) NFS client commands are used underneath,
# and CygWin symlinks are made to point to the /cygdrive/driveletter mount,
# completing the Unix-like illusion.
sub usage()
{
print "Usage: emount [-v] [-d driveletter:] remotehost:path localpath\n";
print " or: emount\n";
exit(1);
}
my $optlist = "vd:";
my $verbose = 0;
my $driveletter = "";
my $remote = "";
my $local = "";
# Drag in path stuff so we can find emulab stuff.
BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
#
# Turn off line buffering on output
#
$| = 1;
#
# Load the OS independent support library. It will load the OS dependent
# library and initialize itself.
#
use libsetup;
use liblocsetup;
#
# Parse command arguments. Once we return from getopts, all that should be
# left are the positional arguments.
#
%options = ();
if (! getopts($optlist, \%options)) {
usage();
}
if (defined($options{"v"})) {
$verbose = 1;
}
if (defined($options{"d"})) {
$driveletter = $options{"d"};
}
if (@ARGV == 0 ) {
system("$NET use");
exit(0);
}
elsif (@ARGV == 2) {
$remote = $ARGV[0];
$local = $ARGV[1];
}
else {
usage();
}
my $cmd;
# Infer the drive letter from what's being mounted.
my($project, $group, $user);
$driveletter = "S:"
if (!$driveletter && $remote =~ m|:/share$|);
$driveletter = "P:"
if (!$driveletter && (($project) = ($remote =~ m|:/q/proj/([-[:alnum:]]+)$|)) );
$driveletter = "Q:"
if (!$driveletter && (($project, $group) =
($remote =~ m|:/q/proj/([-[:alnum:]]+)/([-[:alnum:]]+)$|)) );
if (!$driveletter && (($user) = ($remote =~ m|:/users/([-[:alnum:]]+)|))) {
my $tmcreator = TMCREATOR();
my $tmswapper = TMSWAPPER();
my $creator = `cat $tmcreator`;
my $swapper = `cat $tmswapper`;
$creator =~ s/\n//;
$swapper =~ s/\n//;
##print "user '$user', creator '$creator', swapper '$swapper'\n";
$driveletter = "H:"
if ($user eq $creator);
$driveletter = "I:"
if (!$driveletter && $user eq $swapper);
}
print "Using drive letter $driveletter\n"
if ($verbose && $driveletter);
if (!$driveletter) {
print STDERR "emount: Must specify a drive letter.\n";
exit(1);
}
# Make sure that mount persistence is off.
os_noisycmd("$NET use /persistent:no", 0);
# Mount onto a drive letter using the Services For Unix NFS client.
print "Mounting remote directory '$remote' on drive letter '$driveletter'.\n"
if ($verbose);
$cmd = "$SFCMOUNT $remote $driveletter";
if (os_noisycmd($cmd, $verbose) != 0) {
print STDERR "emount: Failed SFU mount, $cmd.\n";
exit(1);
}
# Make the CygWin symlink from the local path to the driveletter automount point.
my $localdir = $local;
$localdir =~ s|(.*)/.*|$1|;
my $cygdrive = "/cygdrive/" . lc(substr($driveletter, 0, 1));
if (length($localdir) && ! -e $localdir) {
print "Making CygWin '$localdir' directory to contain symlinks.\n"
if ($verbose);
if (! os_mkdir($localdir, "0777")) { # Writable so anybody can make symlinks.
print STDERR "emount: Failed CygWin mkdir, $cmd.\n";
exit(1);
}
}
if (-e $local) {
print "Removing previous CygWin symlink '$local'.\n"
if ($verbose);
$cmd = "$CHOWN `id -un` $local";
if (system($cmd) != 0) {
print STDERR "emount: Failed to take ownership of symlink, $cmd.\n";
}
$cmd = "$RM -f $local";
if (system($cmd) != 0) {
print STDERR "emount: Failed to remove previous CygWin symlink, $cmd.\n";
exit(1);
}
}
print "Making CygWin symlink '$local' to '$cygdrive'.\n"
if ($verbose);
$cmd = "$LN -f -s $cygdrive $local";
if (system($cmd) != 0) {
print STDERR "emount: Failed CygWin symlink, $cmd.\n";
exit(1);
}
exit(0);
#!/usr/bin/perl -w
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
use Getopt::Std;
#
# Emulab NFS unmount command, called by rc.mounts . See emount for more info.
#
# Arg is the local mount points, for example:
# eumount /proj/testbed
#
# The Services For Unix (SFU 3.5) NFS client commands are used underneath, and the
# CygWin symlink pointing to the /cygdrive/driveletter mount are cleaned up.
sub usage()
{
print "Usage: eumount [-v] localpath\n";
exit(1);
}
my $optlist = "v";
my $verbose = 0;
my $local = "";
# Drag in path stuff so we can find emulab stuff.
BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
#
# Turn off line buffering on output
#
$| = 1;
#
# Load the OS independent support library. It will load the OS dependent
# library and initialize itself.
#
use libsetup;
use liblocsetup;
#
# Parse command arguments. Once we return from getopts, all that should be
# left are the positional arguments.
#
%options = ();
if (! getopts($optlist, \%options)) {
usage();
}
if (defined($options{"v"})) {
$verbose = 1;
}
if (@ARGV == 1) {
$local = $ARGV[0];
}
else {
usage();
}
my(%curmounts, $cmd);
if (os_getnfsmountpoints(\%curmounts) < 0) {
fatal("Could not get current NFS mounts!");
}
if (!defined($curmounts{$local})) {
print STDERR "eumount: $local is not mounted.\n";
exit(1);
}
else {
my $rpath = $curmounts{$local}[0];
my $driveletter = $curmounts{$local}[1];
# Unmount from a drive letter using the Services For Unix NFS client.
print "Unmounting remote '$rpath' from drive letter '$driveletter'.\n"
if ($verbose);
$cmd = "$SFCUMOUNT $driveletter";
if (os_noisycmd($cmd, $verbose) != 0) {
print STDERR "eumount: Failed SFU umount, $cmd.\n";
exit(1);
}
# Kill the CygWin symlink from the local path to the driveletter automount point.
print "Removing CygWin symlink '$local'.\n"
if ($verbose);
$cmd = "$RM $local";
if (system($cmd) != 0) {
print STDERR "emount: Failed to remove CygWin symlink, $cmd.\n";
exit(1);
}
}
exit(0);
This diff is collapsed.
# Some resources...
# Customizing Your Shell: http://www.dsl.org/cookbook/cookbook_5.html#SEC69
# Consistent BackSpace and Delete Configuration:
# http://www.ibb.net/~anne/keyboard.html
# Setup some default paths. Note that this order will allow user installed
# software to override 'system' software
# If you wish to change the path on a user by user basis, it is recommended you
# edit ~/.bashrc
# If you wish to change the path for all users, it is recommended you edit
# /etc/bash.bashrc
export PATH="/usr/local/bin:/usr/bin:/bin:$PATH"
# Set the user id
export USER="`id -un`"
# Here is how HOME is set, in order of priority, when starting from Windows
# 1) From existing HOME in the Windows environment, translated to a Posix path
# 2) from /etc/passwd, if there is an entry with a non empty directory field
# 3) from HOMEDRIVE/HOMEPATH
# 4) / (root)
# Use a local dir under sshd for now.
if [ ! -d "$HOME" ]; then
HOME=/home/$USER
fi
# If the home directory doesn't exist, create it.
if [ ]; then
mkdir -p "$HOME"
# copy skeleton files
cd /etc/skel
for f in `/bin/find . -type f`; do
fDest=`echo $f | sed -e 's/^\.//g'`
if [ ! -e "$HOME$fDest" -a ! -L "$HOME$fDest" ]; then
cp "$f" "$HOME/$fDest"
fi
done
fi
# run all of the profile.d scripts
for i in /etc/profile.d/*.sh ; do
if [ -f $i ]; then
. $i
fi
done
# default to unix make mode
export MAKE_MODE=unix
# it is recommended that cvs uses ssh for it's remote shell environment
export CVS_RSH=/bin/ssh
# Patches to Cygwin always appreciated ;)
# export CVSROOT=:pserver:anoncvs@sources.redhat.com:/cvs/src
# Set a HOSTNAME variable
export HOSTNAME=`hostname`
# set a default prompt of: user@host current_directory
export PS1='\[\033]0;\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ '
# uncomment to use the terminal colours set in DIR_COLOR
# eval `dircolors -b /etc/DIR_COLOR`
# default to removing the write permission for group and other
# (files normally created with mode 777 become 755; files created with
# mode 666 become 644)
umask 022
# make sure we start in home
cd "$HOME"
#!/bin/bash
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004 University of Utah and the Flux Group.
# All rights reserved.
#
# CygWin startup.
# Make sure the node name is right.
nodeid=`/usr/local/etc/emulab/tmcc.bin nodeid`
hostname=`/bin/hostname`
if [ $nodeid == $hostname ]; then
echo "Host name '$hostname' matches nodeid '$nodeid'." > /tmp/wsname
else
echo "Host name '$hostname' and nodeid '$nodeid' differ." > /tmp/wsname
# Change hostname and computername, rename My Computer, reboot on success.
/usr/local/etc/emulab/WSName /N:$nodeid /REBOOT /MCN
fi
#!/bin/bash
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004 University of Utah and the Flux Group.
# All rights reserved.
#
# CygWin user setup for each login.
PATH=/usr/local/etc/emulab:$PATH
set -x
# Mounts are local to the Win32 login session context.
if [ -e /cygdrive/s ]; then /cygdrive/c/SFU/common/umount S: > /dev/null; fi
emount fs.emulab.net:/share /share
if [ -e /cygdrive/p ]; then /cygdrive/c/SFU/common/umount P: > /dev/null ; fi
proj=`tmcc.bin status | sed 's|ALLOCATED=\([^/]*\)/.*|\1|'`
emount fs.emulab.net:/q/proj/$proj /proj/$proj
if [ -e /cygdrive/h ]; then /cygdrive/c/SFU/common/umount H: > /dev/null ; fi
creator=`tmcc.bin creator | sed 's|.*CREATOR=\([^ ]*\).*|\1|'`
emount fs.emulab.net:/users/$creator /users/$creator
if [ -e /cygdrive/i ]; then /cygdrive/c/SFU/common/umount I: > /dev/null ; fi
swapper=`tmcc.bin creator | sed 's|.*SWAPPER=\([^ ]*\).*|\1|'`
if [ $swapper != $creator ]; then
emount fs.emulab.net:/users/$swapper /users/$swapper
fi
# Make sure the user's homedir is mounted if neither creator nor swapper.
if [ -e /cygdrive/j ]; then /cygdrive/c/SFU/common/umount J: > /dev/null ; fi
user=`id -un`
if [[ $user != $creator && $user != $swapper && $user != root ]]; then
emount -d J: fs.emulab.net:/users/$user /users/$user
fi
set +x
echo "Hit <Enter> to dismiss."
sed 1q
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