]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/updateinterwikimap
split is deprecated, replace with explode
[SourceForge/phpwiki.git] / lib / updateinterwikimap
1 #!/bin/sh
2 # updateinterwikimap
3 currentfile=interwiki.map
4 backupfile=/tmp/${currentfile}.bak
5 downloadfile=/tmp/intermap.txt
6 newfile=/tmp/${currentfile}
7 tempfile=/tmp/intermap.tmp
8
9 echo "Downloading latest InterWikiMap from PhpWiki CVS"
10 cvs up ${currentfile}
11
12 echo "Downloading latest InterWikiMap from Usemod"
13 curl http://usemod.com/intermap.txt -o ${downloadfile}
14
15 echo "Backing up current ${currentfile} to ${backupfile}"
16 cp -p ${currentfile} ${backupfile}
17
18 echo "merging ${downloadfile} with installed ${currentfile}"
19 cat ${downloadfile} > ${tempfile}
20 cat ${backupfile} >> ${tempfile}
21 cat ${tempfile} | sort -f | uniq > ${newfile}
22
23 echo "Installing updated InterWikiMap"
24 install -m 0644 ${newfile} ${currentfile}
25 rm ${downloadfile} ${tempfile} ${newfile}
26
27 echo "The following new InterWikiMap entries were found:"
28 diff -u0 ${backupfile} ${currentfile}
29
30 echo "Comparing with PhpWiki CVS:"
31 cvs diff ${currentfile}
32
33 echo "*** You must check ${currentfile} for duplicates or other problems. ***"
34 echo "*** The backup file is: ${backupfile}. ***"
35
36 echo "Done."