Permalink
Browse files

First public release

  • Loading branch information...
SoftIce
SoftIce committed Apr 30, 2018
1 parent 3b17cd1 commit 1052d2acae10254af3b0f88b9e1c1971fb4dcb2c
Showing with 535 additions and 0 deletions.
  1. +22 −0 disco/disco_install.sh
  2. BIN disco/uavpal/bin/adb
  3. BIN disco/uavpal/bin/chat
  4. BIN disco/uavpal/bin/curl
  5. BIN disco/uavpal/bin/dc
  6. BIN disco/uavpal/bin/iperf
  7. BIN disco/uavpal/bin/pppd
  8. +116 −0 disco/uavpal/bin/uavpal_disco.sh
  9. +83 −0 disco/uavpal/bin/uavpal_glympse.sh
  10. +14 −0 disco/uavpal/bin/uavpal_sms.sh
  11. BIN disco/uavpal/bin/usb_modeswitch
  12. BIN disco/uavpal/bin/zerotier-one
  13. +1 −0 disco/uavpal/conf/70-huawei-e3372.rules
  14. +2 −0 disco/uavpal/conf/apn
  15. +39 −0 disco/uavpal/conf/chatscript
  16. +2 −0 disco/uavpal/conf/glympse_apikey
  17. +5 −0 disco/uavpal/conf/local.conf
  18. +13 −0 disco/uavpal/conf/lte
  19. +4 −0 disco/uavpal/conf/ntp.conf
  20. +3 −0 disco/uavpal/conf/phonenumber
  21. +2 −0 disco/uavpal/conf/zt_networkid
  22. BIN disco/uavpal/lib/libaudit.so.1
  23. BIN disco/uavpal/lib/libcom_err.so.2
  24. BIN disco/uavpal/lib/libcurl.so.4
  25. BIN disco/uavpal/lib/libgcrypt.so.20
  26. BIN disco/uavpal/lib/libgmp.so.10
  27. BIN disco/uavpal/lib/libgnutls-deb0.so.28
  28. BIN disco/uavpal/lib/libgpg-error.so.0
  29. BIN disco/uavpal/lib/libgssapi_krb5.so.2
  30. BIN disco/uavpal/lib/libhogweed.so.2
  31. BIN disco/uavpal/lib/libidn.so.11
  32. BIN disco/uavpal/lib/libk5crypto.so.3
  33. BIN disco/uavpal/lib/libkeyutils.so.1
  34. BIN disco/uavpal/lib/libkrb5.so.3
  35. BIN disco/uavpal/lib/libkrb5support.so.0
  36. BIN disco/uavpal/lib/liblber-2.4.so.2
  37. BIN disco/uavpal/lib/libldap_r-2.4.so.2
  38. BIN disco/uavpal/lib/libnettle.so.4
  39. BIN disco/uavpal/lib/libp11-kit.so.0
  40. BIN disco/uavpal/lib/libpam.so.0
  41. BIN disco/uavpal/lib/libpcap.so.0.8
  42. BIN disco/uavpal/lib/librtmp.so.1
  43. BIN disco/uavpal/lib/libsasl2.so.2
  44. BIN disco/uavpal/lib/libssh2.so.1
  45. BIN disco/uavpal/lib/libtasn1.so.6
  46. BIN disco/uavpal/mod/bsd_comp.ko
  47. BIN disco/uavpal/mod/crc-ccitt.ko
  48. BIN disco/uavpal/mod/ip_tables.ko
  49. BIN disco/uavpal/mod/iptable_filter.ko
  50. BIN disco/uavpal/mod/option.ko
  51. BIN disco/uavpal/mod/ppp_async.ko
  52. BIN disco/uavpal/mod/ppp_deflate.ko
  53. BIN disco/uavpal/mod/ppp_generic.ko
  54. BIN disco/uavpal/mod/slhc.ko
  55. BIN disco/uavpal/mod/tun.ko
  56. BIN disco/uavpal/mod/usb_wwan.ko
  57. BIN disco/uavpal/mod/usbserial.ko
  58. BIN disco/uavpal/mod/x_tables.ko
  59. BIN disco/uavpal/mod/xt_tcpudp.ko
  60. +1 −0 installation.txt
  61. +32 −0 skycontroller2/skycontroller2_install.sh
  62. BIN skycontroller2/uavpal/bin/jstest
  63. +185 −0 skycontroller2/uavpal/bin/uavpal_sc2.sh
  64. BIN skycontroller2/uavpal/bin/zerotier-one
  65. +5 −0 skycontroller2/uavpal/conf/local.conf
  66. +2 −0 skycontroller2/uavpal/conf/ssid
  67. +2 −0 skycontroller2/uavpal/conf/wpa
  68. +2 −0 skycontroller2/uavpal/conf/zt_networkid
