From 5b6f780d2cfbfd6949e102acfcd09bd8e5689305 Mon Sep 17 00:00:00 2001 From: Franz Pletz Date: Fri, 12 Aug 2016 21:12:34 +0200 Subject: [PATCH] Move to utils folder, generate site-select makefile --- extra/make_siteconfs.sh | 10 ---------- extra/stadtteile_idx.txt | 35 ----------------------------------- util/make_siteconfs.sh | 25 +++++++++++++++++++++++++ util/makefile_prefix | 36 ++++++++++++++++++++++++++++++++++++ util/makefile_suffix | 6 ++++++ util/stadtteile_idx.txt | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 100 insertions(+), 45 deletions(-) delete mode 100755 extra/make_siteconfs.sh delete mode 100644 extra/stadtteile_idx.txt create mode 100755 util/make_siteconfs.sh create mode 100644 util/makefile_prefix create mode 100644 util/makefile_suffix create mode 100644 util/stadtteile_idx.txt diff --git a/extra/make_siteconfs.sh b/extra/make_siteconfs.sh deleted file mode 100755 index bf57d1e..0000000 --- a/extra/make_siteconfs.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -[ -e new ] || mkdir new - -cat stadtteile_idx.txt|grep -e '^[^#]'|grep -v LK_|while IFS=, read nr id desc port; do cp ffmuc.conf new/ffmuc_$id.conf; done -cat stadtteile_idx.txt|grep -e '^[^#]'|grep LK_|while IFS=, read nr id desc port; do cp ffmuc_umland.conf new/ffmuc_$id.conf; done - -cat stadtteile_idx.txt|grep -e '^[^#]'|while IFS=, read nr id desc seg_id port; do ( echo "# processing ffmuc_$id.conf"; cat new/ffmuc_$id.conf |sed -e "s/port 100[01][0-9]/port $port/" |sed -e "s/.*site_code.*/ site_code = 'ffmuc_$id',/g"|sed -e "s/.*site_name.*/ site_name = 'Freifunk München - $desc',/g" > new/ffmuc_$id.conf.new; mv new/ffmuc_$id.conf.new new/ffmuc_$id.conf); done - - diff --git a/extra/stadtteile_idx.txt b/extra/stadtteile_idx.txt deleted file mode 100644 index 8ab46ec..0000000 --- a/extra/stadtteile_idx.txt +++ /dev/null @@ -1,35 +0,0 @@ -#idx,id,description,segment_id,port -1,M_Altstadt,Altstadt-Lehel,0,10021 -2,M_Ludwigsvorstadt,Ludwigsvorstadt-Isarvorstadt,0,10022 -3,M_Maxvorstadt,Maxvorstadt,0,10023 -4,M_Schwabing_West,Schwabing-West,0,10024 -5,M_Au,Au-Haidhausen,0,10025 -6,M_Sendling,Sendling,0,10026 -7,M_Sendl_Westpark,Sendling-Westpark,0,10027 -8,M_Schwanthalerhoehe,Schwanthalerhöhe,0,10028 -9,M_Neuhausen,Neuhausen-Nymphenburg,0,10029 -10,M_Moosach,Moosach,0,10030 -11,M_Milbertshofen,Milbertshofen-Am-Hart,0,10031 -12,M_Schwabing_Freimann,Schwabing-Freimann,0,10032 -13,M_Bogenhausen,Bogenhausen,0,10033 -14,M_BergAmLaim,Berg am Laim,0,10034 -15,M_Trudering,Trudering-Riem,0,10035 -16,M_Ramersdorf,Ramersdorf-Perlach,0,10036 -17,M_Obergiesing,Obergiesing-Fasangarten,0,10037 -18,M_Untergiesing,Untergiesing-Harlaching,0,10038 -19,M_Thalkirchen,Thalkirchen-Obersendling-Forstenried-Fürstenried-Solln,0,10039 -20,M_Hadern,Hadern,0,10040 -21,M_Pasing,Pasing-Obermenzing,0,10041 -22,M_Aubing,Aubing-Lochhausen-Langwied,0,10042 -23,M_Allach,Allach-Untermenzing,0,10043 -24,M_Feldmoching,Feldmoching-Hasenbergl,0,10044 -25,M_Laim,Laim,0,10045 -26,LK_M_Land,München-Land,1,10046 -27,LK_STA,Landkreis Starnberg (STA),1,10047 -28,LK_FFB,Landkreis Fürstenfeldbruck (FFB),1,10048 -29,LK_DAH,Landkreis Dachau (DAH),1,10049 -30,LK_FS,Landkreis Freising (FS),1,10050 -31,LK_ED,Landkreis Erding (ED),1,10061 -32,LK_EBE,Landkreis Ebersberg (EBE),1,10062 -33,LK_TOEL,Landkreis Bad Tölz-Wolfratshausen (TÖL),1,10063 -34,LK_Outback,Alle weiteren Landkreise,1,10064 diff --git a/util/make_siteconfs.sh b/util/make_siteconfs.sh new file mode 100755 index 0000000..a26f45e --- /dev/null +++ b/util/make_siteconfs.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +[ -e new ] || mkdir new + +cat makefile_prefix > new/Makefile-site-select + +cat stadtteile_idx.txt|grep -e '^[^#]'|grep -v LK_|while IFS=, read nr id desc port prefix4; do cp ../extra/ffmuc.conf new/ffmuc_$id.conf; done +cat stadtteile_idx.txt|grep -e '^[^#]'|grep LK_|while IFS=, read nr id desc port prefix4; do cp ../extra/ffmuc_umland.conf new/ffmuc_$id.conf; done + +cat stadtteile_idx.txt | grep -e '^[^#]' \ + | while IFS=, read nr id desc seg_id port prefix4 prefix6 next_node4 next_node6; do ( + echo "# processing ffmuc_$id.conf"; + cat new/ffmuc_$id.conf | sed -e "s/port 100[01][0-9]/port $port/" \ + | sed -e "s/.*site_code.*/ site_code = 'ffmuc_$id',/g" \ + | sed -e "s/.*site_name.*/ site_name = 'Freifunk München - $desc',/g" \ + | sed -e "s/.*ip4.*/ ip4 = '$next_node4',/g" \ + | sed -e "s@.*prefix4.*@ prefix4 = '$prefix4',@g" \ + | sed -e "s@.*prefix6.*@ prefix6 = '$prefix6',@g" \ + | sed -e "s/.ip6.*/ ip6 = '$next_node6',/g" > new/ffmuc_$id.conf.new; + mv new/ffmuc_$id.conf.new new/ffmuc_$id.conf; + echo " lua -e 'print(require(\"cjson\").encode(assert(loadfile(\"site_config.lua\")(\"\$(GLUON_SITEDIR)/extra/ffmuc_$id.conf\"))))' > \$(1)/lib/gluon/site-select/ffmuc_$id.json" >> new/Makefile-site-select + ); \ + done + +cat makefile_suffix >> new/Makefile-site-select diff --git a/util/makefile_prefix b/util/makefile_prefix new file mode 100644 index 0000000..3d33263 --- /dev/null +++ b/util/makefile_prefix @@ -0,0 +1,36 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-config-mode-site-select +PKG_VERSION:=0.2 +PKG_RELEASE:=1 + +PKG_BUILD_DEPENDS := lua-cjson/host + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG) + +define Package/gluon-config-mode-site-select + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=UI for changing the node-config +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile + $(call GluonBuildI18N,gluon-config-mode-site-select,i18n) +endef + +define Package/gluon-config-mode-site-select/install + mkdir -p $(1)/etc/config/ + mkdir -p $(1)/lib/gluon/site-select/ + $(CP) ./files/* $(1)/ + diff --git a/util/makefile_suffix b/util/makefile_suffix new file mode 100644 index 0000000..5c7bec3 --- /dev/null +++ b/util/makefile_suffix @@ -0,0 +1,6 @@ + DIR=$(1) sh create-config.sh + + $(call GluonInstallI18N,gluon-config-mode-site-select,$(1)) +endef + +$(eval $(call BuildPackage,gluon-config-mode-site-select)) diff --git a/util/stadtteile_idx.txt b/util/stadtteile_idx.txt new file mode 100644 index 0000000..0536eb0 --- /dev/null +++ b/util/stadtteile_idx.txt @@ -0,0 +1,33 @@ +#idx,id,description,segment_id,port,prefix4,prefix6,next_node4,next_node6 +1,M_Altstadt,Altstadt-Lehel,0,10021,10.80.132.0/22,fdef:ffc0:4fff:3::/64,10.80.132.1,fdef:ffc0:4fff:3::1 +2,M_Ludwigsvorstadt,Ludwigsvorstadt-Isarvorstadt,0,10022,10.80.164.0/22,fdef:ffc0:4fff:4::/64,10.80.164.1,fdef:ffc0:4fff:4::1 +3,M_Maxvorstadt,Maxvorstadt,0,10023,10.80.168.0/22,fdef:ffc0:4fff:5::/64,10.80.168.1,fdef:ffc0:4fff:5::1 +4,M_Schwabing_West,Schwabing-West,0,10024,10.80.200.0/22,fdef:ffc0:4fff:6::/64,10.80.200.1,fdef:ffc0:4fff:6::1 +5,M_Au,Au-Haidhausen,0,10025,10.80.136.0/22,fdef:ffc0:4fff:7::/64,10.80.136.1,fdef:ffc0:4fff:7::1 +6,M_Sendling,Sendling,0,10026,10.80.212.0/22,fdef:ffc0:4fff:8::/64,10.80.212.1,fdef:ffc0:4fff:8::1 +7,M_Sendl_Westpark,Sendling-Westpark,0,10027,10.80.208.0/22,fdef:ffc0:4fff:9::/64,10.80.208.1,fdef:ffc0:4fff:9::1 +8,M_Schwanthalerhoehe,Schwanthalerhöhe,0,10028,10.80.204.0/22,fdef:ffc0:4fff:a::/64,10.80.204.1,fdef:ffc0:4fff:a::1 +9,M_Neuhausen,Neuhausen-Nymphenburg,0,10029,10.80.180.0/22,fdef:ffc0:4fff:b::/64,10.80.180.1,fdef:ffc0:4fff:b::1 +10,M_Moosach,Moosach,0,10030,10.80.176.0/22,fdef:ffc0:4fff:c::/64,10.80.176.1,fdef:ffc0:4fff:c::1 +11,M_Milbertshofen,Milbertshofen-Am-Hart,0,10031,10.80.172.0/22,fdef:ffc0:4fff:d::/64,10.80.172.1,fdef:ffc0:4fff:d::1 +12,M_Schwabing_Freimann,Schwabing-Freimann,0,10032,10.80.196.0/22,fdef:ffc0:4fff:e::/64,10.80.196.1,fdef:ffc0:4fff:e::1 +13,M_Bogenhausen,Bogenhausen,0,10033,10.80.148.0/22,fdef:ffc0:4fff:f::/64,10.80.148.1,fdef:ffc0:4fff:f::1 +14,M_BergAmLaim,Berg am Laim,0,10034,10.80.144.0/22,fdef:ffc0:4fff:10::/64,10.80.144.1,fdef:ffc0:4fff:10::1 +15,M_Trudering,Trudering-Riem,0,10035,10.80.220.0/22,fdef:ffc0:4fff:11::/64,10.80.220.1,fdef:ffc0:4fff:11::1 +16,M_Ramersdorf,Ramersdorf-Perlach,0,10036,10.80.192.0/22,fdef:ffc0:4fff:12::/64,10.80.192.1,fdef:ffc0:4fff:12::1 +17,M_Giesing,Giesing,0,10037,10.80.184.0/22,fdef:ffc0:4fff:13::/64,10.80.184.1,fdef:ffc0:4fff:13::1 +18,M_Thalkirchen,Thalkirchen-Obersendling-Forstenried-Fürstenried-Solln,0,10039,10.80.216.0/22,fdef:ffc0:4fff:15::/64,10.80.216.1,fdef:ffc0:4fff:15::1 +29,M_Hadern,Hadern,0,10040,10.80.156.0/22,fdef:ffc0:4fff:16::/64,10.80.156.1,fdef:ffc0:4fff:16::1 +20,M_Pasing,Pasing-Obermenzing,0,10041,10.80.188.0/22,fdef:ffc0:4fff:17::/64,10.80.188.1,fdef:ffc0:4fff:17::1 +21,M_Aubing,Aubing-Lochhausen-Langwied,0,10042,10.80.140.0/22,fdef:ffc0:4fff:18::/64,10.80.140.1,fdef:ffc0:4fff:18::1 +22,M_Allach,Allach-Untermenzing,0,10043,10.80.128.0/22,fdef:ffc0:4fff:19::/64,10.80.128.1,fdef:ffc0:4fff:19::1 +23,M_Feldmoching,Feldmoching-Hasenbergl,0,10044,10.80.152.0/22,fdef:ffc0:4fff:1a::/64,10.80.152.1,fdef:ffc0:4fff:1a::1 +24,M_Laim,Laim,0,10045,10.80.160.0/22,fdef:ffc0:4fff:1b::/64,10.80.160.1,fdef:ffc0:4fff:1b::1 +25,LK_M_Land,München-Land,1,10046,10.80.24.0/21,fdef:ffc0:4fff:1c::/64,10.80.24.1,fdef:ffc0:4fff:1c::1 +26,LK_STA,Landkreis Starnberg (STA),1,10047,10.80.0.0/21,fdef:ffc0:4fff:1d::/64,10.80.0.1,fdef:ffc0:4fff:1d::1 +27,LK_FFB,Landkreis Fürstenfeldbruck (FFB),1,10048,10.80.232.0/21,fdef:ffc0:4fff:1e::/64,10.80.232.1,fdef:ffc0:4fff:1e::1 +28,LK_DAH,Landkreis Dachau (DAH),1,10049,10.80.248.0/21,fdef:ffc0:4fff:1f::/64,10.80.248.1,fdef:ffc0:4fff:1f::1 +39,LK_FS,Landkreis Freising (FS),1,10050,10.80.224.0/21,fdef:ffc0:4fff:20::/64,10.80.224.1,fdef:ffc0:4fff:20::1 +30,LK_ED,Landkreis Erding (ED),1,10061,10.80.16.0/21,fdef:ffc0:4fff:21::/64,10.80.16.1,fdef:ffc0:4fff:21::1 +31,LK_EBE,Landkreis Ebersberg (EBE),1,10062,10.80.240.0/21,fdef:ffc0:4fff:22::/64,10.80.240.1,fdef:ffc0:4fff:22::1 +32,LK_TOEL,Landkreis Bad Tölz-Wolfratshausen (TÖL),1,10063,10.80.8.0/21,fdef:ffc0:4fff:23::/64,10.80.8.1,fdef:ffc0:4fff:23::1