Merge lp:~jpds/ubumirror/ubuports-script into lp:ubumirror

Proposed by Jonathan Davies
Status: Merged
Merged at revision: 31
Proposed branch: lp:~jpds/ubumirror/ubuports-script
Merge into: lp:ubumirror
Diff against target: None lines
To merge this branch: bzr merge lp:~jpds/ubumirror/ubuports-script
Reviewer Review Type Date Requested Status
Jonathan Davies (community) Approve
Review via email: mp+5484@code.launchpad.net
To post a comment you must log in.
lp:~jpds/ubumirror/ubuports-script updated
32. By Jonathan Davies

Fixed this little variable name mistake.

Revision history for this message
Jonathan Davies (jpds) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubumirror.conf'
2--- ubumirror.conf 2009-04-12 20:41:51 +0000
3+++ ubumirror.conf 2009-04-13 13:40:12 +0000
4@@ -28,6 +28,10 @@
5 # The script won't run if this variable isn't set
6 #UBUDVD_DIR="/srv/mirror/ubuntu-dvd"
7
8+# UBUPOR_DIR is the destination for the base of the ports directory
9+# The script (ubuports) won't run if this variable isn't set
10+#UBUPOR_DIR="/srv/mirror/ubuntu-ports"
11+
12 # LOGDIR is the destination directory of all the logs
13 LOGDIR="/var/log/ubumirror/"
14
15@@ -37,6 +41,7 @@
16 UBUCDI_MIRROR=cdimage.ubuntu.com::cdimage/
17 UBUREL_MIRROR=releases.ubuntu.com::releases/
18 UBUDVD_MIRROR=cdimage.ubuntu.com::cdimage/dvd/
19+UBUPOR_MIRROR=ports.ubuntu.com::ubuntu-ports/
20
21 # UBU{ARC,CDI,REL,DVD}_EXCLUDE is what things you want to exclude
22 UBUARC_EXCLUDE="\
23@@ -59,3 +64,11 @@
24 # --exclude *-powerpc.* --exclude *-sparc.* \
25 # --exclude daily/ --exclude daily-live/ \
26 "
27+UBUARC_EXCLUDE="\
28+# --exclude binary-powerpc/ --exclude binary-sparc/ \
29+# --exclude daily-installer-powerpc/ --exclude daily-installer-sparc/ \
30+# --exclude installer-powerpc/ --exclude installer-sparc/ \
31+# --exclude *_powerpc.deb --exclude *_powerpc.udeb \
32+# --exclude *_sparc.deb --exclude *_sparc.udeb \
33+# --exclude Contents-powerpc.gz --exclude Contents-sparc.gz \
34+"
35
36=== added file 'ubuports'
37--- ubuports 1970-01-01 00:00:00 +0000
38+++ ubuports 2009-04-13 13:40:12 +0000
39@@ -0,0 +1,90 @@
40+#!/bin/sh
41+#
42+# ubuarchive - provides an easy way to sync packages from an Ubuntu
43+# archive mirror.
44+#
45+# Copyright (C) 2006 - 2009 Nafallo Bjälevik
46+#
47+# This program is free software: you can redistribute it and/or modify
48+# it under the terms of the GNU General Public License as published by
49+# the Free Software Foundation, either version 3 of the License, or
50+# (at your option) any later version.
51+#
52+# This program is distributed in the hope that it will be useful,
53+# but WITHOUT ANY WARRANTY; without even the implied warranty of
54+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
55+# GNU General Public License for more details.
56+#
57+# You should have received a copy of the GNU General Public License
58+# along with this program. If not, see <http://www.gnu.org/licenses/>.
59+#
60+
61+set -e
62+
63+if [ ! -f /etc/ubumirror.conf ]; then
64+ echo "File /etc/ubumirror.conf does not exist!"
65+ exit 2
66+fi
67+
68+. /etc/ubumirror.conf
69+
70+LOCK="${UBUPOR_DIR}/Archive-Update-in-Progress-${HOSTNAME}"
71+
72+# Get in the right directory and set the umask
73+cd $HOME
74+umask 022
75+
76+# Check to see if another sync is in progress
77+if ! ( set -o noclobber; echo "$$" > "${LOCK}") 2> /dev/null; then
78+ if ! $(kill -0 $(cat ${LOCK}) 2>/dev/null); then
79+ # Process does either not exist or is not owned by us.
80+ echo "$$" > "${LOCK}"
81+ else
82+ echo "Unable to start rsync, lock file still exists, PID $(cat ${LOCK})."
83+ exit 1
84+ fi
85+fi
86+
87+trap 'rm -f $LOCK > /dev/null 2>&1; echo -n "Done at " >> $LOGDIR/ubuports.log; date >> $LOGDIR/ubuports.log; savelog -n $LOGDIR/ubuports.log > /dev/null' EXIT
88+
89+echo -n "Starting at " > $LOGDIR/ubuports.log
90+date >> $LOGDIR/ubuports.log
91+
92+set +e
93+echo "First sync without dists and indices..." >> $LOGDIR/ubuports.log
94+rsync -av --timeout=600 --partial --delete --delete-after \
95+ --bwlimit=$SPEED \
96+ --exclude "indices/" --exclude "dists/" \
97+ --exclude "project/trace/${HOSTNAME}" \
98+ --exclude "Archive-Update-in-Progress-${HOSTNAME}" \
99+ $UBUPOR_EXCLUDE \
100+ $UBUPOR_MIRROR $UBUPOR_DIR >> $LOGDIR/ubuports.log 2>&1
101+
102+if [ $? -ne 0 ]; then
103+ ( echo "Eeek. First rsync to ubuntu broke down... Check logs.."; \
104+ egrep '^write failed|@ERROR' $LOGDIR/ubuports.log ) | mail -s "Ubuntu ports sync failed" $EMAIL
105+ echo "Eeek. First rsync to ubuntu broke down..." >> $LOGDIR/ubuports.log
106+ exit 1
107+fi
108+
109+echo -n "Done at " >> $LOGDIR/ubuports.log
110+date >> $LOGDIR/ubuports.log && echo "" >> $LOGDIR/ubuports.log
111+
112+echo "Second sync without pool..." >> $LOGDIR/ubuports.log
113+rsync -av --timeout=600 --partial --delete --delete-after \
114+ --bwlimit=$SPEED \
115+ --exclude "pool/" --exclude "project/trace/${HOSTNAME}" \
116+ --exclude "Archive-Update-in-Progress-${HOSTNAME}" \
117+ $UBUPOR_EXCLUDE \
118+ $UBUPOR_MIRROR $UBUPOR_DIR >> $LOGDIR/ubuports.log 2>&1
119+
120+if [ $? -ne 0 ]; then
121+ ( echo "Eeek. Second rsync to ubuntu broke down... Check logs.."; \
122+ grep '@ERROR' $LOGDIR/ubuarchive.log ) | mail -s "Ubuntu ports sync failed" $EMAIL
123+ echo "Eeek. Second rsync to ubuntu broke down..." >> $LOGDIR/ubuports.log
124+ exit 2
125+fi
126+
127+find $UBUPOR_DIR -type l -xtype l | xargs -r rm
128+rm -f $LOCK > /dev/null 2>&1
129+date -u > "${UBUPOR_DIR}/project/trace/${HOSTNAME}"

Subscribers

People subscribed via source and target branches

to status/vote changes: