#!/usr/bin/haserl <% echo -en "content-type: text/html\r\n\r\n" # RF2616 Compliance %> <%# --- Process the form submission --- %> <% if [ -e "/usr/share/remoteit" ]; then echo "

Remoteit is installed

" > /tmp/remoteit_status.txt else echo "

Remoteit is not installed

" > /tmp/remoteit_status.txt fi if [ -e "/etc/remoteit/config.json" ]; then echo "

Device is registered

" >> /tmp/remoteit_status.txt else echo "

Device is not registered

" >> /tmp/remoteit_status.txt fi if [ "$FORM_BUTTON" = "Install" ]; then # Check if already installed if [ -e "/usr/share/remoteit" ]; then echo "

Remoteit is already installed.

" > /tmp/remoteit_status.txt echo "

Please Remove then Install and Register

" >> /tmp/remoteit_status.txt else download_url="http://www.dragino.com/downloads/downloads/LoRa_Gateway/LPS8/Firmware/remoteit/" # Clean up rm /etc/remoteit/config.json rm /etc/remoteit/registration; touch /etc/remoteit/registration opkg remove remoteit > /tmp/remoteit_status.txt cd /var/ wget ${download_url}jq_1.5-3_mips_24kc.ipk wget ${download_url}remoteit_4.13.5.ipk opkg install /var/jq_1.5-3_mips_24kc.ipk opkg install /var/remoteit_4.13.5.ipk > /tmp/remoteit_status.txt echo "

Installation complete

" >> /tmp/remoteit_status.txt if [ -e "/etc/remoteit/config.json" ]; then echo "

Device is registered

" >> /tmp/remoteit_status.txt else echo "

Device is not registered

" >> /tmp/remoteit_status.txt fi rm jq_1.5-3_mips_24kc.ipk rm remoteit_4.13.5.ipk fi fi if [ "$FORM_BUTTON" = "Register" ]; then # Check if already registered if [ -e "/etc/remoteit/config.json" ]; then echo "

Device is already registered.

" > /tmp/remoteit_status.txt echo "

Please Remove then Install and Register

" >> /tmp/remoteit_status.txt else echo $FORM_REGISTRATION_CODE > /etc/remoteit/registration # Clean up rm /etc/remoteit/config.json # Register /usr/share/remoteit/refresh.sh > /tmp/remoteit_status.txt echo "

Registration complete

" >> /tmp/remoteit_status.txt if [ -e "/etc/remoteit/config.json" ]; then echo "

Device is registered

" >> /tmp/remoteit_status.txt else echo "

Device is not registered

" >> /tmp/remoteit_status.txt fi fi fi if [ "$FORM_BUTTON" = "Remove" ]; then opkg remove remoteit > /tmp/remoteit_status.txt rm -rf /usr/share/remoteit/ rm /etc/remoteit/config.json rm /etc/remoteit/registration; touch /etc/remoteit/registration echo "

Removal complete

" >> /tmp/remoteit_status.txt fi if [ "$FORM_BUTTON" = "Save" ]; then echo $FORM_REGISTRATION_CODE > /etc/remoteit/registration fi %> <%# --- Get the variables for the HTML page --- %> <% registration_code="$(cat /etc/remoteit/registration)" %> <%# --- Present the HTML page --- %> <%inc /www/cgi-bin/inc/head.inc %> <%inc /www/cgi-bin/inc/menu.inc %>

Remote.it                Create Remote.it Account

1. Install Remote.it

2. Register

Create a Product Definition
     

3. Remove

To change registration, please Remove and then Install again.

Status

<% cat /tmp/remoteit_status.txt %>