aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2011-01-07 14:48:51 +0200
committerFilipp Lepalaan <filipp@mac.com>2011-01-07 14:48:51 +0200
commite88df52f6c6509bbb422b18fa1e460199512eda0 (patch)
treee0fe847f44e9320de72584fda68fd4e2c702e9b9
parent5e8fac29dae670a4d83a67d4394b9d7cb46afdb9 (diff)
downloadmtk-e88df52f6c6509bbb422b18fa1e460199512eda0.tar.gz
mtk-e88df52f6c6509bbb422b18fa1e460199512eda0.tar.bz2
mtk-e88df52f6c6509bbb422b18fa1e460199512eda0.zip
Added sumirror.sh
-rw-r--r--sumirror.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/sumirror.sh b/sumirror.sh
new file mode 100644
index 0000000..695266f
--- /dev/null
+++ b/sumirror.sh
@@ -0,0 +1,50 @@
+#! /usr/bin/env bash
+# pull software update server content
+# @author Filipp Lepalaan <filipp@mcare.fi>
+# @package mtk
+
+if [[ $# -lt 4 ]]
+then
+ echo "usage: $(basename $0) server repo port destination" 2>&1
+ exit 1
+fi
+
+MAC_SERVER=$1
+REMOTE_REPO=$2
+REMOTE_PORT=$3
+LOCAL_DOCROOT=$4
+HOSTNAME=$(hostname)
+
+if [[ ! -d "${LOCAL_DOCROOT}" ]];
+then
+ echo "Invalid local document root: ${LOCAL_DOCROOT}" 2>&1
+ exit 1
+fi
+
+# download latest update packages, removing deprecated
+rsync -av --delete rsync://${MAC_SERVER}:${REMOTE_PORT}/${REMOTE_REPO} ${LOCAL_DOCROOT}
+
+if [[ ! $? ]]
+then
+ echo "Failed to fetch software update content" 2>&1
+ exit 1
+fi
+
+# update hostnames in catalog files
+find ${LOCAL_DOCROOT} -name *.sucatalog -type f -exec sed -i '' "s/${MAC_SERVER}:8088/${HOSTNAME}/g" {} \;
+
+# rebuild symlinks
+cd ${LOCAL_DOCROOT}
+rm ./index*
+ln -s ./content/catalogs/others/index-leopard-snowleopard.merged-1.sucatalog ./index-leopard-snowleopard.merged-1.sucatalog
+ln -s ./content/catalogs/others/index-leopard.merged-1.sucatalog ./index-leopard.merged-1.sucatalog
+ln -s ./content/catalogs/index.sucatalog ./index.sucatalog
+
+# 10.4 seems to need this
+ln -s ./content/catalogs/index.sucatalog ./content/catalogs/index-1.sucatalog
+
+# One more hack for 10.4
+mkdir ${LOCAL_DOCROOT}/scanningpoints
+curl -o ${LOCAL_DOCROOT}/scanningpoints/scanningpointX.xml http://17.250.248.95/scanningpoints/scanningpointX.xml
+
+exit 0