From 271a989a7d4a38153d2da4411d304015b9054968 Mon Sep 17 00:00:00 2001 From: "Leigh B. Stoller" Date: Tue, 21 Feb 2006 17:18:39 +0000 Subject: [PATCH] Changes for building the meta ports on FreeBSD 5.4, with a port tree tagged from the 6.0 release. Also lots of changes to the install scripts to handle inatlling boss/ops/fs on 5.4. All changes are conditionalized so that things will continue to work on 4.10, but hopefully we will move away from that before the year is out. --- install/boss-install.in | 142 +++++++++++++++------ install/fs-install.in | 18 ++- install/ops-install.in | 191 +++++++++++++++++++++++++--- install/ports/emulab-boss/Makefile | 44 ++++--- install/ports/emulab-fs/Makefile | 19 ++- install/ports/emulab-ops/Makefile | 45 ++++++- install/ports/emulab-php4/Makefile | 41 ++++++ install/ports/emulab-php4/pkg-descr | 2 + install/ports/emulab-php4/pkg-plist | 1 + install/ports/ports-install | 2 +- 10 files changed, 413 insertions(+), 92 deletions(-) create mode 100644 install/ports/emulab-php4/Makefile create mode 100644 install/ports/emulab-php4/pkg-descr create mode 100644 install/ports/emulab-php4/pkg-plist diff --git a/install/boss-install.in b/install/boss-install.in index 538c542b6..a536104a3 100644 --- a/install/boss-install.in +++ b/install/boss-install.in @@ -58,13 +58,14 @@ my $CP = "/bin/cp"; my $ENV = "/usr/bin/env"; my $MOUNT = "/sbin/mount"; my $SUDO = "/usr/local/bin/sudo"; - my $SUIDPERL = "/usr/bin/suidperl"; my $MYSQL = "/usr/local/bin/mysql"; my $MYSQLADMIN = "/usr/local/bin/mysqladmin"; my $MYSQLSHOW = "/usr/local/bin/mysqlshow"; my $MYSQLDUMP = "/usr/local/bin/mysqldump"; +my $MYSQLINSTALL = "/usr/local/bin/mysql_install_db"; +my $MYSQLDBDIR = "/var/db/mysql"; my $GMAKE = "/usr/local/bin/gmake"; my $RNDC_CONFGEN = "/usr/local/sbin/rndc-confgen"; @@ -84,15 +85,14 @@ my $ROOT_PRIVKEY = "/root/.ssh/identity"; my $ROOT_PUBKEY = "$ROOT_PRIVKEY.pub"; my $ROOT_AUTHKEY = "/root/.ssh/authorized_keys"; +my $APACHE_ETCDIR = "/usr/local/etc/apache"; my $SUDOERS = "/usr/local/etc/sudoers"; -my $HTTPD_CONF = "/usr/local/etc/apache/httpd.conf"; +my $HTTPD_CONF = "$APACHE_ETCDIR/httpd.conf"; my $PHP_INI = "/usr/local/etc/php.ini"; my $DHCPD_CONF = "/usr/local/etc/dhcpd.conf"; my $DHCPD_TEMPLATE = "/usr/local/etc/dhcpd.conf.template"; my $DHCPD_LEASES = "/var/db/dhcpd.leases"; my $DHCPD_MAKECONF = "$PREFIX/sbin/dhcpd_makeconf"; -my $APACHE_CERTFILE = "/usr/local/etc/apache/ssl.crt/www.${OURDOMAIN}.crt"; -my $APACHE_KEYFILE = "/usr/local/etc/apache/ssl.key/www.${OURDOMAIN}.key"; my $BATCHEXP = "$PREFIX/bin/batchexp"; my $WAP = "$PREFIX/sbin/withadminprivs"; my $NAMED_SETUP = "$PREFIX/sbin/named_setup"; @@ -116,8 +116,16 @@ my $EMULAB_PEM = "emulab.pem"; my $CLIENT_PEM = "client.pem"; my $CTRLNODE_PEM = "ctrlnode.pem"; my $ETC_EMULAB_DIR = "/etc/emulab"; -my $APACHE_CERTPEM = "apache_cert.pem"; -my $APACHE_KEYPEM = "apache_key.pem"; + +# Apache certs on both boss and ops +my $APACHE_CERTPEM = "apache_cert.pem"; +my $APACHE_KEYPEM = "apache_key.pem"; +my $APACHE_CERTFILE = "$APACHE_ETCDIR/ssl.crt/www.${OURDOMAIN}.crt"; +my $APACHE_KEYFILE = "$APACHE_ETCDIR/ssl.key/www.${OURDOMAIN}.key"; +my $APACHE_CERTPEM_OPS = "apache-ops_cert.pem"; +my $APACHE_KEYPEM_OPS = "apache-ops_key.pem"; +my $APACHE_CERTFILE_OPS = "$APACHE_ETCDIR/ssl.crt/${USERNODE}.crt"; +my $APACHE_KEYFILE_OPS = "$APACHE_ETCDIR/ssl.key/${USERNODE}.key"; # # Some directories we care about @@ -184,11 +192,21 @@ if ($USERNODE eq $FSNODE) { push(@OPS_NAMES, "fs"); } +# Version of FreeBSD. +my $FBSD_VERSION = 4; +if (`uname -r` =~ /^(\d)/) { + $FBSD_VERSION = $1; +} +else { + die("Could not determine what version of FreeBSD you are running!\n"); +} + # -# The meta-port (name and version) that drags in all the dependancies for -# a boss node +# The meta-ports (name and version) that drag in all the dependancies for +# a boss node. These are OS dependent as we upgrade. # -my $BOSS_PORT = "emulab-boss-1.8"; +my $BOSS_PORT = (($FBSD_VERSION == 4) ? "emulab-boss-1.8" : "emulab-boss-2.0"); +my $PHP4_PORT = "php4-extensions-1.0"; # # Figure out which directory we live in, so that some stages can do thing @@ -286,9 +304,10 @@ Phase "usersgroups", "Creating users and groups", sub { PhaseSkip("mysql user already exists"); } ExecQuietFatal("$PW useradd mysql -g 88 -g 88 -h - ". - "-d /var/db/mysql -s /sbin/nologin -c 'MySQL Daemon'"); - ExecQuietFatal("$CHOWN mysql:mysql /var/db/mysql"); + "-d $MYSQLDBDIR -s /sbin/nologin -c 'MySQL Daemon'"); }; + ExecQuietFatal("$CHOWN mysql:mysql $MYSQLDBDIR") + if (-e $MYSQLDBDIR); }; Phase "dirs", "Setting directory permissions", sub { @@ -335,14 +354,18 @@ Phase "tftp", "Setting up directories for tftp", sub { }; Phase "ports", "Installing ports", sub { - if (!ExecQuiet("$PKG_INFO -e $BOSS_PORT")) { + if (!ExecQuiet("$PKG_INFO -e $BOSS_PORT") && + (($FBSD_VERSION == 4) || !ExecQuiet("$PKG_INFO -e $PHP4_PORT"))) { PhaseSkip("Ports already installed"); } Phase "packages", "Installing packages", sub { if (!$packagedir) { PhaseSkip("No package directory provided"); } - ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $BOSS_PORT"); + ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $BOSS_PORT") + if (!ExecQuiet("$PKG_INFO -e $BOSS_PORT")); + ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $PHP4_PORT") + if ($FBSD_VERSION > 4 && !ExecQuiet("$PKG_INFO -e $PHP4_PORT")); }; if ($packagedir) { PhaseSkip("Packages installed okay"); @@ -351,21 +374,23 @@ Phase "ports", "Installing ports", sub { DoneIfExists("$PORTSMISCDIR/emulab-boss"); ExecQuietFatal("$SH $SRCDIR/ports/ports-install"); }; - # Ick. The php4 port is broken with SSL, so we have to patch it - hopefully - # it'll get fixed someday, and we remove this - Phase "php4patch", "Patching php4 port", sub { - if (!ExecQuiet("$PATCH -C -f -l -R -p0 -i $PHP4_PATCH")) { - PhaseSkip("$PHP4_PATCH already applied"); - } - ExecQuietFatal("$PATCH -f -l -p0 -i $PHP4_PATCH"); - }; + if ($FBSD_VERSION == 4) { + # Ick. The php4 port is broken with SSL, so we have to patch + # it - hopefully it'll get fixed someday, and we remove this + Phase "php4patch", "Patching php4 port", sub { + if (!ExecQuiet("$PATCH -C -f -l -R -p0 -i $PHP4_PATCH")) { + PhaseSkip("$PHP4_PATCH already applied"); + } + ExecQuietFatal("$PATCH -f -l -p0 -i $PHP4_PATCH"); + }; + } PhaseFail("Please install ports manually, since some\n of them are " . "interactive. Run: \n" . - "cd $PORTSMISCDIR/emulab-boss && make install\n" . + " cd $PORTSMISCDIR/emulab-boss && make install\n" . + " cd $PORTSMISCDIR/emulab-php4 && make install\n" . "then re-run this script."); }; -# XXX Temporary. Phase "portfixup", "Fixing up packages", sub { Phase "rsync", "Looking for rsync", sub { if (!ExecQuiet("$PKG_INFO -x rsync")) { @@ -379,7 +404,8 @@ Phase "portfixup", "Fixing up packages", sub { }; if ($WINSUPPORT) { Phase "gcc30", "Looking for GCC 3.0 and installing", sub { - if (!ExecQuiet("$PKG_INFO -x gcc30")) { + if ($FBSD_VERSION > 4 || + !ExecQuiet("$PKG_INFO -x gcc30")) { PhaseSkip("GCC 3.0 already installed"); } @@ -392,17 +418,24 @@ Phase "portfixup", "Fixing up packages", sub { }; Phase "patches", "Applying patches", sub { - Phase "g++patch", "Patching g++'s STL", sub { - if (!ExecQuiet("$PATCH -C -f -R -p0 -i $STL_PATCH")) { - PhaseSkip("$STL_PATCH already applied"); - } - ExecQuietFatal("$PATCH -f -p0 -i $STL_PATCH"); - }; + if ($FBSD_VERSION == 4) { + Phase "g++patch", "Patching g++'s STL", sub { + if (!ExecQuiet("$PATCH -C -f -R -p0 -i $STL_PATCH")) { + PhaseSkip("$STL_PATCH already applied"); + } + ExecQuietFatal("$PATCH -f -p0 -i $STL_PATCH"); + }; + } Phase "m2cryptopatch", "Patching m2crypto", sub { - if (!ExecQuiet("$PATCH -C -f -l -R -p0 -i $M2CRYPTO_PATCH")) { - PhaseSkip("$M2CRYPTO_PATCH already applied"); + my $patchfile = $M2CRYPTO_PATCH; + + if (ExecQuiet("$PKG_INFO -I -x m2crypto | fgrep -q -s '0.13'") == 0) { + $patchfile = "${patchfile}-0.13"; + } + if (!ExecQuiet("$PATCH -C -f -l -R -p0 -i $patchfile")) { + PhaseSkip("$patchfile already applied"); } - ExecQuietFatal("$PATCH -f -l -p0 -i $M2CRYPTO_PATCH"); + ExecQuietFatal("$PATCH -f -l -p0 -i $patchfile"); }; }; @@ -567,7 +600,14 @@ Phase "syslog", "Setting up syslog", sub { }; Phase "database", "Setting up database", sub { - Phase "mysql", "Starting mysql", sub { + Phase "initialize", "Initializing mysql", sub { + PhaseSkip("mysqld already initialzed") + if (-d "$MYSQLDBDIR/mysql"); + + ExecQuietFatal("$MYSQLINSTALL --ldata=${MYSQLDBDIR}"); + ExecQuietFatal("$CHOWN -R mysql:mysql $MYSQLDBDIR"); + }; + Phase "mysql", "Starting mysqls", sub { if (!ExecQuiet("$MYSQLADMIN ping")) { PhaseSkip("mysqld already running"); } @@ -639,6 +679,8 @@ Phase "database", "Setting up database", sub { Phase "rc.conf", "Adding testbed content to $RCCONF", sub { DoneIfEdited($RCCONF); AppendToFileFatal($RCCONF, + qq|rpcbind_enable="YES"|, + qq|mountd_enable="YES"|, qq|nfs_server_enable="YES"|, qq|nfs_server_flags="-u -t -n 16"|, qq|nfs_client_enable="YES"|, @@ -651,10 +693,15 @@ Phase "rc.conf", "Adding testbed content to $RCCONF", sub { qq|apache_enable="YES"|); }; -Phase "suidperl", "Setting the suid bit on $SUIDPERL", sub { - PhaseSkip("Already done") if (-u $SUIDPERL); - ExecQuietFatal("$CHMOD u+s $SUIDPERL"); -}; +# +# New version perl does not appear to require this anymore. +# +if ($FBSD_VERSION == 4) { + Phase "suidperl", "Setting the suid bit on $SUIDPERL", sub { + PhaseSkip("Already done") if (-u $SUIDPERL); + ExecQuietFatal("$CHMOD u+s $SUIDPERL"); + }; +} Phase "hosts", "Adding boss/ops/fs IP addresses to $HOSTS", sub { DoneIfEdited($HOSTS); @@ -868,7 +915,7 @@ Phase "sslcerts", "Setting up SSL certificates", sub { " 'chmod 640 ${ETC_EMULAB_DIR}/${CLIENT_PEM}; ". " chmod 640 ${ETC_EMULAB_DIR}/${EMULAB_PEM}' "); }; - Phase "apache", "Setting up Apache", sub { + Phase "apache", "Setting up Apache on boss", sub { Phase "cert", "Installing Apache SSL certificate", sub { DoneIfExists("$APACHE_CERTFILE"); ExecQuietFatal("$CP $TOP_OBJDIR/ssl/$APACHE_CERTPEM ". @@ -888,6 +935,23 @@ Phase "sslcerts", "Setting up SSL certificates", sub { ExecQuietFatal("$RCDIR/apache.sh start"); }; }; + if ($FBSD_VERSION > 4) { + Phase "apache", "Setting up Apache on ops", sub { + Phase "cert", "Installing Apache SSL certificate", sub { + ExecQuietFatal("$SCP $TOP_OBJDIR/ssl/$APACHE_CERTPEM_OPS ". + " ${USERNODE}:$APACHE_CERTFILE_OPS"); + }; + Phase "key", "Installing Apache SSL key", sub { + ExecQuietFatal("$SCP $TOP_OBJDIR/ssl/$APACHE_KEYPEM_OPS ". + " ${USERNODE}:$APACHE_KEYFILE_OPS"); + }; + Phase "rc.d", "Installing Apache startup file", sub { + ExecQuietFatal("$SSH -o 'BatchMode=yes' root\@${USERNODE} ". + " cp -f $RCDIR/apache.sh.sample ". + " $RCDIR/apache.sh"); + }; + }; + } }; Phase "event", "Setting up event system", sub { diff --git a/install/fs-install.in b/install/fs-install.in index 3e1fa0269..2e76456c7 100644 --- a/install/fs-install.in +++ b/install/fs-install.in @@ -2,7 +2,7 @@ # # EMULAB-COPYRIGHT -# Copyright (c) 2003, 2004, 2005 University of Utah and the Flux Group. +# Copyright (c) 2003, 2004, 2005, 2006 University of Utah and the Flux Group. # All rights reserved. # @@ -56,11 +56,20 @@ sub usage { exit(1); } +# Version of FreeBSD. +my $FBSD_VERSION = 4; +if (`uname -r` =~ /^(\d)/) { + $FBSD_VERSION = $1; +} +else { + die("Could not determine what version of FreeBSD you are running!\n"); +} + # -# The default meta-port (name and version) that drags in all the dependancies -# for an fs node +# The meta-ports (name and version) that drag in all the dependancies for +# an fs node. These are OS dependent as we upgrade. # -my $FS_PORT = "emulab-fs-1.4"; +my $FS_PORT = (($FBSD_VERSION == 4) ? "emulab-fs-1.4" : "emulab-fs-2.0"); my $packagedir = ""; my $batchmode = 0; @@ -278,6 +287,7 @@ Phase "portfixup", "Fixing up packages", sub { Phase "rc.conf", "Adding testbed content to rc.conf", sub { DoneIfEdited($RCCONF); AppendToFileFatal($RCCONF, + qq|rpcbind_enable="YES"|, qq|nfs_server_enable="YES"|, qq|nfs_server_flags="-u -t -n 16"|, qq|mountd_flags="-r -p 900"|, diff --git a/install/ops-install.in b/install/ops-install.in index 0ebed7e35..ba6ad9d20 100644 --- a/install/ops-install.in +++ b/install/ops-install.in @@ -2,7 +2,7 @@ # # EMULAB-COPYRIGHT -# Copyright (c) 2003, 2004, 2005 University of Utah and the Flux Group. +# Copyright (c) 2003, 2004, 2005, 2006 University of Utah and the Flux Group. # All rights reserved. # @@ -37,6 +37,9 @@ my $LOGFACIL = '@TBLOGFACIL@'; my $ELABINELAB = @ELABINELAB@; my $WINSUPPORT = @WINSUPPORT@; my $QUOTA_FSLIST= '@FS_WITH_QUOTAS@'; +my $LOGDIR = "$PREFIX/log"; +my $ETCDIR = "$PREFIX/etc"; + # True if we are also the FS node my $ISFS = ($USERNODE eq $FSNODE) ? 1 : 0; @@ -65,17 +68,28 @@ sub usage { exit(1); } +# Version of FreeBSD. +my $FBSD_VERSION = 4; +if (`uname -r` =~ /^(\d)/) { + $FBSD_VERSION = $1; +} +else { + die("Could not determine what version of FreeBSD you are running!\n"); +} + # -# The default meta-port (name and version) that drags in all the dependancies -# for an ops node +# The meta-ports (name and version) that drag in all the dependancies for +# an ops/fs node. These are OS dependent as we upgrade. # -my $OPS_PORT = "emulab-ops-1.4"; -my $FS_PORT = "emulab-fs-1.4"; +my $OPS_PORT = (($FBSD_VERSION == 4) ? "emulab-ops-1.4" : "emulab-ops-2.0"); +my $FS_PORT = (($FBSD_VERSION == 4) ? "emulab-fs-1.4" : "emulab-fs-2.0"); +my $PHP4_PORT = "php4-extensions-1.0"; my $packagedir = ""; my $batchmode = 0; +my $password; my %opts; -if (! getopts("P:p:b", \%opts)) { +if (! getopts("P:p:bw:F:", \%opts)) { usage(); } if (defined($opts{p})) { @@ -87,7 +101,12 @@ if (defined($opts{b})) { if (defined($opts{P})) { $OPS_PORT = $opts{P}; } - +if (defined($opts{F})) { + $FS_PORT = $opts{F}; +} +if (defined($opts{w})) { + $password = $opts{w}; +} if (@ARGV) { usage(); } @@ -105,6 +124,7 @@ my $TOP_OBJDIR = "$OBJDIR/.."; # my $CHGRP = "/usr/bin/chgrp"; my $CHMOD = "/bin/chmod"; +my $CHOWN = "/usr/sbin/chown"; my $PW = "/usr/sbin/pw"; my $PATCH = "/usr/bin/patch"; my $NEWALIASES = "/usr/bin/newaliases"; @@ -138,6 +158,17 @@ my $CRONTAB = "/etc/crontab"; my $AUTHKEYS = "/root/.ssh/authorized_keys"; my $SMBCONF_FILE = "/usr/local/etc/smb.conf"; my $SMBCONF_HEAD = "$SMBCONF_FILE.head"; +my $APACHE_ETCDIR = "/usr/local/etc/apache"; +my $HTTPD_CONF = "$APACHE_ETCDIR/httpd.conf"; + +# For installing mysqld +my $MYSQL = "/usr/local/bin/mysql"; +my $MYSQLADMIN = "/usr/local/bin/mysqladmin"; +my $MYSQLSHOW = "/usr/local/bin/mysqlshow"; +my $MYSQLDUMP = "/usr/local/bin/mysqldump"; +my $MYSQLINSTALL = "/usr/local/bin/mysql_install_db"; +my $MYSQLDBDIR = "/var/db/mysql"; +my $MYSQL_LOGDIR = "$LOGDIR/mysql"; # # Some directories we care about @@ -200,12 +231,29 @@ if ($UID != 0) { # # The phases are fairly self-explanatory # - -Phase "groups", "Creating admin group", sub { - if (getgrnam("tbadmin")) { - PhaseSkip("tbadmin group already exists"); - } - ExecQuietFatal("$PW groupadd tbadmin -g $TBADMINGID"); +Phase "usersgroups", "Creating users and groups", sub { + Phase "tbadmin", "Creating tbadmin group", sub { + if (getgrnam("tbadmin")) { + PhaseSkip("tbadmin group already exists"); + } + ExecQuietFatal("$PW groupadd tbadmin -g $TBADMINGID"); + }; + # Added next two cause the mysql package does not do this (port does). + Phase "mysqlgroup", "Creating mysql group", sub { + if (getgrnam("mysql")) { + PhaseSkip("mysql group already exists"); + } + ExecQuietFatal("$PW groupadd mysql -g 88"); + }; + Phase "mysqluser", "Creating mysql user", sub { + if (getpwnam("mysql")) { + PhaseSkip("mysql user already exists"); + } + ExecQuietFatal("$PW useradd mysql -g 88 -g 88 -h - ". + "-d $MYSQLDBDIR -s /sbin/nologin -c 'MySQL Daemon'"); + }; + ExecQuietFatal("$CHOWN mysql:mysql $MYSQLDBDIR") + if (-e $MYSQLDBDIR); }; Phase "dirs", "Setting directory permissions", sub { @@ -232,13 +280,17 @@ Phase "dirs", "Setting directory permissions", sub { Phase "ports", "Installing ports", sub { Phase "packages", "Installing packages", sub { - if (!ExecQuiet("$PKG_INFO -e $OPS_PORT")) { + if (!ExecQuiet("$PKG_INFO -e $OPS_PORT") && + (($FBSD_VERSION == 4) || !ExecQuiet("$PKG_INFO -e $PHP4_PORT"))) { PhaseSkip("Ports already installed"); } if (!$packagedir) { PhaseSkip("No package directory provided"); } - ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $OPS_PORT"); + ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $OPS_PORT") + if (!ExecQuiet("$PKG_INFO -e $OPS_PORT")); + ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $PHP4_PORT") + if ($FBSD_VERSION > 4 && !ExecQuiet("$PKG_INFO -e $PHP4_PORT")); }; Phase "fs-packages", "Installing FS packages", sub { if (!$ISFS) { @@ -321,7 +373,8 @@ Phase "portfixup", "Fixing up packages", sub { ExecQuietFatal("$PKG_ADD samba-3.0.7,1"); }; Phase "gcc30", "Looking for GCC 3.0 and installing", sub { - if (!ExecQuiet("$PKG_INFO -x gcc30")) { + if ($FBSD_VERSION > 4 || + !ExecQuiet("$PKG_INFO -x gcc30")) { PhaseSkip("GCC 3.0 already installed"); } @@ -335,10 +388,15 @@ Phase "portfixup", "Fixing up packages", sub { Phase "patches", "Applying patches", sub { Phase "m2cryptopatch", "Patching m2crypto", sub { - if (!ExecQuiet("$PATCH -C -f -l -R -p0 -i $M2CRYPTO_PATCH")) { - PhaseSkip("$M2CRYPTO_PATCH already applied"); - } - ExecQuietFatal("$PATCH -f -p0 -l -i $M2CRYPTO_PATCH"); + my $patchfile = $M2CRYPTO_PATCH; + + if (ExecQuiet("$PKG_INFO -I -x m2crypto | fgrep -q -s '0.13'") == 0) { + $patchfile = "${patchfile}-0.13"; + } + if (!ExecQuiet("$PATCH -C -f -l -R -p0 -i $patchfile")) { + PhaseSkip("$patchfile already applied"); + } + ExecQuietFatal("$PATCH -f -l -p0 -i $patchfile"); }; }; @@ -346,10 +404,13 @@ Phase "rc.conf", "Adding testbed content to rc.conf", sub { DoneIfEdited($RCCONF); AppendToFileFatal($RCCONF, qq|sendmail_enable="YES"|, + qq|rpcbind_enable="YES"|, + qq|mountd_enable="YES"|, qq|nfs_server_enable="YES"|, qq|nfs_server_flags="-u -t -n 16"|, qq|mountd_flags="-r -p 900"|, (($ISFS && $WINSUPPORT) ? qq|smbd_enable="YES"| : ()), + qq|apache_enable="YES"|, qq|syslogd_flags=""|); }; @@ -584,6 +645,21 @@ Phase "syslog", "Setting up syslog", sub { mkdir($TIPLOG_DIR,0755) or PhaseFail("Unable to make $TIPLOG_DIR : $!"); }; + Phase "logdir", "Creating log directory", sub { + DoneIfExists($LOGDIR); + mkdir $LOGDIR, 0775 or PhaseFail("Unable to create $LOGDIR : $!"); + ExecQuietFatal("$CHGRP tbadmin $LOGDIR"); + ExecQuietFatal("$CHMOD 775 $LOGDIR"); + }; + + Phase "mysql-logdir", "Creating mysql log directory", sub { + DoneIfExists($MYSQL_LOGDIR); + mkdir $MYSQL_LOGDIR, 0775 or + PhaseFail("Unable to create $MYSQL_LOGDIR : $!"); + ExecQuietFatal("$CHOWN mysql:mysql $MYSQL_LOGDIR"); + ExecQuietFatal("$CHMOD 775 $MYSQL_LOGDIR"); + }; + Phase "logfiles", "Creating log files", sub { foreach my $logfile (@LOGFILES) { Phase $logfile, $logfile, sub { @@ -714,6 +790,12 @@ Phase "rc.d", "Setting up rc.d scripts", sub { PhaseFail("Unable to remove $RCDIR/rsyncd.sh: $!"); } }; + Phase "mysql-server", "Removing $RCDIR/mysql-server.sh", sub { + DoneIfDoesntExist("$RCDIR/mysql-server.sh"); + if (!unlink "$RCDIR/mysql-server.sh") { + PhaseFail("Unable to remove $RCDIR/mysql-server.sh: $!"); + } + }; Phase "rc.testbed", "Installing testbed RC scripts", sub { Phase "elvind.sh", "Removing port version of elvind.sh", sub { DoneIfDoesntExist("$RCDIR/elvind.sh"); @@ -724,6 +806,75 @@ Phase "rc.d", "Setting up rc.d scripts", sub { }; }; +Phase "apache", "Installing apache config file", sub { + PhaseSkip("apache not supported on ops") + if ($FBSD_VERSION == 4); + + DoneIfEdited("$HTTPD_CONF"); + ExecQuietFatal("$GMAKE -C $TOP_OBJDIR/apache control-install"); +}; + +Phase "database", "Setting up database", sub { + PhaseSkip("mysqld not supported on ops") + if ($FBSD_VERSION == 4); + + # Get a password for the the DB. + Phase "password", "Asking for mysqld root password", sub { + DoneIfExists("$ETCDIR/mysqld.pwd"); + + if (!defined($password)) { + print "\n\nPick a password for mysqld (warning, will be echoed): "; + $password = <>; + chomp($password) + if (defined($password)); + } + PhaseFail("Invalid password supplied") + if (!defined($password) || $password eq ""); + + CreateFileFatal("$ETCDIR/mysqld.pwd", "$password"); + ExecQuietFatal("$CHMOD 750 $ETCDIR/mysqld.pwd"); + ExecQuietFatal("$CHGRP tbadmin $ETCDIR/mysqld.pwd"); + }; + $password = `cat $ETCDIR/mysqld.pwd`; + chomp($password); + + Phase "initialize", "Initializing mysql", sub { + PhaseSkip("mysqld already initialzed") + if (-d "$MYSQLDBDIR/mysql"); + + ExecQuietFatal("$MYSQLINSTALL --ldata=${MYSQLDBDIR}"); + ExecQuietFatal("$CHOWN -R mysql:mysql $MYSQLDBDIR"); + }; + + Phase "start", "Starting mysqld", sub { + my ($exitval) = ExecQuiet("$MYSQLADMIN -u mysql ping"); + + PhaseSkip("mysqld already running") + if ($exitval == 0); + + ExecQuietFatal("$RCDIR/1.mysql-server.sh start"); + # Give mysqld some time to start, then make sure it did + sleep 5; + ExecQuietFatal("$MYSQLADMIN -u mysql ping"); + }; + + # Once the password is inserted and privs flushed, will need a password + # from this point forward! + Phase "privs", "Initializing mysqld priv system", sub { + my ($exitval, @rows) = + ExecQuiet("echo 'select * from user limit 1' | ". + "$MYSQL -s -u root mysql"); + if ($exitval) { + PhaseSkip("Privs already initialized"); + } + ($exitval, @rows) = + ExecQuietFatal("echo 'update user set ". + " Password=PASSWORD(\"$password\") ". + "where user=\"root\"; flush privileges' | ". + "$MYSQL -s -u root mysql"); + }; +}; + print "----------------------------------------------------------------------\n"; print "Installation completed succesfully!\n"; print "Please reboot this machine before proceeding with boss setup\n"; diff --git a/install/ports/emulab-boss/Makefile b/install/ports/emulab-boss/Makefile index 6b7c33eaa..e4f82aafd 100644 --- a/install/ports/emulab-boss/Makefile +++ b/install/ports/emulab-boss/Makefile @@ -2,15 +2,21 @@ # Date created: 28 January 2003 # Whom: ricci@cs.utah.edu +# Need the major version number to figure out to do. +OSMAJOR!= /usr/bin/uname -r | /usr/bin/sed -e 's/\..*//' + PORTNAME= emulab-boss +.if ${OSMAJOR} >= 5 +PORTVERSION= 2.0 +.else PORTVERSION= 1.7 +.endif CATEGORIES= misc MASTER_SITES= #none DISTFILES= #none EXTRACT_ONLY= #none COMMENT= "Meta-port for an emulab boss node" - MAINTAINER= ricci@cs.utah.edu # @@ -19,17 +25,9 @@ MAINTAINER= ricci@cs.utah.edu .MAKEFLAGS+= -DSKIP_DNS_CHECK # -# These are for the php4-extensions port +# We must make sure PERL is built with this. # -.MAKEFLAGS+= WITH_MHASH=yes WITH_XMLRPC=yes WITH_CURL=yes WITH_OPENSSL=yes \ - WITH_BZ2=yes WITH_CRACK=yes WITH_GD=yes WITH_MCRYPT=yes \ - WITH_MYSQL=yes WITH_XML=yes - -# -# Disgusting. When we build the php4 port, we have to tell it we're going to be -# building an SSL extention later. The port needs to be fixed. -# -.MAKEFLAGS+= CFLAGS=-DHAVE_OPENSSL_EXT +.MAKEFLAGS+= ENABLE_SUIDPERL=yes # # For SWIG, so that it doesn't feel the need to suck in php and apache @@ -49,23 +47,21 @@ MAINTAINER= ricci@cs.utah.edu .MAKEFLAGS+= -DBATCH LIB_DEPENDS= gd.4:${PORTSDIR}/graphics/gd \ - lthread.2:${PORTSDIR}/devel/linuxthreads \ + lthread.[23]:${PORTSDIR}/devel/linuxthreads \ mhash.2:${PORTSDIR}/security/mhash \ mysqlclient.10:${PORTSDIR}/databases/mysql323-client \ snmp.4:${PORTSDIR}/net-mgmt/net-snmp4 \ vin4.2:${PORTSDIR}/misc/libelvin \ ulsshxmlrpcpp.0:${PORTSDIR}/misc/ulsshxmlrpcpp -RUN_DEPENDS= ${LOCALBASE}/etc/apache/ssl.crl:${PORTSDIR}/www/apache13-modssl \ +RUN_DEPENDS= \ + ${LOCALBASE}/etc/apache/ssl.crl:${PORTSDIR}/www/apache13-modssl \ ${LOCALBASE}/libexec/apache/libauth_mysql.so:${PORTSDIR}/www/mod_auth_mysql \ - cvsup:${PORTSDIR}/net/cvsup-without-gui \ fping:${PORTSDIR}/net/fping \ rsync:${PORTSDIR}/net/rsync \ neato:${PORTSDIR}/graphics/graphviz \ swish-e:${PORTSDIR}/www/swish-e \ ${LOCALBASE}/libexec/mysqld:${PORTSDIR}/databases/mysql323-server \ - ${LOCALBASE}/libexec/apache/libphp4.so:${PORTSDIR}/www/mod_php4 \ - ${LOCALBASE}/include/php/ext/openssl/php_openssl.h:${PORTSDIR}/lang/php4-extensions \ anytopnm:${PORTSDIR}/graphics/netpbm \ tclsh8.3:${PORTSDIR}/lang/tcl83 \ otclsh:${PORTSDIR}/lang/otcl \ @@ -76,7 +72,6 @@ RUN_DEPENDS= ${LOCALBASE}/etc/apache/ssl.crl:${PORTSDIR}/www/apache13-modssl \ ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/Time/HiRes.pm:${PORTSDIR}/devel/p5-Time-HiRes \ ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/MD5.pm:${PORTSDIR}/security/p5-MD5 \ rpm:${PORTSDIR}/archivers/rpm \ - ${LOCALBASE}/lib/tcl8.4/sql1.0/libTclMySQL.so.1:${PORTSDIR}/databases/tcl-Mysql \ xvcg:${PORTSDIR}/graphics/vcg \ ${LOCALBASE}/libexec/tftpd:${PORTSDIR}/misc/emulab-tftp-hpa \ ${LOCALBASE}/libexec/elvind:${PORTSDIR}/misc/elvind \ @@ -89,12 +84,23 @@ RUN_DEPENDS= ${LOCALBASE}/etc/apache/ssl.crl:${PORTSDIR}/www/apache13-modssl \ ${PYTHON_SITELIBDIR}/M2Crypto/ASN1.py:${PORTSDIR}/security/py-m2crypto \ ${LOCALBASE}/include/boost:${PORTSDIR}/devel/boost \ gmake:${PORTSDIR}/devel/gmake \ - ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/DBI.pm:${PORTSDIR}/databases/p5-DBI-137 \ ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/Mysql.pm:${PORTSDIR}/databases/p5-Mysql \ - swig1.1:${PORTSDIR}/devel/swig11 \ kmetis:${PORTSDIR}/math/metis \ + curl:${PORTSDIR}/ftp/curl \ ${PYTHON_SITELIBDIR}/MySQLdb/times.py:${PORTSDIR}/databases/py-MySQLdb +.if ${OSMAJOR} >= 5 +RUN_DEPENDS= ${RUN_DEPENDS} python:${PORTSDIR}/lang/python \ + ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/DBI.pm:${PORTSDIR}/databases/p5-DBI \ + swig:${PORTSDIR}/devel/swig13 +.else +RUN_DEPENDS+= cvsup:${PORTSDIR}/net/cvsup-without-gui \ + ${LOCALBASE}/libexec/apache/libphp4.so:${PORTSDIR}/www/mod_php4 \ + ${LOCALBASE}/include/php/ext/openssl/php_openssl.h:${PORTSDIR}/lang/php4-extensions \ + ${LOCALBASE}/lib/tcl8.4/sql1.0/libTclMySQL.so.1:${PORTSDIR}/databases/tcl-Mysql \ + ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/DBI.pm:${PORTSDIR}/databases/p5-DBI-137 \ + swig1.1:${PORTSDIR}/devel/swig11 +.endif USE_PERL5= yes USE_PYTHON= yes diff --git a/install/ports/emulab-fs/Makefile b/install/ports/emulab-fs/Makefile index 8bc2becca..05d271b3e 100644 --- a/install/ports/emulab-fs/Makefile +++ b/install/ports/emulab-fs/Makefile @@ -1,9 +1,15 @@ -# New ports collection makefile for: emulab-ops -# Date created: 28 January 2003 -# Whom: ricci@cs.utah.edu +# New ports collection makefile for: emulab-fs +# + +# Need the major version number to figure out to do. +OSMAJOR!= /usr/bin/uname -r | /usr/bin/sed -e 's/\..*//' PORTNAME= emulab-fs +.if ${OSMAJOR} >= 5 +PORTVERSION= 2.0 +.else PORTVERSION= 1.4 +.endif CATEGORIES= misc MASTER_SITES= #none DISTFILES= #none @@ -15,7 +21,12 @@ MAINTAINER= hibler@cs.utah.edu # # For samba, so that it doesn't suck in everything under the sun # -.MAKEFLAGS+= -DSAMBA_SUBPORT -DWITHOUT_WINBIND -DWITHOUT_LDAP -DWITHOUT_POPT +.MAKEFLAGS+= -DWITHOUT_WINBIND -DWITHOUT_LDAP -DWITHOUT_POPT -DWITHOUT_CUPS + +# +# We must make sure PERL is built with this. +# +.MAKEFLAGS+= ENABLE_SUIDPERL=yes # # This prevents any ports from trying to run interactively - some, ask silly diff --git a/install/ports/emulab-ops/Makefile b/install/ports/emulab-ops/Makefile index fddce7350..f47efde03 100644 --- a/install/ports/emulab-ops/Makefile +++ b/install/ports/emulab-ops/Makefile @@ -2,8 +2,15 @@ # Date created: 28 January 2003 # Whom: ricci@cs.utah.edu +# Need the major version number to figure out to do. +OSMAJOR!= /usr/bin/uname -r | /usr/bin/sed -e 's/\..*//' + PORTNAME= emulab-ops -PORTVERSION= 1.5 +.if ${OSMAJOR} >= 5 +PORTVERSION= 2.0 +.else +PORTVERSION= 1.4 +.endif CATEGORIES= misc MASTER_SITES= #none DISTFILES= #none @@ -12,6 +19,16 @@ COMMENT= "Meta-port for an emulab ops node" MAINTAINER= ricci@cs.utah.edu +# +# We set this so that the mysql server port doesn't do name resolution +# +.MAKEFLAGS+= -DSKIP_DNS_CHECK + +# +# We must make sure PERL is built with this. +# +.MAKEFLAGS+= ENABLE_SUIDPERL=yes + # # For SWIG, so that it doesn't feel the need to suck in php and apache # @@ -20,7 +37,7 @@ MAINTAINER= ricci@cs.utah.edu # # For samba, so that it doesn't suck in everything under the sun # -.MAKEFLAGS+= -DWITHOUT_WINBIND -DWITHOUT_LDAP -DWITHOUT_POPT +.MAKEFLAGS+= -DWITHOUT_WINBIND -DWITHOUT_LDAP -DWITHOUT_POPT -DWITHOUT_CUPS # # This prevents any ports from trying to run interactively - some, ask silly @@ -28,10 +45,15 @@ MAINTAINER= ricci@cs.utah.edu # .MAKEFLAGS+= -DBATCH -LIB_DEPENDS= lthread.2:${PORTSDIR}/devel/linuxthreads \ +LIB_DEPENDS= lthread.[23]:${PORTSDIR}/devel/linuxthreads \ vin4.2:${PORTSDIR}/misc/libelvin \ ulsshxmlrpcpp.0:${PORTSDIR}/misc/ulsshxmlrpcpp +.if ${OSMAJOR} >= 5 +LIB_DEPENDS+= mhash.2:${PORTSDIR}/security/mhash \ + mysqlclient.10:${PORTSDIR}/databases/mysql323-client +.endif + RUN_DEPENDS= gmake:${PORTSDIR}/devel/gmake \ sudo:${PORTSDIR}/security/sudo \ rsync:${PORTSDIR}/net/rsync \ @@ -40,9 +62,21 @@ RUN_DEPENDS= gmake:${PORTSDIR}/devel/gmake \ ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/Time/HiRes.pm:${PORTSDIR}/devel/p5-Time-HiRes \ wget:${PORTSDIR}/ftp/wget \ ${LOCALBASE}/libexec/elvind:${PORTSDIR}/misc/elvind \ - ${PYTHON_SITELIBDIR}/M2Crypto/ASN1.py:${PORTSDIR}/security/py-m2crypto \ - smbd:${PORTSDIR}/net/samba3 + ${PYTHON_SITELIBDIR}/M2Crypto/ASN1.py:${PORTSDIR}/security/py-m2crypto +.if ${OSMAJOR} >= 5 +RUN_DEPENDS+= python:${PORTSDIR}/lang/python \ + ${LOCALBASE}/etc/apache/ssl.crl:${PORTSDIR}/www/apache13-modssl \ + ${LOCALBASE}/libexec/apache/libauth_mysql.so:${PORTSDIR}/www/mod_auth_mysql \ + ${LOCALBASE}/libexec/mysqld:${PORTSDIR}/databases/mysql323-server \ + ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/DBI.pm:${PORTSDIR}/databases/p5-DBI \ + ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/Mysql.pm:${PORTSDIR}/databases/p5-Mysql \ + ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/XML/Parser:${PORTSDIR}/textproc/p5-XML-Parser \ + ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/XML/Simple.pm:${PORTSDIR}/textproc/p5-XML-Simple \ + curl:${PORTSDIR}/ftp/curl +.else +RUN_DEPENDS+= smbd:${PORTSDIR}/net/samba3 +.endif NO_BUILD= yes USE_PYTHON= yes @@ -50,3 +84,4 @@ USE_PYTHON= yes do-install: # empty .include + diff --git a/install/ports/emulab-php4/Makefile b/install/ports/emulab-php4/Makefile new file mode 100644 index 000000000..e7af260b6 --- /dev/null +++ b/install/ports/emulab-php4/Makefile @@ -0,0 +1,41 @@ +# New ports collection makefile for: emulab-php4 +# Date created: 09 February 2006 +# Whom: stoller@flux.utah.edu + +# +# These are for the php4-extensions port +# +WITH_MHASH=yes +WITH_XMLRPC=yes +WITH_CURL=yes +WITH_OPENSSL=yes +WITH_BZ2=yes +WITH_GD=yes +WITH_MCRYPT=yes +WITH_MYSQL=yes +WITH_XML=yes + +# +# For the PHP ports, so they will depend on the actual version of apache we're +# installing +# +APACHE_PORT=www/apache13-modssl + +# +# This prevents the option screen. +# +BATCH=yes + +# +# Disgusting. When we build the php4 port, we have to tell it we're going to be +# building an SSL extention later. The port appears to be fixed at 4.4.2, so +# this can go when we upgrade our base to that (currently at 4.4.1). +# +.MAKEFLAGS+= CFLAGS=-DHAVE_OPENSSL_EXT WITH_OPENSSL=yes + +# +# But need this too! +# +.MAKEFLAGS+= -DBATCH APACHE_PORT=www/apache13-modssl + +.include "../../lang/php4-extensions/Makefile" diff --git a/install/ports/emulab-php4/pkg-descr b/install/ports/emulab-php4/pkg-descr new file mode 100644 index 000000000..6fa819c9d --- /dev/null +++ b/install/ports/emulab-php4/pkg-descr @@ -0,0 +1,2 @@ +Meta-port to make sure the proper php4 extensions required for an emulab +boss,ops node. diff --git a/install/ports/emulab-php4/pkg-plist b/install/ports/emulab-php4/pkg-plist new file mode 100644 index 000000000..0337a60da --- /dev/null +++ b/install/ports/emulab-php4/pkg-plist @@ -0,0 +1 @@ +@comment This packing list left intentionally empty diff --git a/install/ports/ports-install b/install/ports/ports-install index 8b5efed78..d101205d6 100644 --- a/install/ports/ports-install +++ b/install/ports/ports-install @@ -7,7 +7,7 @@ PORTSDIR=/usr/ports PORTSUBDIR=misc SRCDIR=`dirname $0` -PORTS="elvind emulab-boss emulab-fs emulab-ops libelvin emulab-tftp-hpa p5-GD-old ulsshxmlrpcpp emulab-iperf" +PORTS="elvind emulab-boss emulab-fs emulab-ops libelvin emulab-tftp-hpa p5-GD-old ulsshxmlrpcpp emulab-iperf emulab-php4" for PORT in $PORTS do -- GitLab