View
@@ -0,0 +1,22 @@
#!/bin/sh
echo "=== Installing Disco4G on Disco ==="
echo "Moving softmod files to target directory"
mv -v /tmp/disco4g/disco/uavpal /data/ftp
echo "Making binaries and scripts executable"
chmod +x /data/ftp/uavpal/bin/*
echo "Remounting filesystem as read/write"
mount -o remount,rw /
echo "Creating symlink for ppp-lte settings"
ln -s /data/ftp/uavpal/conf/lte /etc/ppp/peers/lte |grep -v 'File exists'
echo "Creating symlink udev rule"
ln -s /data/ftp/uavpal/conf/70-huawei-e3372.rules /lib/udev/rules.d/70-huawei-e3372.rules |grep -v 'File exists'
echo "Creating symlink for ntpd's config file"
ln -s /data/ftp/uavpal/conf/ntp.conf /etc/ntp.conf |grep -v 'File exists'
echo "Remounting filesystem as read-only"
mount -o remount,ro /
echo "Creating zerotier-one directory"
mkdir -p /data/lib/zerotier-one
echo "Creating symlink for zerotier-one's local config file"
ln -s /data/ftp/uavpal/conf/local.conf /data/lib/zerotier-one/local.conf |grep -v 'File exists'
echo "All done! :)"
echo
View
BIN +131 KB disco/uavpal/bin/adb
Binary file not shown.
View
BIN +21.4 KB disco/uavpal/bin/chat
Binary file not shown.
View
BIN +153 KB disco/uavpal/bin/curl
Binary file not shown.
View
BIN +33.6 KB disco/uavpal/bin/dc
Binary file not shown.
View
BIN +57.5 KB disco/uavpal/bin/iperf
Binary file not shown.
View
BIN +270 KB disco/uavpal/bin/pppd
Binary file not shown.
@@ -0,0 +1,116 @@
#!/bin/sh
ulogger -s -t uavpal_disco "Huawei USB device detected"
ulogger -s -t uavpal_disco "=== Enabling LTE ==="
ulogger -s -t uavpal_disco "... loading tunnel kernel module (for zerotier)"
insmod /data/ftp/uavpal/mod/tun.ko
ulogger -s -t uavpal_disco "... loading E3372s kernel modules (required for detection)"
insmod /data/ftp/uavpal/mod/usbserial.ko
insmod /data/ftp/uavpal/mod/usb_wwan.ko
insmod /data/ftp/uavpal/mod/option.ko
ulogger -s -t uavpal_disco "... loading iptables kernel modules (required for security)"
insmod /data/ftp/uavpal/mod/x_tables.ko
insmod /data/ftp/uavpal/mod/ip_tables.ko
insmod /data/ftp/uavpal/mod/iptable_filter.ko
insmod /data/ftp/uavpal/mod/xt_tcpudp.ko
# Security: block incoming connections on the Internet interfaces (ppp* for E3372s and eth1 for E3372h)
# these connections should only be allowed on Wi-Fi (eth0) and via zerotier (zt0)
ulogger -s -t uavpal_disco "... applying iptables security rules"
if_block='ppp+ eth1'
for i in $if_block
do
iptables -I INPUT -p tcp -i eth1 --dport 21 -j DROP # inetd (ftp:/data/ftp)
iptables -I INPUT -p tcp -i eth1 --dport 23 -j DROP # telnet
iptables -I INPUT -p tcp -i eth1 --dport 51 -j DROP # inetd (ftp:/update)
iptables -I INPUT -p tcp -i eth1 --dport 61 -j DROP # inetd (ftp:/data/ftp/internal_000/flightplans)
iptables -I INPUT -p tcp -i eth1 --dport 873 -j DROP # rsync
iptables -I INPUT -p tcp -i eth1 --dport 8888 -j DROP # dragon-prog
iptables -I INPUT -p tcp -i eth1 --dport 9050 -j DROP # adb
iptables -I INPUT -p tcp -i eth1 --dport 44444 -j DROP # dragon-prog
iptables -I INPUT -p udp -i eth1 --dport 67 -j DROP # dnsmasq
iptables -I INPUT -p udp -i eth1 --dport 5353 -j DROP # avahi-daemon
iptables -I INPUT -p udp -i eth1 --dport 14551 -j DROP # dragon-prog
done
ulogger -s -t uavpal_disco "... running usb_modeswitch"
/data/ftp/uavpal/bin/usb_modeswitch -J -v 12d1 -p `lsusb |grep "ID 12d1" | cut -f 3 -d \:`
ulogger -s -t uavpal_disco "... trying to detect 4G USB modem"
while true
do
# -=-=-=-=-= Hi-Link Mode =-=-=-=-=-
if [ -d "/proc/sys/net/ipv4/conf/eth1" ]; then
huawei_mode="hilink"
ulogger -s -t uavpal_disco "... detected Huawei USB modem in Hi-Link mode"
ulogger -s -t uavpal_disco "... unloading E3372s kernel modules (not required as Hi-Link was detected)"
rmmod option
rmmod usb_wwan
rmmod usbserial
ulogger -s -t uavpal_disco "... setting IP and route"
ifconfig eth1 192.168.8.100 netmask 255.255.255.0
ip route add default via 192.168.8.1 dev eth1
ulogger -s -t uavpal_disco "... enabling Hi-Link DMZ mode (1:1 NAT for better zerotier performance)"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/ftp/uavpal/lib
sessionInfo=`/data/ftp/uavpal/bin/curl -s -X GET "http://192.168.8.1/api/webserver/SesTokInfo"`
cookie=`echo "$sessionInfo" | grep "SessionID=" | cut -b 10-147`
token=`echo "$sessionInfo" | grep "TokInfo" | cut -b 10-41`
/data/ftp/uavpal/bin/curl -s -X POST "http://192.168.8.1/api/security/dmz" -d "<request><DmzStatus>1</DmzStatus><DmzIPAddress>192.168.8.100</DmzIPAddress></request>" -H "Cookie: $cookie" -H "__RequestVerificationToken: $token"
break 1 # break out of while loop
fi
# -=-=-=-=-= Stick Mode =-=-=-=-=-
if [ -c "/dev/ttyUSB0" ]; then
huawei_mode="stick"
ulogger -s -t uavpal_disco "... detected Huawei USB modem in Stick mode"
ulogger -s -t uavpal_disco "... loading ppp kernel modules"
insmod /data/ftp/uavpal/mod/crc-ccitt.ko
insmod /data/ftp/uavpal/mod/slhc.ko
insmod /data/ftp/uavpal/mod/ppp_generic.ko
insmod /data/ftp/uavpal/mod/ppp_async.ko
insmod /data/ftp/uavpal/mod/ppp_deflate.ko
insmod /data/ftp/uavpal/mod/bsd_comp.ko
ulogger -s -t uavpal_disco "... running pppd to connect to LTE network"
LD_PRELOAD=/data/ftp/uavpal/lib/libpam.so.0:/data/ftp/uavpal/lib/libpcap.so.0.8:/data/ftp/uavpal/lib/libaudit.so.1 /data/ftp/uavpal/bin/pppd call lte
break 1 # break out of while loop
fi
sleep 1
done
ulogger -s -t uavpal_disco "... setting DNS servers statically (to Google)"
echo -e 'nameserver 8.8.8.8\nnameserver 8.8.4.4' >/etc/resolv.conf
ulogger -s -t uavpal_disco "... waiting for Internet connection"
while true; do
if ping -c 1 8.8.8.8 >/dev/null 2>&1; then
ulogger -s -t uavpal_disco "... Internet connection is up"
break # break out of loop
fi
done
ulogger -s -t uavpal_disco "... setting date/time using ntp"
ntpd -n -d -q
ulogger -s -t uavpal_disco "... starting glympse script for GPS tracking"
/data/ftp/uavpal/bin/uavpal_glympse.sh $huawei_mode &
ulogger -s -t uavpal_disco "... starting zerotier daemon"
/data/ftp/uavpal/bin/zerotier-one -d
ulogger -s -t uavpal_disco "... checking if zerotier needs to join a network"
if [ ! -d "/data/lib/zerotier-one/networks.d" ]; then
ulogger -s -t uavpal_disco "... joining zerotier network ID"
sleep 1
ztjoin_response=`/data/ftp/uavpal/bin/zerotier-one -q join $(head -1 /data/ftp/uavpal/conf/zt_networkid |tr -d '\r\n' |tr -d '\n')`
if [ "`echo $ztjoin_response |head -n1 |awk '{print $1}')`" == "200" ]; then
ulogger -s -t uavpal_disco "... successfully joined zerotier network ID"
else
ulogger -s -t uavpal_disco "... ERROR joining zerotier network ID"
fi
fi
ulogger -s -t uavpal_disco "... looping to keep script alive. ugly, yes!"
ulogger -s -t uavpal_disco "*** idle on LTE ***"
while true; do sleep 10; done
@@ -0,0 +1,83 @@
#!/bin/sh
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/ftp/uavpal/lib
function parse_json()
{
echo $1 | \
sed -e 's/[{}]/''/g' | \
sed -e 's/", "/'\",\"'/g' | \
sed -e 's/" ,"/'\",\"'/g' | \
sed -e 's/" , "/'\",\"'/g' | \
sed -e 's/","/'\"---SEPERATOR---\"'/g' | \
awk -F=':' -v RS='---SEPERATOR---' "\$1~/\"$2\"/ {print}" | \
sed -e "s/\"$2\"://" | \
tr -d "\n\t" | \
sed -e 's/\\"/"/g' | \
sed -e 's/\\\\/\\/g' | \
sed -e 's/^[ \t]*//g' | \
sed -e 's/^"//' -e 's/"$//'
}
function gpsDecimal()
{
gpsVal=$1
gpsDir="$2"
gpsInt=$(echo "$gpsVal 100 / p" | /data/ftp/uavpal/bin/dc)
gpsMin=$(echo "3k$gpsVal $gpsInt 100 * - p" | /data/ftp/uavpal/bin/dc)
gpsDec=$(echo "6k$gpsMin 60 / $gpsInt + 1000000 * p" | /data/ftp/uavpal/bin/dc | cut -d '.' -f 1)
if [[ "$gpsDir" != "E" && "$gpsDir" != "N" ]]; then gpsDec="-$gpsDec"; fi
echo $gpsDec
}
ulogger -s -t uavpal_glympse "... reading Glympse API key from config file"
apikey="`head -1 /data/ftp/uavpal/conf/glympse_apikey |tr -d '\r\n' |tr -d '\n'`"
if [ "$apikey" == "AAAAAAAAAAAAAAAAAAAA" ]; then
ulogger -s -t uavpal_disco "... disabling Glympse, API key set to ignore"
exit 0
fi
ulogger -s -t uavpal_glympse "... reading Disco ID from avahi"
droneName=$(cat /tmp/avahi/services/ardiscovery.service |grep name |cut -d '>' -f 2 |cut -d '<' -f 0)
ulogger -s -t uavpal_glympse "... Glympse API: creating account"
glympseCreateAccount=$(/data/ftp/uavpal/bin/curl -q -k -H "Content-Type: application/json" -X POST "https://api.glympse.com/v2/account/create?api_key=${apikey}")
ulogger -s -t uavpal_glympse "... Glympse API: logging in"
glympseLogin=$(/data/ftp/uavpal/bin/curl -q -k -H "Content-Type: application/json" -X POST "https://api.glympse.com/v2/account/login?api_key=${apikey}&id=$(parse_json $glympseCreateAccount id)&password=$(parse_json $glympseCreateAccount password)")
ulogger -s -t uavpal_glympse "... Glympse API: parsing access token"
access_token=$(parse_json $(echo $glympseLogin |sed 's/\:\"access_token/\:\"tmp/g') access_token)
ulogger -s -t uavpal_glympse "... Glympse API: creating ticket"
glympseCreateTicket=$(/data/ftp/uavpal/bin/curl -q -k -H "Content-Type: application/json" -H "Authorization: Bearer ${access_token}" -X POST "https://api.glympse.com/v2/users/self/create_ticket?duration=14400000")
ulogger -s -t uavpal_glympse "... Glympse API: parsing ticket"
ticket=$(parse_json $glympseCreateTicket id)
ulogger -s -t uavpal_glympse "... Glympse API: creating invite"
glympseCreateInvite=$(/data/ftp/uavpal/bin/curl -q -k -H "Content-Type: application/json" -H "Authorization: Bearer ${access_token}" -X POST "https://api.glympse.com/v2/tickets/$ticket/create_invite?type=sms&address=1234567890&send=client")
ulogger -s -t uavpal_glympse "... Glympse API: calling uavpal_sms"
/data/ftp/uavpal/bin/uavpal_sms.sh $1 "`head -1 /data/ftp/uavpal/conf/phonenumber |tr -d '\r\n' |tr -d '\n'`" "You can track the location of your ${droneName} here: https://glympse.com/$(parse_json ${glympseCreateInvite%_*} id)"
ulogger -s -t uavpal_glympse "... Glympse API: setting identifier to Disco ID"
/data/ftp/uavpal/bin/curl -q -k -H "Content-Type: application/json" -H "Authorization: Bearer ${access_token}" -X POST -d "[{\"t\": $(date +%s)000, \"pid\": 0, \"n\": \"name\", \"v\": \"${droneName}\"}]" "https://api.glympse.com/v2/tickets/$ticket/append_data"
ulogger -s -t uavpal_glympse "... Glympse API: setting Disco thumbnail image"
/data/ftp/uavpal/bin/curl -q -k -H "Content-Type: application/json" -H "Authorization: Bearer ${access_token}" -X POST -d "[{\"t\": $(date +%s)000, \"pid\": 0, \"n\": \"avatar\", \"v\": \"https://uavpal.com/img/disco.png?$(date +%s)\"}]" "https://api.glympse.com/v2/tickets/$ticket/append_data"
ulogger -s -t uavpal_glympse "... Glympse API: reading out Disco's GPS coordinates every 5 seconds to update Glympse via API"
while true
do
gps_nmea_out=$(grep GNRMC -m 1 /tmp/gps_nmea_out | cut -c4-)
lat=$(echo $gps_nmea_out | cut -d ',' -f 4)
latdir=$(echo $gps_nmea_out | cut -d ',' -f 5)
long=$(echo $gps_nmea_out | cut -d ',' -f 6)
longdir=$(echo $gps_nmea_out | cut -d ',' -f 7)
speed=$(echo $gps_nmea_out | cut -d ',' -f 8)
# speed is not working. fix in future release.
# /data/ftp/uavpal/bin/curl -q -k -H "Content-Type: application/json" -H "Authorization: Bearer ${access_token}" -X POST -d "[[$(date +%s)000,$(gpsDecimal $lat $latdir),$(gpsDecimal $long $longdir),0$(/data/ftp/dc -e "$speed 0.514444 * p")]]" "https://api.glympse.com/v2/tickets/$ticket/append_location"
/data/ftp/uavpal/bin/curl -q -k -H "Content-Type: application/json" -H "Authorization: Bearer ${access_token}" -X POST -d "[[$(date +%s)000,$(gpsDecimal $lat $latdir),$(gpsDecimal $long $longdir),0]]" "https://api.glympse.com/v2/tickets/$ticket/append_location"
sleep 5
done
@@ -0,0 +1,14 @@
#!/bin/sh
if [ "$1" == "stick" ]; then
ulogger -s -t uavpal_sms "... sending SMS with Glympse link (via ttyUSB)"
echo -e "AT+CMGF=1\rAT+CMGS=\"$2\"\r$3\32" > /dev/ttyUSB0
elif [ "$1" == "hilink" ]; then
ulogger -s -t uavpal_sms "... sending SMS with Glympse link (via Hi-Link API)"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/ftp/uavpal/lib
sessionInfo=`/data/ftp/uavpal/bin/curl -s -X GET "http://192.168.8.1/api/webserver/SesTokInfo"`
cookie=`echo "$sessionInfo" | grep "SessionID=" | cut -b 10-147`
token=`echo "$sessionInfo" | grep "TokInfo" | cut -b 10-41`
/data/ftp/uavpal/bin/curl -s -X POST "http://192.168.8.1/api/sms/send-sms" -d "<request><Index>-1</Index><Phones><Phone>$2</Phone></Phones><Sca></Sca><Content>$3</Content><Length>-1</Length><Reserved>-1</Reserved><Date>-1</Date></request>" -H "Cookie: $cookie" -H "__RequestVerificationToken: $token"
else
ulogger -s -t uavpal_sms "ERROR: the first argument has to be stick|hilink"
fi
View
Binary file not shown.
View
Binary file not shown.
@@ -0,0 +1 @@
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", RUN+="/data/ftp/uavpal/bin/uavpal_disco.sh"
View
@@ -0,0 +1,2 @@
myapn
# Enter your mobile network operator's APN on the first line. If unsure, consult your mobile provider to try this: https://www.hw-group.com/products/HWg-Ares/HWg-Ares_GSM_APN_en.html
@@ -0,0 +1,39 @@
# You can use this script unmodified to connect to cellular networks.
# The APN is specified in the peers file as the argument of the -T command
# line option of chat(8).
# For details about the AT commands involved please consult the relevant
# standard: 3GPP TS 27.007 - AT command set for User Equipment (UE).
# (http://www.3gpp.org/ftp/Specs/html-info/27007.htm)
ABORT BUSY
ABORT VOICE
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
ABORT "NO DIAL TONE"
ABORT "NO ANSWER"
ABORT "DELAYED"
ABORT "ERROR"
# cease if the modem is not attached to the network yet
ABORT "+CGATT: 0"
"" AT
TIMEOUT 12
OK ATH
OK ATE1
# +CPIN provides the SIM card PIN
#OK "AT+CPIN=1234"
# +CFUN may allow to configure the handset to limit operations to
# GPRS/EDGE/UMTS/etc to save power, but the arguments are not standard
# except for 1 which means "full functionality".
#OK AT+CFUN=1
#OK AT+CGDCONT=1,"IP","\T","",0,0
OK AT\^NDISDUP=1,1,"\T"
OK ATD*99#
TIMEOUT 22
CONNECT ""
@@ -0,0 +1,2 @@
AAAAAAAAAAAAAAAAAAAA
# Enter your Glympse API key on the first line. This is used for GPS tracking (Glympse). Leave it set to AAAAAAAAAAAAAAAAAAAA, if you don't want to use Glympse.
@@ -0,0 +1,5 @@
{
"settings": {
"interfacePrefixBlacklist": [ "eth0" ]
}
}
View
@@ -0,0 +1,13 @@
connect "/data/ftp/uavpal/bin/chat -v -f /data/ftp/uavpal/conf/chatscript -T `head -1 /data/ftp/uavpal/conf/apn |tr -d '\r\n' |tr -d '\n'`"
/dev/ttyUSB1
noipdefault
defaultroute
replacedefaultroute
hide-password
noauth
persist
usepeerdns
maxfail 0
lcp-echo-failure 10
lcp-echo-interval 6
holdoff 5
@@ -0,0 +1,4 @@
server 0.debian.pool.ntp.org iburst
server 1.debian.pool.ntp.org iburst
server 2.debian.pool.ntp.org iburst
server 3.debian.pool.ntp.org iburst
@@ -0,0 +1,3 @@
+XXYYYYYYYYY
# Enter your phone number on the first line. This is used to send you the GPS tracking link (Glympse) upon powering on the Disco.
# +XX is the international prefix.
@@ -0,0 +1,2 @@
0123456789abcdef
# Enter your ZeroTier Network ID on the first line - this is the same value for disco's zt_networkid and skycontroller2's zt_networkid.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
@@ -0,0 +1 @@
Please go to https://github.com/uavpal/disco4g/wiki/Installation for detailed instructions.
@@ -0,0 +1,32 @@
#!/bin/sh
echo "=== Installing Disco4G on Skycontroller 2 ==="
# ip_sc2=`grep -i 'a0:14:3d' /var/lib/misc/dhcp_eth0.leases | head -1 | awk '{ print $3 }'`
ip_sc2=`netstat -nu |grep 9988 | head -1 | awk '{ print $5 }' | cut -d ':' -f 1`
until /data/ftp/uavpal/bin/adb connect ${ip_sc2}:9050 2>/dev/null;
do
echo "Trying to connect from Disco to Skycontroller 2 via Wi-Fi"
done
echo "Copying softmod files from Disco to Skycontroller 2"
/data/ftp/uavpal/bin/adb push /tmp/disco4g/skycontroller2/uavpal /data/lib/ftp/uavpal/ 2>/dev/null
echo "Making binaries and scripts executable"
/data/ftp/uavpal/bin/adb shell "chmod +x /data/lib/ftp/uavpal/bin/*" 2> /dev/null
echo "Remounting filesystem as read/write"
/data/ftp/uavpal/bin/adb shell "mount -o remount,rw /" 2>/dev/null
echo "Creating init script for softmod"
/data/ftp/uavpal/bin/adb shell "cat << '' > /etc/boxinit.d/99-uavpal.rc
service uavpal /data/lib/ftp/uavpal/bin/uavpal_sc2.sh
class main
user root
" 2>/dev/null
echo "Setting file permissions for init script"
/data/ftp/uavpal/bin/adb shell "chmod 640 /etc/boxinit.d/99-uavpal.rc" 2>/dev/null
echo "Remounting filesystem as read-only"
/data/ftp/uavpal/bin/adb shell "mount -o remount,ro /" 2>/dev/null
echo "Creating zerotier-one directory"
/data/ftp/uavpal/bin/adb shell "mkdir -p /data/lib/zerotier-one" 2>/dev/null
echo "Creating symlink for zerotier-one's local config file"
/data/ftp/uavpal/bin/adb shell "ln -s /data/lib/ftp/uavpal/conf/local.conf /data/lib/zerotier-one/local.conf" 2>/dev/null |grep -v 'File exists'
echo "Rebooting Skycontroller 2"
/data/ftp/uavpal/bin/adb shell "reboot" 2>/dev/null
echo "All done! :)"
echo
View
Binary file not shown.
Oops, something went wrong.

0 comments on commit 1052d2a

Please sign in to comment.