From cd89873748acbfb7f32f22bd868ffa136b712616 Mon Sep 17 00:00:00 2001 From: Diederik de Groot Date: Wed, 15 Nov 2017 16:27:40 +0100 Subject: [PATCH] Move some files to tools directory Added locales/countries/United_States Update Makefile Fix nginx tftpboot --- Makefile | 13 +- etc/nginx/sites-available/tftpboot | 26 +- .../countries/United_States/7960-tones.xml | 28 + .../countries/United_States/g3-tones.xml | 59 ++ .../countries/United_States/g4-tones.xml | 59 ++ .../countries/United_States/gateway-tones.xml | 894 ++++++++++++++++++ generate.py => tools/generate.py | 20 +- requirements.txt => tools/requirements.txt | 0 8 files changed, 1079 insertions(+), 20 deletions(-) create mode 100644 tftpboot/locales/countries/United_States/7960-tones.xml create mode 100644 tftpboot/locales/countries/United_States/g3-tones.xml create mode 100644 tftpboot/locales/countries/United_States/g4-tones.xml create mode 100644 tftpboot/locales/countries/United_States/gateway-tones.xml rename generate.py => tools/generate.py (64%) rename requirements.txt => tools/requirements.txt (100%) diff --git a/Makefile b/Makefile index 1d779d5..2dd7951 100644 --- a/Makefile +++ b/Makefile @@ -5,14 +5,15 @@ PYTHON := /usr/bin/env python .PHONY: bootstrap clean .DEFAULT_GOAL := all -all: .requirements_satisfied - @$(PYTHON) generate.py +all: -bootstrap: - @$(PIP) install --user -r requirements.txt +bootstrap: .requirements_satisfied tools/generate.py + @echo "running generate" + @$(PYTHON) tools/generate.py -.requirements_satisfied: - $(MAKE) bootstrap +.requirements_satisfied: tools/requirements.txt + @echo "checking requirements" + @$(PIP) install --user -r tools/requirements.txt @touch $@ clean: diff --git a/etc/nginx/sites-available/tftpboot b/etc/nginx/sites-available/tftpboot index ac92037..26182ec 100644 --- a/etc/nginx/sites-available/tftpboot +++ b/etc/nginx/sites-available/tftpboot @@ -15,10 +15,21 @@ server { error_log /var/log/nginx/tftp.error.log notice; location / { - rewrite ^/((.*).cnf.xml)$ /settings/$1 last; - rewrite ^/((.*).(bin|bin.|loads|LOADS|sbn|SBN|sb2|sbin|zz|zup)(|.sgn))$ /firmware/$1 last; - rewrite ^/([D|d]istinctive)?([R|r]ing[L|l]ist).(xml|XML)(.sgn)?$ /ringtones/ringlist.xml last; - #rewrite ^/((.*)(.raw|pcm)(|.sgn))$ /ringtones/$1 last; + # settings + rewrite ^/((.*)(\.cnf\.xml|\.tlv))$ /settings/$1 last; + + # firmware + rewrite ^/((.*).(bin|bin.|loads|LOADS|sbn|SBN|sb2|sbin|zz|zup)(|\.sgn))$ /firmware/$1 last; + + # locales + rewrite ^/(.*)/((.*)-tones\.xml)$ /locales/countries/$1/$2 last; + rewrite ^/(.*)/((.*)(-dictionary\.xml|\.jar))$ /locales/languages/$1/$2 last; + + # ringtones + rewrite ^/([D|d]istinctive)?([R|r]ing[L|l]ist)\.(xml|XML)(\.sgn)?$ /ringtones/ringlist.xml last; + #rewrite ^/((.*)(\.raw|\.pcm)(|\.sgn))$ /ringtones/$1 last; + + # wallpapers rewrite ^/Desktops/(.*)/(.*)$ /wallpapers/$1/$2 last; try_files $uri $uri/ =404; autoindex off; @@ -204,6 +215,13 @@ server { autoindex off; } + # locales + + location /locales { + try_files $uri $uri/ =404; + autoindex off; + } + # ringtones location /ringtones { try_files $uri $uri/ =404; diff --git a/tftpboot/locales/countries/United_States/7960-tones.xml b/tftpboot/locales/countries/United_States/7960-tones.xml new file mode 100644 index 0000000..1a81319 --- /dev/null +++ b/tftpboot/locales/countries/United_States/7960-tones.xml @@ -0,0 +1,28 @@ + +Netherlands +/main/3.3.release/1 +0 + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tftpboot/locales/countries/United_States/g3-tones.xml b/tftpboot/locales/countries/United_States/g3-tones.xml new file mode 100644 index 0000000..67935f7 --- /dev/null +++ b/tftpboot/locales/countries/United_States/g3-tones.xml @@ -0,0 +1,59 @@ + +Netherlands +/main/3.3.release/1 +0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tftpboot/locales/countries/United_States/g4-tones.xml b/tftpboot/locales/countries/United_States/g4-tones.xml new file mode 100644 index 0000000..67935f7 --- /dev/null +++ b/tftpboot/locales/countries/United_States/g4-tones.xml @@ -0,0 +1,59 @@ + +Netherlands +/main/3.3.release/1 +0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tftpboot/locales/countries/United_States/gateway-tones.xml b/tftpboot/locales/countries/United_States/gateway-tones.xml new file mode 100644 index 0000000..16551d7 --- /dev/null +++ b/tftpboot/locales/countries/United_States/gateway-tones.xml @@ -0,0 +1,894 @@ + + Netherlands + /main/seaview/2 + + gateway tones + 35 + -90 + -90 + alaw + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + 1 + 0 + 425 + 0 + 0 + 0 + + -200 + -200 + -200 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 500 + 500 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 1 + 0 + 425 + 0 + 0 + 0 + + -110 + -110 + -110 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 1000 + 4000 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 1 + 0 + 425 + 0 + 0 + 0 + + -200 + -200 + -200 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 250 + 250 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 1 + 0 + 425 + 0 + 0 + 0 + + -200 + -200 + -200 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 250 + 250 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 1 + 0 + 425 + 0 + 0 + 0 + + -150 + -150 + -150 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 65535 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 1 + 0 + 425 + 0 + 0 + 0 + + -150 + -150 + -150 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 65535 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 1 + 0 + 950 + 0 + 0 + 0 + + -150 + -150 + -150 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 330 + 330 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 1 + 0 + 600 + 0 + 0 + 0 + + -240 + -240 + -240 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 125 + 125 + 125 + 65535 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 1 + 0 + 600 + 0 + 0 + 0 + + -150 + -150 + -150 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 330 + 330 + 330 + 65535 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 2 + 0 + 1400 + 2040 + 0 + 0 + + -240 + -240 + -240 + + + -240 + -240 + -240 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 100 + 100 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 2 + 0 + 1400 + 2040 + 0 + 0 + + -150 + -150 + -185 + + + -150 + -150 + -185 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 100 + 100 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 2 + 0 + 400 + 450 + 0 + 0 + + -150 + -150 + -150 + + + -150 + -150 + -150 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 500 + 9500 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 1 + 0 + 950 + 0 + 0 + 0 + + -170 + -170 + -190 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 100 + 100 + 100 + 65535 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 1 + 0 + 600 + 0 + 0 + 0 + + -170 + -170 + -190 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 100 + 100 + 100 + 65535 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 2 + 0 + 400 + 450 + 0 + 0 + + -150 + -150 + -150 + + + -150 + -150 + -150 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 500 + 55 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 1 + 0 + 480 + 0 + 0 + 0 + + -170 + -170 + -170 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 65535 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + + + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + diff --git a/generate.py b/tools/generate.py similarity index 64% rename from generate.py rename to tools/generate.py index ce032be..ea9a5c8 100644 --- a/generate.py +++ b/tools/generate.py @@ -22,15 +22,15 @@ def generate_nginx_rules(regex, dirname, outfile): if __name__ == '__main__': rootdir = "./tftpboot/firmware/" - tftpd_rules = open("etc/tftpd-hpa/tftpd.rules", "w") - nginx_rules = open("etc/nginx/sites-available/nginx.rules", "w") - - for subdir in next(os.walk(rootdir))[1]: - regex = generate_regex(os.path.join(rootdir, subdir)) - generate_tftpd_rules(regex, os.path.basename(subdir), tftpd_rules) - generate_nginx_rules(regex, os.path.basename(subdir), nginx_rules) - - tftpd_rules.close(); - nginx_rules.close(); +# tftpd_rules = open("etc/tftpd-hpa/tftpd.rules", "w") +# nginx_rules = open("etc/nginx/sites-available/nginx.rules", "w") +# +# for subdir in next(os.walk(rootdir))[1]: +# regex = generate_regex(os.path.join(rootdir, subdir)) +# generate_tftpd_rules(regex, os.path.basename(subdir), tftpd_rules) +# generate_nginx_rules(regex, os.path.basename(subdir), nginx_rules) +# +# tftpd_rules.close(); +# nginx_rules.close(); #app.debug = os.environ.get('FLASK_DEBUG', True) #print config.get["scopes"] \ No newline at end of file diff --git a/requirements.txt b/tools/requirements.txt similarity index 100% rename from requirements.txt rename to tools/requirements.txt