diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..89f9ac0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +out/ diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..be80a09 --- /dev/null +++ b/Rakefile @@ -0,0 +1,48 @@ +require 'yaml' + +CONFIGURATIONS = YAML.load_file('configurations.yml')['configurations'] +CONFIG_DIR = File.expand_path(File.dirname(__FILE__)) +OUT_DIR = File.expand_path(File.join(File.dirname(__FILE__), "out")) + +task :mixins, [:name] do |t, args| + CONFIGURATIONS[args.name]['mixins'].each do |mixin| + `cp -rp #{CONFIG_DIR}/files/#{mixin}/* #{OUT_DIR}/#{args.name}/files` + end +end + +task :wifi, [:name] do |t, args| + config_path = File.join(OUT_DIR, args.name, "/files/etc/config/wireless") + wlans = CONFIGURATIONS[args.name]['wlans'] + wlan_config = File.read(config_path) + + wlans.each do |id, wlan| + wlan_config.sub!("", wlan['channel'].to_s) + wlan_config.sub!("", wlan['bssid'].to_s) + end + wlan_config.gsub!("# option channel", " option channel") + wlan_config.gsub!("# option macaddr", " option macaddr") + + File.open(config_path, 'w') do |f| + f.puts wlan_config + end +end + +task :hostname, [:name] do |t, args| + `sed -i "s//#{args.name}/g" #{OUT_DIR}/#{args.name}/files/etc/config/system` +end + +task :config, [:name] do |t, args| + config = CONFIGURATIONS[args.name]['config'] + `cp #{File.join(CONFIG_DIR, "%s.configdiff" % config)} #{File.join(OUT_DIR, args.name)}` +end + +task :outdir, [:name] do |t, args| + `mkdir -p #{File.join(OUT_DIR, args.name, 'files')}` +end + +desc 'shit' +task :ap, [:name] => [:outdir, :mixins, :hostname, :wifi] + +task :all do + Rake::Task["ap"].invoke 'ap-bulgaria-1-ac' +end diff --git a/configurations.yml b/configurations.yml new file mode 100644 index 0000000..949a0fb --- /dev/null +++ b/configurations.yml @@ -0,0 +1,171 @@ +--- +configurations: + ap-bulgaria-1-ac: + config: archer-c5 + wlans: + 0: + bssid: 02:00:0f:20:15:00 + channel: 36 + 1: + bssid: 02:00:0f:20:15:01 + channel: 1 + mixins: + - all + - archer-c5 + - archer-c5-dual-trunk + ap-bulgaria-2-ac: + config: archer-c5 + wlans: + 0: + bssid: 02:00:0f:20:15:10 + channel: 52 + 1: + bssid: 02:00:0f:20:15:11 + channel: 9 + mixins: + - all + - archer-c5 + - archer-c5-dual-trunk + ap-bulgaria-3-ac: + config: archer-c5 + wlans: + 0: + bssid: 02:00:0f:20:15:20 + channel: 116 + 1: + bssid: 02:00:0f:20:15:21 + channel: 13 + mixins: + - all + - archer-c5 + - archer-c5-triple-trunk + ap-bulgaria-4-legacy: + config: wr1043-nd + wlans: + 0: + bssid: 02:00:0f:20:15:30 + channel: 5 + mixins: + - all + ap-chamber-1-ac: + config: archer-c5 + wlans: + 0: + bssid: 02:00:0f:20:15:40 + channel: 36 + 1: + bssid: 02:00:0f:20:15:41 + channel: 1 + mixins: + - all + - archer-c5 + - archer-c5-single-trunk + ap-chamber-2-ac: + config: archer-c5 + wlans: + 0: + bssid: 02:00:0f:20:15:50 + channel: 116 + 1: + bssid: 02:00:0f:20:15:51 + channel: 13 + mixins: + - all + - archer-c5 + - archer-c5-single-trunk + ap-music-1-ac: + config: archer-c5 + wlans: + 0: + bssid: 02:00:0f:20:15:60 + channel: 36 + 1: + bssid: 02:00:0f:20:15:61 + channel: 1 + mixins: + - all + - archer-c5 + - archer-c5-single-trunk + ap-marble-1-ac: + config: archer-c5 + wlans: + 0: + bssid: 02:00:0f:20:15:70 + channel: 36 + 1: + bssid: 02:00:0f:20:15:71 + channel: 1 + mixins: + - all + - archer-c5 + - archer-c5-single-trunk + ap-lobby1-1-an: + config: wdr4300 + wlans: + 0: + bssid: 02:00:0f:20:15:80 + channel: 13 + 1: + bssid: 02:00:0f:20:15:81 + channel: 100 + mixins: + - all + - wdr-4300 + - wdr-4300-single-trunk + ap-lobby1-2-legacy: + config: rs + wlans: + 0: + bssid: 02:00:0f:20:15:90 + channel: 5 + mixins: + - all + - legacy-normal + ap-lobby1-3-an: + config: wdr4300 + wlans: + 0: + bssid: 02:00:0f:20:15:a0 + channel: 9 + 1: + bssid: 02:00:0f:20:15:a1 + channel: 108 + mixins: + - all + - wdr-4300 + - wdr-4300-single-trunk + ap-lobby2-1-an: + config: wdr4300 + wlans: + 0: + bssid: 02:00:0f:20:15:b0 + channel: 13 + 1: + bssid: 02:00:0f:20:15:b1 + channel: 100 + mixins: + - all + - wdr-4300 + - wdr-4300-dual-trunk + ap-lobby2-2-legacy: + config: wr841nd + wlans: + 0: + bssid: 02:00:0f:20:15:c0 + channel: 5 + mixins: + - all + - legacy-small + ap-lobby2-3-an: + config: wdr4300 + wlans: + 0: + bssid: 02:00:0f:20:15:d0 + channel: 1 + 1: + bssid: 02:00:0f:20:15:d1 + channel: 108 + mixins: + - all + - wdr-4300 + - wdr-4300-single-trunk \ No newline at end of file