forked from DrHyde/perl-modules-Number-Phone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-data.sh
executable file
·30 lines (26 loc) · 1.2 KB
/
build-data.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
# THIS SHELL SCRIPT IS NOT INTENDED FOR END USERS OR FOR PEOPLE INSTALLING
# THE MODULES, BUT FOR THE AUTHOR'S USE WHEN UPDATING THE DATA FROM OFCOM'S
# AND libphonenumber's PUBLISHED DATA.
# first get OFCOM data
wget -q http://www.ofcom.org.uk/static/numbering/codelist.zip
# if UK/Data.pm doesn't exist, or OFCOM's stuff is newer ...
if test ! -e lib/Number/Phone/UK/Data.pm -o codelist.zip -nt lib/Number/Phone/UK/Data.pm; then
echo rebuilding lib/Number/Phone/UK/Data.pm
unzip -q codelist.zip
perl build-data.uk
cat Data.pm temp.db > lib/Number/Phone/UK/Data.pm
rm s[0123456789]*.txt sabc.txt Data.pm temp.db
else
echo lib/Number/Phone/UK/Data.pm is up-to-date
fi
rm codelist.zip
# now get an up-to-date libphonenumber
(cd libphonenumber && svn -q up) || svn co http://libphonenumber.googlecode.com/svn/trunk libphonenumber
# lib/Number/Phone/NANP/Data.pm doesn't exist, or if libphonenumber/resources/geocoding/en/1.txt is newer ...
if test ! -e lib/Number/Phone/NANP/Data.pm -o libphonenumber/resources/geocoding/en/1.txt -nt lib/Number/Phone/NANP/Data.pm; then
echo rebuilding lib/Number/Phone/NANP/Data.pm
perl build-data.nanp
else
echo lib/Number/Phone/NANP/Data.pm is up-to-date
fi