rename myplc-native into plain myplc and old-fashioned myplc into myplc-chroot
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Sat, 10 Jan 2009 12:03:29 +0000 (12:03 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Sat, 10 Jan 2009 12:03:29 +0000 (12:03 +0000)
build-chroot.sh [new file with mode: 0755]
build-native.sh [deleted file]
build.sh
myplc-chroot.spec [moved from myplc-native.spec with 58% similarity]
myplc.spec

diff --git a/build-chroot.sh b/build-chroot.sh
new file mode 100755 (executable)
index 0000000..8e5d9b4
--- /dev/null
@@ -0,0 +1,139 @@
+#!/bin/bash
+#
+# Builds MyPLC in the current host environment
+# This is for the so-called chroot installation mode, meaning that
+# the resulting rpm will install a full chroot image in /plc/root
+# that can be run through chroot /plc/root
+# This chroot mode is to be opposed to the native mode (see build-native.sh)
+# that can be used in the host's root context or within a vserver
+#
+# root.img (loopback image)
+# root/ (mount point)
+# data/ (various data files)
+# data/etc/planetlab/ (configuration files)
+# data/root (root's homedir)
+#
+# Mark Huang <mlhuang@cs.princeton.edu>
+# Copyright (C) 2006 The Trustees of Princeton University
+#
+# $Id$
+#
+
+. build.functions
+
+# pldistro expected as $1 - defaults to planetlab
+pldistro=$1 ; shift
+
+# These directories are allowed to grow to unspecified size, so they
+# are stored as symlinks to the /data partition. mkfedora and yum
+# expect some of them to be real directories, however.
+datadirs=(
+/etc/planetlab
+/root
+/var/lib/pgsql
+/var/www/html/alpina-logs
+/var/www/html/boot
+/var/www/html/download
+/var/www/html/download-${pldistro}-${pl_DISTRO_ARCH}
+/var/www/html/files
+/var/www/html/sites
+/var/www/html/generated
+/var/www/html/install-rpms
+/var/www/html/xml
+/tmp
+/usr/tmp
+/var/tmp
+/var/log
+)
+
+pl_fixdirs root "${datadirs[@]}"
+
+echo "* myplc: Installing base filesystem"
+mkdir -p root data
+
+pl_root_makedevs root
+pkgsfile=$(pl_locateDistroFile ../build/ ${pldistro} myplc.pkgs)
+pl_root_mkfedora root $pldistro $pkgsfile
+pl_root_tune_image root
+
+# Install configuration scripts
+echo "* myplc: Installing configuration scripts"
+install -D -m 755 plc_config.py root/tmp/plc_config.py
+chroot root sh -c 'cd /tmp; python plc_config.py build; python plc_config.py install'
+install -D -m 755 plc-config root/usr/bin/plc-config
+install -D -m 755 plc-config-tty root/usr/bin/plc-config-tty
+install -D -m 755 db-config root/usr/bin/db-config
+install -D -m 755 dns-config root/usr/bin/dns-config
+install -D -m 755 plc-map.py root/usr/bin/plc-map.py
+install -D -m 755 plc-kml.py root/usr/bin/plc-kml.py
+install -D -m 755 refresh-peer.py root/usr/bin/refresh-peer.py
+install -D -m 755 clean-empty-dirs.py root/usr/bin/clean-empty-dirs.py
+install -D -m 755 mtail.py root/usr/bin/mtail.py
+install -D -m 755 check-ssl-peering.py root/usr/bin/check-ssl-peering.py
+# Extra scripts (mostly for mail and dns) not installed by myplc by default.  Used in production
+mkdir root/etc/support-scripts
+cp support-scripts/* root/etc/support-scripts 
+# copy initscripts to etc/plc_sliceinitscripts
+mkdir root/etc/plc_sliceinitscripts
+cp plc_sliceinitscripts/* root/etc/plc_sliceinitscripts
+
+# Install initscripts
+echo "* myplc: Installing initscripts"
+find plc.d | cpio -p -d -u root/etc/
+install -D -m 755 guest.init root/etc/init.d/plc
+chroot root sh -c 'chkconfig --add plc; chkconfig plc on'
+
+# fetch the release stamp from the build if any
+# I could not come up with any more sensitive scheme 
+if [ -f ../../../myplc-release ] ; then
+  cp ../../../myplc-release myplc-release
+else
+  echo "Cannot find release information." > myplc-release
+  date >> myplc-release
+  echo "$HeadURL$" >> myplc-release
+fi
+# install it in /etc/myplc-release 
+install -m 444 myplc-release root/etc/myplc-release
+
+### Thierry Parmentelat - april 16 2007
+# fix the yum.conf as produced by mkfedora
+# so we can use the build's fc4 mirror for various installs/upgrades
+# within the chroot jail
+# yum_conf_to_build_host is defined in build.functions
+yum_conf_to_build_host ../build > root/etc/yum.conf
+
+### Thierry Parmentelat - may 8 2008
+# no doc built in this old-fashioned packaging anymore
+# use myplc-docs instead
+
+# Install configuration file
+echo "* myplc: Installing configuration file"
+install -D -m 444 default_config.xml data/etc/planetlab/default_config.xml
+install -D -m 444 plc_config.dtd data/etc/planetlab/plc_config.dtd
+
+# handle root's homedir and tweak root prompt
+echo "* myplc: root's homedir and prompt"
+roothome=data/root
+mkdir -p $roothome
+cat << EOF > $roothome/.profile
+export PS1="<plc> \$PS1"
+EOF
+chmod 644 $roothome/.profile
+
+# Move "data" directories out of the installation
+echo "* myplc: Moving data directories out of the installation"
+pl_move_dirs root data /data "${datadirs[@]}"
+
+# Fix permissions on tmp directories
+pl_fixtmp_permissions data
+
+# Remove generated bootmanager script
+rm -f data/var/www/html/boot/bootmanager.sh
+
+# yumgroups.xml and yum repo : let noderepo handle that
+
+# Make image out of directory
+echo "* myplc: Building loopback image"
+pl_make_image root root.img 100000000
+
+exit 0
diff --git a/build-native.sh b/build-native.sh
deleted file mode 100755 (executable)
index 8ac4f25..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/bash
-#
-# Builds MyPLC, either inside the MyPLC development environment in
-# devel/root (if PLC_DEVEL_BOOTSTRAP is true), or in the current host
-# environment (may be itself a MyPLC development environment or a
-# Fedora environment with the appropriate development packages
-# installed).
-#
-# Marc E. Fiuczynski <mef@cs.princeton.edu>
-# Copyright (C) 2007 The Trustees of Princeton University
-#
-# $Id$
-#
-
-. build.functions
-
-# XXX .spec file needs to have the appropriate set of requires statements
-
-# Install configuration scripts
-echo "* myplc-native: Installing configuration scripts"
-pldistro=$1; shift
-RPM_BUILD_ROOT=$1 ; shift
-rm -rf ${RPM_BUILD_ROOT}
-mkdir -p ${RPM_BUILD_ROOT}
-echo "* myplc-native: installing plc_config.py in /usr/share/myplc"
-install -D -m 755 plc_config.py ${RPM_BUILD_ROOT}/usr/share/myplc/plc_config.py
-install -D -m 644 bashrc ${RPM_BUILD_ROOT}/usr/share/myplc/bashrc
-echo "* myplc-native: installing scripts in /usr/bin"
-install -D -m 755 plc-config ${RPM_BUILD_ROOT}/usr/bin/plc-config
-install -D -m 755 plc-config-tty ${RPM_BUILD_ROOT}/usr/bin/plc-config-tty
-install -D -m 755 db-config ${RPM_BUILD_ROOT}/usr/bin/db-config
-install -D -m 755 dns-config ${RPM_BUILD_ROOT}/usr/bin/dns-config
-install -D -m 755 plc-map.py ${RPM_BUILD_ROOT}/usr/bin/plc-map.py
-install -D -m 755 plc-kml.py ${RPM_BUILD_ROOT}/usr/bin/plc-kml.py
-install -D -m 755 refresh-peer.py ${RPM_BUILD_ROOT}/usr/bin/refresh-peer.py
-install -D -m 755 clean-empty-dirs.py ${RPM_BUILD_ROOT}/usr/bin/clean-empty-dirs.py
-install -D -m 755 mtail.py ${RPM_BUILD_ROOT}/usr/bin/mtail.py
-install -D -m 755 check-ssl-peering.py ${RPM_BUILD_ROOT}/usr/bin/check-ssl-peering.py
-# Extra scripts (mostly for mail and dns) not installed by myplc by default.  Used in production
-echo "* myplc-native: installing scripts in /etc/support-scripts"
-mkdir -p ${RPM_BUILD_ROOT}/etc/support-scripts
-cp support-scripts/* ${RPM_BUILD_ROOT}/etc/support-scripts
-# copy initscripts to etc/plc_sliceinitscripts
-mkdir -p ${RPM_BUILD_ROOT}/etc/plc_sliceinitscripts
-cp plc_sliceinitscripts/* ${RPM_BUILD_ROOT}/etc/plc_sliceinitscripts
-
-# Install initscripts
-echo "* myplc-native: Installing initscripts"
-find plc.d | cpio -p -d -u ${RPM_BUILD_ROOT}/etc/
-install -D -m 755 guest.init ${RPM_BUILD_ROOT}/etc/init.d/plc
-
-# Install configuration file
-echo "* myplc: Installing configuration file"
-install -D -m 444 default_config.xml ${RPM_BUILD_ROOT}/etc/planetlab/default_config.xml
-install -D -m 444 plc_config.dtd ${RPM_BUILD_ROOT}/etc/planetlab/plc_config.dtd
-
-# yumgroups.xml and yum repo : let noderepo handle that
-
-exit 0
index 8e5d9b4..8ac4f25 100755 (executable)
--- a/build.sh
+++ b/build.sh
 #!/bin/bash
 #
-# Builds MyPLC in the current host environment
-# This is for the so-called chroot installation mode, meaning that
-# the resulting rpm will install a full chroot image in /plc/root
-# that can be run through chroot /plc/root
-# This chroot mode is to be opposed to the native mode (see build-native.sh)
-# that can be used in the host's root context or within a vserver
+# Builds MyPLC, either inside the MyPLC development environment in
+# devel/root (if PLC_DEVEL_BOOTSTRAP is true), or in the current host
+# environment (may be itself a MyPLC development environment or a
+# Fedora environment with the appropriate development packages
+# installed).
 #
-# root.img (loopback image)
-# root/ (mount point)
-# data/ (various data files)
-# data/etc/planetlab/ (configuration files)
-# data/root (root's homedir)
-#
-# Mark Huang <mlhuang@cs.princeton.edu>
-# Copyright (C) 2006 The Trustees of Princeton University
+# Marc E. Fiuczynski <mef@cs.princeton.edu>
+# Copyright (C) 2007 The Trustees of Princeton University
 #
 # $Id$
 #
 
 . build.functions
 
-# pldistro expected as $1 - defaults to planetlab
-pldistro=$1 ; shift
-
-# These directories are allowed to grow to unspecified size, so they
-# are stored as symlinks to the /data partition. mkfedora and yum
-# expect some of them to be real directories, however.
-datadirs=(
-/etc/planetlab
-/root
-/var/lib/pgsql
-/var/www/html/alpina-logs
-/var/www/html/boot
-/var/www/html/download
-/var/www/html/download-${pldistro}-${pl_DISTRO_ARCH}
-/var/www/html/files
-/var/www/html/sites
-/var/www/html/generated
-/var/www/html/install-rpms
-/var/www/html/xml
-/tmp
-/usr/tmp
-/var/tmp
-/var/log
-)
-
-pl_fixdirs root "${datadirs[@]}"
-
-echo "* myplc: Installing base filesystem"
-mkdir -p root data
-
-pl_root_makedevs root
-pkgsfile=$(pl_locateDistroFile ../build/ ${pldistro} myplc.pkgs)
-pl_root_mkfedora root $pldistro $pkgsfile
-pl_root_tune_image root
+# XXX .spec file needs to have the appropriate set of requires statements
 
 # Install configuration scripts
-echo "* myplc: Installing configuration scripts"
-install -D -m 755 plc_config.py root/tmp/plc_config.py
-chroot root sh -c 'cd /tmp; python plc_config.py build; python plc_config.py install'
-install -D -m 755 plc-config root/usr/bin/plc-config
-install -D -m 755 plc-config-tty root/usr/bin/plc-config-tty
-install -D -m 755 db-config root/usr/bin/db-config
-install -D -m 755 dns-config root/usr/bin/dns-config
-install -D -m 755 plc-map.py root/usr/bin/plc-map.py
-install -D -m 755 plc-kml.py root/usr/bin/plc-kml.py
-install -D -m 755 refresh-peer.py root/usr/bin/refresh-peer.py
-install -D -m 755 clean-empty-dirs.py root/usr/bin/clean-empty-dirs.py
-install -D -m 755 mtail.py root/usr/bin/mtail.py
-install -D -m 755 check-ssl-peering.py root/usr/bin/check-ssl-peering.py
+echo "* myplc-native: Installing configuration scripts"
+pldistro=$1; shift
+RPM_BUILD_ROOT=$1 ; shift
+rm -rf ${RPM_BUILD_ROOT}
+mkdir -p ${RPM_BUILD_ROOT}
+echo "* myplc-native: installing plc_config.py in /usr/share/myplc"
+install -D -m 755 plc_config.py ${RPM_BUILD_ROOT}/usr/share/myplc/plc_config.py
+install -D -m 644 bashrc ${RPM_BUILD_ROOT}/usr/share/myplc/bashrc
+echo "* myplc-native: installing scripts in /usr/bin"
+install -D -m 755 plc-config ${RPM_BUILD_ROOT}/usr/bin/plc-config
+install -D -m 755 plc-config-tty ${RPM_BUILD_ROOT}/usr/bin/plc-config-tty
+install -D -m 755 db-config ${RPM_BUILD_ROOT}/usr/bin/db-config
+install -D -m 755 dns-config ${RPM_BUILD_ROOT}/usr/bin/dns-config
+install -D -m 755 plc-map.py ${RPM_BUILD_ROOT}/usr/bin/plc-map.py
+install -D -m 755 plc-kml.py ${RPM_BUILD_ROOT}/usr/bin/plc-kml.py
+install -D -m 755 refresh-peer.py ${RPM_BUILD_ROOT}/usr/bin/refresh-peer.py
+install -D -m 755 clean-empty-dirs.py ${RPM_BUILD_ROOT}/usr/bin/clean-empty-dirs.py
+install -D -m 755 mtail.py ${RPM_BUILD_ROOT}/usr/bin/mtail.py
+install -D -m 755 check-ssl-peering.py ${RPM_BUILD_ROOT}/usr/bin/check-ssl-peering.py
 # Extra scripts (mostly for mail and dns) not installed by myplc by default.  Used in production
-mkdir root/etc/support-scripts
-cp support-scripts/* root/etc/support-scripts 
+echo "* myplc-native: installing scripts in /etc/support-scripts"
+mkdir -p ${RPM_BUILD_ROOT}/etc/support-scripts
+cp support-scripts/* ${RPM_BUILD_ROOT}/etc/support-scripts
 # copy initscripts to etc/plc_sliceinitscripts
-mkdir root/etc/plc_sliceinitscripts
-cp plc_sliceinitscripts/* root/etc/plc_sliceinitscripts
+mkdir -p ${RPM_BUILD_ROOT}/etc/plc_sliceinitscripts
+cp plc_sliceinitscripts/* ${RPM_BUILD_ROOT}/etc/plc_sliceinitscripts
 
 # Install initscripts
-echo "* myplc: Installing initscripts"
-find plc.d | cpio -p -d -u root/etc/
-install -D -m 755 guest.init root/etc/init.d/plc
-chroot root sh -c 'chkconfig --add plc; chkconfig plc on'
-
-# fetch the release stamp from the build if any
-# I could not come up with any more sensitive scheme 
-if [ -f ../../../myplc-release ] ; then
-  cp ../../../myplc-release myplc-release
-else
-  echo "Cannot find release information." > myplc-release
-  date >> myplc-release
-  echo "$HeadURL$" >> myplc-release
-fi
-# install it in /etc/myplc-release 
-install -m 444 myplc-release root/etc/myplc-release
-
-### Thierry Parmentelat - april 16 2007
-# fix the yum.conf as produced by mkfedora
-# so we can use the build's fc4 mirror for various installs/upgrades
-# within the chroot jail
-# yum_conf_to_build_host is defined in build.functions
-yum_conf_to_build_host ../build > root/etc/yum.conf
-
-### Thierry Parmentelat - may 8 2008
-# no doc built in this old-fashioned packaging anymore
-# use myplc-docs instead
+echo "* myplc-native: Installing initscripts"
+find plc.d | cpio -p -d -u ${RPM_BUILD_ROOT}/etc/
+install -D -m 755 guest.init ${RPM_BUILD_ROOT}/etc/init.d/plc
 
 # Install configuration file
 echo "* myplc: Installing configuration file"
-install -D -m 444 default_config.xml data/etc/planetlab/default_config.xml
-install -D -m 444 plc_config.dtd data/etc/planetlab/plc_config.dtd
-
-# handle root's homedir and tweak root prompt
-echo "* myplc: root's homedir and prompt"
-roothome=data/root
-mkdir -p $roothome
-cat << EOF > $roothome/.profile
-export PS1="<plc> \$PS1"
-EOF
-chmod 644 $roothome/.profile
-
-# Move "data" directories out of the installation
-echo "* myplc: Moving data directories out of the installation"
-pl_move_dirs root data /data "${datadirs[@]}"
-
-# Fix permissions on tmp directories
-pl_fixtmp_permissions data
-
-# Remove generated bootmanager script
-rm -f data/var/www/html/boot/bootmanager.sh
+install -D -m 444 default_config.xml ${RPM_BUILD_ROOT}/etc/planetlab/default_config.xml
+install -D -m 444 plc_config.dtd ${RPM_BUILD_ROOT}/etc/planetlab/plc_config.dtd
 
 # yumgroups.xml and yum repo : let noderepo handle that
 
-# Make image out of directory
-echo "* myplc: Building loopback image"
-pl_make_image root root.img 100000000
-
 exit 0
similarity index 58%
rename from myplc-native.spec
rename to myplc-chroot.spec
index 0f27e5b..576c2e4 100644 (file)
@@ -3,7 +3,7 @@
 #
 %define url $URL$
 
-%define name myplc-native
+%define name myplc-chroot
 %define version 5.0
 %define taglevel 1
 
@@ -17,68 +17,15 @@ License: PlanetLab
 Group: Applications/Systems
 Source0: %{name}-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-BuildArch: noarch
 
 Vendor: PlanetLab
 Packager: PlanetLab Central <support@planet-lab.org>
 Distribution: PlanetLab %{plrelease}
 URL: %(echo %{url} | cut -d ' ' -f 2)
 
-Requires: bzip2
-Requires: sendmail-cf
-Requires: tar 
-Requires: less
-Requires: perl-GD
-Requires: openssl
-Requires: xmlsec1
-Requires: gd
-Requires: expect
-Requires: php-pgsql
-Requires: curl
-Requires: python-pycurl
-Requires: python-psycopg2
-Requires: httpd
-Requires: rsync
-Requires: mod_python
-Requires: mod_ssl
-Requires: bootmanager
-Requires: python-devel
-Requires: SOAPpy
-Requires: vixie-cron
-Requires: yum
-Requires: php-gd
-Requires: PyXML
-Requires: sendmail
-Requires: python >= 2.4
-Requires: createrepo
-Requires: postgresql-python
-Requires: cpio
-Requires: postgresql-server
-Requires: wget
-Requires: php
-Requires: xmlsec1-openssl
-Requires: postgresql
-Requires: openssh
-Requires: bootcd-%{pldistro}-%{_arch}
-Requires: dnsmasq
-Requires: diffutils
-Requires: gzip
-Requires: vim-minimal
-Requires: findutils
-# planetlab stuff
-Requires: PLCWWW
-Requires: nodeconfig
-Requires: PLCAPI
-Requires: bootstrapfs-%{pldistro}-%{_arch}
-Requires: myplc-docs
-Requires: myplc-release
-
-# argh - ugly - we might wish to use something from build/config.%{pldistro} instead
-%if "%{pldistro}" == "onelab"
-Requires: dummynet_image
-%endif
-
-Provides: myplc = %version-%release
+Requires: tar
+
+Provides: myplc
 
 %define debug_package %{nil}
 
@@ -86,20 +33,43 @@ Provides: myplc = %version-%release
 MyPLC is a complete PlanetLab Central (PLC) portable installation
 contained within a chroot jail. The default installation consists of a
 web server, an XML-RPC API server, a boot server, and a database
-server: the core components of PLC. The installation may be customized
-through a graphical interface. All PLC services are started up and
+server: the core components of PLC. All PLC services are started up and
 shut down through a single System V init script installed in the host
-system.
+system. The related Web Interface is now separately packaged
+in the PLCWWW component. 
 
 %prep
 %setup -q
 
 %build
+pushd MyPLC
+./build-chroot.sh %{pldistro}
+popd
 
 %install
-pushd MyPLC
 rm -rf $RPM_BUILD_ROOT
-./build-native.sh %{pldistro} $RPM_BUILD_ROOT
+
+pushd MyPLC
+
+#
+# myplc
+#
+
+# Install host startup script and configuration file
+install -D -m 755 host.init $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/plc
+install -D -m 644 plc.sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/plc
+
+# Create convenient symlink
+install -d -m 755 $RPM_BUILD_ROOT/%{_sysconfdir}
+ln -sf /plc/data/etc/planetlab $RPM_BUILD_ROOT/%{_sysconfdir}/planetlab
+
+# Install root filesystem
+install -d -m 755 $RPM_BUILD_ROOT/plc/root
+install -D -m 644 root.img $RPM_BUILD_ROOT/plc/root.img
+
+# Install data directory
+find data | cpio -p -d -u $RPM_BUILD_ROOT/plc/
+
 popd
 
 %clean
@@ -113,12 +83,12 @@ if [ -n "$SUDO_USER" ] ; then
     # /usr/bin/sudo get created with non-readable permissions.
     find . -not -perm +0600 -exec chmod u+rw {} \;
     # Allow user to delete the built RPM(s)
-    [ -d %{_rpmdir}/noarch ] && chown -h -R $SUDO_USER %{_rpmdir}/noarch
+    chown -h -R $SUDO_USER %{_rpmdir}/%{_arch}
 fi
 
 %pre
 if [ -x %{_sysconfdir}/init.d/plc ] ; then
-    %{_sysconfdir}/init.d/plc stop
+    %{_sysconfdir}/init.d/plc safestop
 fi
 
 # Old versions of myplc used to ship with a bootstrapped database and
@@ -138,15 +108,15 @@ fi
 # 0 = install, 1 = upgrade
 if [ $1 -gt 0 ] ; then
     for dir in /var/lib/pgsql/data /etc/planetlab ; do
-       if [ -d $dir ] ; then
-           echo "Preserving $dir"
-           mkdir -p $dir.rpmsave
-           tar -C $dir -cpf - . | \
-              tar -C $dir.rpmsave -xpf -
+       if [ -d /plc/data/$dir ] ; then
+           echo "Preserving /plc/data/$dir"
+           mkdir -p /plc/data/$dir.rpmsave
+           tar -C /plc/data/$dir -cpf - . | \
+              tar -C /plc/data/$dir.rpmsave -xpf -
 
            # Except for the default configuration file and DTD, which
            # really should be considered for upgrade.
-           rm -f $dir.rpmsave/{default_config.xml,plc_config.dtd}
+           rm -f /plc/data/$dir.rpmsave/{default_config.xml,plc_config.dtd}
        fi
     done
 fi
@@ -156,20 +126,16 @@ if [ -x /sbin/chkconfig ] ; then
     /sbin/chkconfig --add plc
     /sbin/chkconfig plc on
 fi
-pushd /usr/share/myplc &> /dev/null
-python plc_config.py build
-python plc_config.py install
-popd &> /dev/null
 
 %triggerpostun -- %{name}
 # 0 = erase, 1 = upgrade
 if [ $1 -gt 0 ] ; then
     for dir in /var/lib/pgsql/data /etc/planetlab ; do
-       if [ -d $dir.rpmsave -a -d $dir ] ; then
-           echo "Merging $dir"
-           if tar -C $dir.rpmsave -cpf - . | \
-              tar -C $dir -xpf - ; then
-               rm -rf $dir.rpmsave
+       if [ -d /plc/data/$dir.rpmsave -a -d /plc/data/$dir ] ; then
+           echo "Merging /plc/data/$dir"
+           if tar -C /plc/data/$dir.rpmsave -cpf - . | \
+              tar -C /plc/data/$dir -xpf - ; then
+               rm -rf /plc/data/$dir.rpmsave
            fi
        fi
     done
@@ -178,7 +144,7 @@ fi
 %preun
 # 0 = erase, 1 = upgrade
 if [ $1 -eq 0 ] ; then
-    %{_sysconfdir}/init.d/plc stop
+    %{_sysconfdir}/init.d/plc safestop
     if [ -x /sbin/chkconfig ] ; then
         /sbin/chkconfig plc off
        /sbin/chkconfig --del plc
@@ -188,24 +154,19 @@ fi
 %files
 %defattr(-,root,root,-)
 # Host startup script and configuration file
-/etc/init.d/plc
-/etc/plc.d
-/etc/planetlab
-/etc/plc_sliceinitscripts/sirius
-/etc/support-scripts/gen_aliases.py*
-/etc/support-scripts/renew_reminder.py*
-/etc/support-scripts/renew_reminder_logrotate
-/usr/bin/plc-config
-/usr/bin/plc-config-tty
-/usr/bin/db-config
-/usr/bin/dns-config
-/usr/bin/plc-map.py*
-/usr/bin/plc-kml.py*
-/usr/bin/refresh-peer.py*
-/usr/bin/clean-empty-dirs.py*
-/usr/bin/mtail.py*
-/usr/bin/check-ssl-peering.py*
-/usr/share/myplc
+%{_sysconfdir}/init.d/plc
+%{_sysconfdir}/sysconfig/plc
+
+# Symlink to /etc/planetlab within data directory
+%{_sysconfdir}/planetlab
+
+# Root filesystem
+/plc/root.img
+/plc/root
+
+# Data directory
+%dir /plc/data
+%config(noreplace) /plc/data/*
 
 %changelog
 * Wed Sep 10 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-5.0-1
@@ -279,7 +240,68 @@ fi
 - sirius initscript updated
 - slice auto renewal fixed
 
-* Fri Aug 31 2007 Marc E. Fiuczynski <mef@CS.Princeton.EDU>
-- initial build.
+* Thu Jan 31 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-4.2-1 myplc-4.2-2
+- knows how to checkpoint and restore
+- packages step more robust, in particular with empty node repository
+- miscell tweaks for native packaging
+
+* Wed Jan 09 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-4.0-15 myplc-4.2-0
+moving to 4.2 - no change
+
+* Fri Jan 19 2007 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.5-3
+- Split off myplc-devel into separate spec file, so that it can be
+  built standalone.
+
+* Tue Aug 22 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.4-3, 0.5-3
+- MyPLC 0.4 RC3.
+- Fix upgrade path from RC1.
+- Always regenerate plc_config.xml at first startup
+- Upgrade kernel, iptables, vnet to 2.6.17-1.2142_FC4-3.planetlab
+- Minor PlanetFlow fixes
+- pl_mom/swapmon: Minor fixes
+- bootcd: Added Supermicro IPMI support
+- bootmanager: Cleanup, fixed check for new disks
+
+* Wed Aug 09 2006 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
+- introduces variable %{build_devel} to allow custom sites to skip building
+  the myplc-devel package.
+
+* Thu Jul 13 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.4-2, 0.5-2
+- MyPLC 0.4 RC2.
+- Fix many spec files (License replaces Copyright).
+- Fix kernel build under gcc32 (module verification bug).
+- Fix vnet build under gcc32
+- Fix PlanetFlow. MySQL RPM postinstall script no longer starts the
+  server. Also, get hostnames list from PLC_WWW_HOST, not
+  www.planet-lab.org.
+- Fix pl_mom/bwmon to use cached values if NM is unresponsive
+- Fix pl_mom/swapmon reset logic to avoid endless loops
+- Remove ksymoops, add kernel-smp to standard PlanetLab package group
+- Add kernel-smp boot support to bootmanager
+- Add badblock search support to bootmanager
+- Build development environment (myplc-devel). Add support for
+  building myplc itself inside myplc-devel.
+- Move step-specific initialization to appropriate plc.d scripts
+- Fix postgresql startup failure when bootstrapping
+- Allow CA to be configured for each SSL certificate set. Stop doing
+  root CA stuff, this is outside the scope of MyPLC. MyPLC now only
+  generates self-signed certificates, but supports replacement of the
+  self-signed certificates with real certifcates signed by another CA,
+  as long as the CA is specified.
+- Self-sign the MA/SA SSL certificate (and by extension, the MA/SA API
+  certificate).
+- pl_mom: Workarounds for when NM queries time out.
+- plc_api: Honor PLC_MAIL_ENABLED.
+
+* Wed Jul  6 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.4-1, 0.5-1
+- First stable release of MyPLC 0.4 RC1.
+
+* Wed Apr  5 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.2-1
+- Basic functionality complete. Consolidate into a single package
+  installed in /plc.
+
+* Fri Mar 17 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.1-1
+- Initial build.
+
 
 %define module_current_branch 4.2
index adc63c9..5d2e4d9 100644 (file)
@@ -17,15 +17,66 @@ License: PlanetLab
 Group: Applications/Systems
 Source0: %{name}-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+BuildArch: noarch
 
 Vendor: PlanetLab
 Packager: PlanetLab Central <support@planet-lab.org>
 Distribution: PlanetLab %{plrelease}
 URL: %(echo %{url} | cut -d ' ' -f 2)
 
-Requires: tar
-
-Provides: myplc
+Requires: bzip2
+Requires: sendmail-cf
+Requires: tar 
+Requires: less
+Requires: perl-GD
+Requires: openssl
+Requires: xmlsec1
+Requires: gd
+Requires: expect
+Requires: php-pgsql
+Requires: curl
+Requires: python-pycurl
+Requires: python-psycopg2
+Requires: httpd
+Requires: rsync
+Requires: mod_python
+Requires: mod_ssl
+Requires: bootmanager
+Requires: python-devel
+Requires: SOAPpy
+Requires: vixie-cron
+Requires: yum
+Requires: php-gd
+Requires: PyXML
+Requires: sendmail
+Requires: python >= 2.4
+Requires: createrepo
+Requires: postgresql-python
+Requires: cpio
+Requires: postgresql-server
+Requires: wget
+Requires: php
+Requires: xmlsec1-openssl
+Requires: postgresql
+Requires: openssh
+Requires: bootcd-%{pldistro}-%{_arch}
+Requires: dnsmasq
+Requires: diffutils
+Requires: gzip
+Requires: vim-minimal
+Requires: findutils
+# planetlab stuff
+Requires: PLCWWW
+Requires: nodeconfig
+Requires: PLCAPI
+Requires: bootstrapfs-%{pldistro}-%{_arch}
+Requires: myplc-docs
+Requires: myplc-release
+
+# argh - ugly - we might wish to use something from build/config.%{pldistro} instead
+%if "%{pldistro}" == "onelab"
+Requires: dummynet_image
+%endif
 
 %define debug_package %{nil}
 
@@ -33,43 +84,20 @@ Provides: myplc
 MyPLC is a complete PlanetLab Central (PLC) portable installation
 contained within a chroot jail. The default installation consists of a
 web server, an XML-RPC API server, a boot server, and a database
-server: the core components of PLC. All PLC services are started up and
+server: the core components of PLC. The installation may be customized
+through a graphical interface. All PLC services are started up and
 shut down through a single System V init script installed in the host
-system. The related Web Interface is now separately packaged
-in the PLCWWW component. 
+system.
 
 %prep
 %setup -q
 
 %build
-pushd MyPLC
-./build.sh %{pldistro}
-popd
 
 %install
-rm -rf $RPM_BUILD_ROOT
-
 pushd MyPLC
-
-#
-# myplc
-#
-
-# Install host startup script and configuration file
-install -D -m 755 host.init $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/plc
-install -D -m 644 plc.sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/plc
-
-# Create convenient symlink
-install -d -m 755 $RPM_BUILD_ROOT/%{_sysconfdir}
-ln -sf /plc/data/etc/planetlab $RPM_BUILD_ROOT/%{_sysconfdir}/planetlab
-
-# Install root filesystem
-install -d -m 755 $RPM_BUILD_ROOT/plc/root
-install -D -m 644 root.img $RPM_BUILD_ROOT/plc/root.img
-
-# Install data directory
-find data | cpio -p -d -u $RPM_BUILD_ROOT/plc/
-
+rm -rf $RPM_BUILD_ROOT
+./build.sh %{pldistro} $RPM_BUILD_ROOT
 popd
 
 %clean
@@ -83,12 +111,12 @@ if [ -n "$SUDO_USER" ] ; then
     # /usr/bin/sudo get created with non-readable permissions.
     find . -not -perm +0600 -exec chmod u+rw {} \;
     # Allow user to delete the built RPM(s)
-    chown -h -R $SUDO_USER %{_rpmdir}/%{_arch}
+    [ -d %{_rpmdir}/noarch ] && chown -h -R $SUDO_USER %{_rpmdir}/noarch
 fi
 
 %pre
 if [ -x %{_sysconfdir}/init.d/plc ] ; then
-    %{_sysconfdir}/init.d/plc safestop
+    %{_sysconfdir}/init.d/plc stop
 fi
 
 # Old versions of myplc used to ship with a bootstrapped database and
@@ -108,15 +136,15 @@ fi
 # 0 = install, 1 = upgrade
 if [ $1 -gt 0 ] ; then
     for dir in /var/lib/pgsql/data /etc/planetlab ; do
-       if [ -d /plc/data/$dir ] ; then
-           echo "Preserving /plc/data/$dir"
-           mkdir -p /plc/data/$dir.rpmsave
-           tar -C /plc/data/$dir -cpf - . | \
-              tar -C /plc/data/$dir.rpmsave -xpf -
+       if [ -d $dir ] ; then
+           echo "Preserving $dir"
+           mkdir -p $dir.rpmsave
+           tar -C $dir -cpf - . | \
+              tar -C $dir.rpmsave -xpf -
 
            # Except for the default configuration file and DTD, which
            # really should be considered for upgrade.
-           rm -f /plc/data/$dir.rpmsave/{default_config.xml,plc_config.dtd}
+           rm -f $dir.rpmsave/{default_config.xml,plc_config.dtd}
        fi
     done
 fi
@@ -126,16 +154,20 @@ if [ -x /sbin/chkconfig ] ; then
     /sbin/chkconfig --add plc
     /sbin/chkconfig plc on
 fi
+pushd /usr/share/myplc &> /dev/null
+python plc_config.py build
+python plc_config.py install
+popd &> /dev/null
 
 %triggerpostun -- %{name}
 # 0 = erase, 1 = upgrade
 if [ $1 -gt 0 ] ; then
     for dir in /var/lib/pgsql/data /etc/planetlab ; do
-       if [ -d /plc/data/$dir.rpmsave -a -d /plc/data/$dir ] ; then
-           echo "Merging /plc/data/$dir"
-           if tar -C /plc/data/$dir.rpmsave -cpf - . | \
-              tar -C /plc/data/$dir -xpf - ; then
-               rm -rf /plc/data/$dir.rpmsave
+       if [ -d $dir.rpmsave -a -d $dir ] ; then
+           echo "Merging $dir"
+           if tar -C $dir.rpmsave -cpf - . | \
+              tar -C $dir -xpf - ; then
+               rm -rf $dir.rpmsave
            fi
        fi
     done
@@ -144,7 +176,7 @@ fi
 %preun
 # 0 = erase, 1 = upgrade
 if [ $1 -eq 0 ] ; then
-    %{_sysconfdir}/init.d/plc safestop
+    %{_sysconfdir}/init.d/plc stop
     if [ -x /sbin/chkconfig ] ; then
         /sbin/chkconfig plc off
        /sbin/chkconfig --del plc
@@ -154,19 +186,24 @@ fi
 %files
 %defattr(-,root,root,-)
 # Host startup script and configuration file
-%{_sysconfdir}/init.d/plc
-%{_sysconfdir}/sysconfig/plc
-
-# Symlink to /etc/planetlab within data directory
-%{_sysconfdir}/planetlab
-
-# Root filesystem
-/plc/root.img
-/plc/root
-
-# Data directory
-%dir /plc/data
-%config(noreplace) /plc/data/*
+/etc/init.d/plc
+/etc/plc.d
+/etc/planetlab
+/etc/plc_sliceinitscripts/sirius
+/etc/support-scripts/gen_aliases.py*
+/etc/support-scripts/renew_reminder.py*
+/etc/support-scripts/renew_reminder_logrotate
+/usr/bin/plc-config
+/usr/bin/plc-config-tty
+/usr/bin/db-config
+/usr/bin/dns-config
+/usr/bin/plc-map.py*
+/usr/bin/plc-kml.py*
+/usr/bin/refresh-peer.py*
+/usr/bin/clean-empty-dirs.py*
+/usr/bin/mtail.py*
+/usr/bin/check-ssl-peering.py*
+/usr/share/myplc
 
 %changelog
 * Wed Sep 10 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-5.0-1
@@ -240,68 +277,7 @@ fi
 - sirius initscript updated
 - slice auto renewal fixed
 
-* Thu Jan 31 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-4.2-1 myplc-4.2-2
-- knows how to checkpoint and restore
-- packages step more robust, in particular with empty node repository
-- miscell tweaks for native packaging
-
-* Wed Jan 09 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-4.0-15 myplc-4.2-0
-moving to 4.2 - no change
-
-* Fri Jan 19 2007 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.5-3
-- Split off myplc-devel into separate spec file, so that it can be
-  built standalone.
-
-* Tue Aug 22 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.4-3, 0.5-3
-- MyPLC 0.4 RC3.
-- Fix upgrade path from RC1.
-- Always regenerate plc_config.xml at first startup
-- Upgrade kernel, iptables, vnet to 2.6.17-1.2142_FC4-3.planetlab
-- Minor PlanetFlow fixes
-- pl_mom/swapmon: Minor fixes
-- bootcd: Added Supermicro IPMI support
-- bootmanager: Cleanup, fixed check for new disks
-
-* Wed Aug 09 2006 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
-- introduces variable %{build_devel} to allow custom sites to skip building
-  the myplc-devel package.
-
-* Thu Jul 13 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.4-2, 0.5-2
-- MyPLC 0.4 RC2.
-- Fix many spec files (License replaces Copyright).
-- Fix kernel build under gcc32 (module verification bug).
-- Fix vnet build under gcc32
-- Fix PlanetFlow. MySQL RPM postinstall script no longer starts the
-  server. Also, get hostnames list from PLC_WWW_HOST, not
-  www.planet-lab.org.
-- Fix pl_mom/bwmon to use cached values if NM is unresponsive
-- Fix pl_mom/swapmon reset logic to avoid endless loops
-- Remove ksymoops, add kernel-smp to standard PlanetLab package group
-- Add kernel-smp boot support to bootmanager
-- Add badblock search support to bootmanager
-- Build development environment (myplc-devel). Add support for
-  building myplc itself inside myplc-devel.
-- Move step-specific initialization to appropriate plc.d scripts
-- Fix postgresql startup failure when bootstrapping
-- Allow CA to be configured for each SSL certificate set. Stop doing
-  root CA stuff, this is outside the scope of MyPLC. MyPLC now only
-  generates self-signed certificates, but supports replacement of the
-  self-signed certificates with real certifcates signed by another CA,
-  as long as the CA is specified.
-- Self-sign the MA/SA SSL certificate (and by extension, the MA/SA API
-  certificate).
-- pl_mom: Workarounds for when NM queries time out.
-- plc_api: Honor PLC_MAIL_ENABLED.
-
-* Wed Jul  6 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.4-1, 0.5-1
-- First stable release of MyPLC 0.4 RC1.
-
-* Wed Apr  5 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.2-1
-- Basic functionality complete. Consolidate into a single package
-  installed in /plc.
-
-* Fri Mar 17 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.1-1
-- Initial build.
-
+* Fri Aug 31 2007 Marc E. Fiuczynski <mef@CS.Princeton.EDU>
+- initial build.
 
 %define module_current_branch 4.2