1#!/bin/sh
2
3STAGE=$1
4
5print_syntax() {
6    echo "	proper syntax is \"${0} <stage>\", where <stage> is one of the following: dev, firmware-dev, integration"
7    return 0
8}
9
10
11load_xagent_dev_urls() {
12    nvram set x_discovery_url="https://presence.dev.ngxcld.com/presence/presence"
13    nvram set x_register_url="https://registration.dev.ngxcld.com/registration/register"
14    nvram set x_claimed_url="https://registration.dev.ngxcld.com/registration/status"
15    nvram set x_advisor_url="https://advisor.dev.ngxcld.com/advisor/direct"
16    return 0
17}
18
19
20load_xagent_qa_urls() {
21    nvram set x_discovery_url="https://presence.qa.ngxcld.com/presence/presence"
22    nvram set x_register_url="https://registration.qa.ngxcld.com/registration/register"
23    nvram set x_claimed_url="https://registration.qa.ngxcld.com/registration/status"
24    nvram set x_advisor_url="https://advisor.qa.ngxcld.com/advisor/direct"
25    return 0
26}
27
28
29load_xagent_production_urls() {
30    nvram set x_discovery_url="https://presence.ngxcld.com/presence/presence"
31    nvram set x_register_url="https://registration.ngxcld.com/registration/register"
32    nvram set x_claimed_url="https://registration.ngxcld.com/registration/status"
33    nvram set x_advisor_url="https://advisor.ngxcld.com/advisor/direct"
34    return 0
35}
36
37
38case ${STAGE} in
39    "dev")
40        echo "${STAGE} stage"
41        #   configure the vzdaemon backend server
42        nvram set vz_server_url="https://arlo-device-dev.messaging.netgear.com"
43        #   configure the vzdaemon update url
44        nvram set vz_update_url="https://updates.netgear.com/arlo/fw/gen3/dev"
45        nvram set vz_log_level="DEBUG"
46        #   configure xagent
47        load_xagent_dev_urls
48        ;;
49    "integration")
50        echo "${STAGE} stage"
51        #   configure the vzdaemon backend server
52        nvram set vz_server_url="https://arlo-device-dev.messaging.netgear.com"
53        #   configure the vzdaemon update url
54        nvram set vz_update_url="https://updates.netgear.com/arlo/fw/gen3/integration"
55        nvram set vz_log_level="DEBUG"
56        #   configure xagent
57        load_xagent_dev_urls
58        ;;
59    "qa")
60        echo "${STAGE} stage"
61        #   configure the vzdaemon backend server
62        nvram set vz_server_url="https://arlo-device-qa.messaging.netgear.com"
63        #   configure the vzdaemon update url
64        nvram set vz_update_url="https://updates.netgear.com/arlo/fw/gen3/qa"
65        nvram set vz_log_level="DEBUG"
66        
67        #   load the xagent qa urls
68        load_xagent_qa_urls
69        ;;
70    "beta")
71        echo "${STAGE} stage"
72        #   configure the vzdaemon backend server
73        nvram set vz_server_url="https://arlo-device-qa.messaging.netgear.com"
74        #   configure the vzdaemon update url
75        nvram set vz_update_url="https://updates.netgear.com/arlo/fw/gen3/beta"
76        nvram set vz_log_level="DEBUG"
77        
78        #   load the xagent qa urls
79        load_xagent_qa_urls
80        ;;
81    "staging")
82        echo "${STAGE} stage"
83        #   configure the vzdaemon backend server
84        nvram set vz_server_url="https://arlo-device-staging.messaging.netgear.com"
85        #   configure the vzdaemon update url
86        nvram set vz_update_url="https://updates.netgear.com/arlo/fw/gen3/staging"
87        nvram set vz_log_level="WARNING"
88        
89        #   load the xagent qa urls
90        load_xagent_qa_urls
91        ;;
92    "production")
93        echo "${STAGE} stage"
94        #   configure the vzdaemon backend server
95        nvram set vz_server_url="https://arlo-device.messaging.netgear.com"
96        #   configure the vzdaemon update url
97        nvram set vz_update_url="https://updates.netgear.com/arlo/fw/gen3/production"
98        nvram set vz_log_level="DEBUG"
99        
100        #   load the xagent production urls
101        load_xagent_production_urls
102        ;;
103    *)
104        echo "stage unrecognized"
105        print_syntax
106        exit 0
107        ;;
108esac
109
110
111#   kill running processes
112killall vzwatchdog xagent
113#   remove the working data in /tmp/media/nand
114rm -rf /tmp/media/nand/vzdaemon/conf
115
116#  reset the xagent subscription
117nvram unset x_agent_id
118nvram unset x_agent_claim_code
119nvram unset x_agent_registered
120nvram unset x_agent_claimed
121nvram unset x_agent_hardware_id
122
123#   set the ssid appending the current time in seconds
124nvram set wla_ssid=NTGR_VMB_`date -u +%s`
125
126nvram commit
127
128echo "done.  Reboot the base station to continue."
129
130
131
132