source: trunk/base/portmgr/jobs/mprsyncup @ 30447

Last change on this file since 30447 was 30447, checked in by jmpp@…, 12 years ago

Move all server side jobs to a new portmgr/jobs dir, in order to keep easier track of what we need to setup to have all our services running.
Add placeholder launchd plists for those jobs that don't already have an uploaded one (all but PortIndex2MySQL); I hope to fill these with
the appropriate information as I gather it.

PS: James, do you want me to move autosubmit in here too?

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 3.5 KB
Line 
1#!/bin/sh
2
3####
4# Script to checkout/update base sources from both trunk (ToT) and the current
5# release tag (as determined by the base/config/RELEASE_URL file) and a ports
6# tree from trunk (ToT), and then export and sync all of them to the
7# ${RSYNCROOT} location, wherefrom the rsync modules are fed to the `sync'
8# and `selfupdate' routines in port(1). Read the base/portmgr/rsync.repos
9# file for more information on both the necessary rsync modules and filesystem
10# level paths, which this script bootstraps.
11#
12# Whatever server uses this script to mirror the MacPorts rsync repositories
13# should simply adapt the ${RSYNCROOT} path variable as necessary (keeping it
14# in sync with the equally named variable in base/portmgr/rsync.repos) and
15# install it on cron/launchd with a suitable periodicity, previously discussed
16# with the portmgr@ team (macports-mgr@lists.macosforge.org). Repositories
17# themselves are detailed & served by base/portmgr/rsync.repos, as stated above
18# (that is, no manual intervention what-so-ever is needed, other than installing
19# this script and adding the repositories detailed in base/portmgr/rsync.repos
20# to a local rsyncd.conf file).
21#
22# Lastly, it is required of every 3rd party mirrors to keep track of this script
23# and the base/portmgr/rsync.repos file and always maintain local copies in as
24# close sync as possible.
25#
26#
27# Created by fkr@opendarwin.org, jberry@macports.org and yeled@macports.org,
28# Updated by jmpp@macports.org
29# $Id: mprsyncup 30447 2007-10-28 05:58:31Z jmpp@macports.org $
30####
31
32set -e
33
34# Commands we need:
35SVN="/opt/local/bin/svn -q --non-interactive"
36RSYNC="/usr/bin/rsync -q"
37
38# Paths we'll work on:
39SVNROOT=/var/tmp/macports
40TBASE=${SVNROOT}/trunk/base
41RBASE=${SVNROOT}/release/base
42PORTS=${SVNROOT}/release/ports
43RSYNCROOT=/Volumes/data/rsync/macports
44
45# Sources information:
46SVNURL=http://svn.macports.org/repository/macports
47RELEASE_URL_FILE=config/RELEASE_URL
48
49
50# Update/checkout trunk's base, export and rsync it to the rsync repos location (${RSYNCROOT}):
51if [ -d ${TBASE}/.svn ]; then
52    ${SVN} update ${TBASE}
53else
54    ${SVN} checkout ${SVNURL}/trunk/base ${TBASE}
55fi
56${SVN} export ${TBASE} ${TBASE}-export
57if [ ! -d ${RSYNCROOT}/trunk/base ]; then
58    mkdir -p ${RSYNCROOT}/trunk
59fi
60${RSYNC} -a -I --delete ${TBASE}-export/ ${RSYNCROOT}/trunk/base && rm -rf ${TBASE}-export
61
62
63# Read what tag we're releasing from, switch to/checkout a copy, export and rsync it to ${RSYNCROOT}/release/base:
64read RELEASE_URL < ${TBASE}/${RELEASE_URL_FILE}
65if [ ! -n ${RELEASE_URL} ]; then
66    echo "no RELEASE_URL specified in svn trunk, baling out"
67    exit 1
68fi
69if [ -d ${RBASE}/.svn ]; then
70    ${SVN} switch ${RELEASE_URL} ${RBASE}
71else
72    ${SVN} checkout ${RELEASE_URL} ${RBASE}
73fi
74${SVN} export ${RBASE} ${RBASE}-export
75if [ ! -d ${RSYNCROOT}/release/base ]; then
76    mkdir -p ${RSYNCROOT}/release/base
77fi
78${RSYNC} -a -I --delete ${RBASE}-export/ ${RSYNCROOT}/release/base && rm -rf ${RBASE}-export
79
80
81# Update/checkout the ports tree, export it and rsync it to ${RSYNCROOT}/release/ports:
82if [ -d ${PORTS}/.svn ]; then
83  ${SVN} update ${PORTS} 
84else
85    ${SVN} checkout ${SVNURL}/trunk/dports ${PORTS}
86fi
87${SVN} export ${PORTS} ${PORTS}-export
88if [ ! -d ${RSYNCROOT}/release/ports ]; then
89    mkdir -p ${RSYNCROOT}/release/ports
90fi
91${RSYNC} -a -I --delete ${PORTS}-export/ ${RSYNCROOT}/release/ports && rm -rf ${PORTS}-export
92
93
94# Compatibility checks:
95cd ${RSYNCROOT}
96if [ ! -h dpupdate ]; then
97    rm -rf dpupdate && ln -s trunk dpupdate
98fi
99if [ ! -h dpupdate1 ]; then
100    rm -rf dpupdate1 && ln -s release dpupdate1
101fi
102if [ ! -h trunk/dports ]; then
103    cd trunk
104    rm -rf dports && ln -s ../release/ports dports
105fi
Note: See TracBrowser for help on using the repository browser.