Skip to content

Commit

Permalink
Add an overrideMAC option to allow specifying a site ID manually.
Browse files Browse the repository at this point in the history
  • Loading branch information
mutability committed Jan 27, 2015
1 parent 4c0d219 commit 53a2906
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
piaware-mutability (1.19-3mu-2) unstable; urgency=medium

* Add an overrideMAC option to allow specifying a site ID manually.

-- Oliver Jowett <oliver@mutability.co.uk> Tue, 27 Jan 2015 13:07:37 +0000

piaware-mutability (1.19-3mu-1) unstable; urgency=medium

* Merge changes from upstream 1.19-{1,2,3} releases.
Expand Down
8 changes: 8 additions & 0 deletions debian/piaware-mutability.config
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ if [ -e $ADEPTCONFIGFILE ]; then
sendLogMessages) db_set_01 $NAME/allow-log-messages "$val" ;;
user) db_set $NAME/flightaware-user "$val" ;;
password) db_set $NAME/flightaware-password "$val" ;;
overrideMAC) db_set $NAME/site-id "$val" ;;
*) echo "Warning: unhandled adept config key: $key" >&2 ;;
esac
done
Expand Down Expand Up @@ -102,6 +103,11 @@ is_not_empty() {
if [ -z "$1" ]; then return 1; else return 0; fi
}

is_empty_or_mac() {
if [ -z "$1" ]; then return 0; fi
if echo "$1" | grep -Eq '^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$'; then return 0; else return 1; fi
}

db_input high $NAME/auto-start || true

db_go || true; db_get $NAME/auto-start; if [ "$RET" = "true" ]; then
Expand All @@ -117,6 +123,8 @@ db_go || true; db_get $NAME/auto-start; if [ "$RET" = "true" ]; then
db_set $NAME/flightaware-password ""
fi

db_input_verify low $NAME/site-id is_empty_or_mac || true

db_input medium $NAME/allow-auto-updates || true
db_input medium $NAME/allow-manual-updates || true

Expand Down
1 change: 1 addition & 0 deletions debian/piaware-mutability.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ case "$1" in
set_adept_config_bool allow-manual-updates manualUpdate
set_adept_config_bool allow-health-info sendHealthInfo
set_adept_config_bool allow-log-messages sendLogMessages
set_adept_config_str site-id overrideMAC
mv $ADEPTCONFIGFILE.tmp $ADEPTCONFIGFILE

# remove the password from the config DB
Expand Down
20 changes: 20 additions & 0 deletions debian/piaware-mutability.templates
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@ Description: FlightAware password:
Type: password
Default:

Template: piaware-mutability/site-id
Description: Site ID / MAC address (blank to use default):
FlightAware identifies your site by the MAC address of the main network
interface of the machine running piaware. If you change hardware, the
MAC address may change and therefore FlightAware will see the feeder as
a brand new site.
.
To retain your site history, here you can override the site ID with an
address of your own choice. It should be a MAC address in the form
aa:bb:cc:dd:ee:ff. You can find the existing site ID from the FlightAware
"My ADS-B" page, listed as "Site Identifier".
.
If left blank, the site ID is derived from the main network interface.
Type: string
Default:

Template: piaware-mutability/allow-auto-updates
Description: Allow automatic updates triggered by FlightAware?
piaware can process automatic update requests from FlightAware to update
Expand Down Expand Up @@ -124,3 +140,7 @@ Default: true
Template: piaware-mutability/invalid-is_not_empty
Description: Value cannot be empty.
Type: error

Template: piaware-mutability/invalid-is_empty_or_mac
Description: MAC address should either be blank, or in the form 01:23:45:67:89:ab.
Type: error
4 changes: 4 additions & 0 deletions package/fa_adept_client.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,10 @@ namespace eval ::fa_adept {
# if we can't find any mac address at all then return an empty string
#
method get_mac_address {} {
if {[info exists ::adeptConfig(overrideMAC)]} {
return $::adeptConfig(overrideMAC)
}

if {[info exists ::macAddress]} {
return $::macAddress
}
Expand Down

0 comments on commit 53a2906

Please sign in to comment.