Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

00-run.sh 4.5 KiB

há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #!/bin/bash -e
  2. install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/PiSDR/Software/dump1090/"
  3. install -v -o 1000 -g 1000 -m 755 targets/enable.sh "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/PiSDR/Software/dump1090/"
  4. install -v -o 1000 -g 1000 -m 755 targets/disable.sh "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/PiSDR/Software/dump1090/"
  5. install -v -o 1000 -g 1000 -m 755 targets/configure_rbfeeder.sh "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/PiSDR/Software/dump1090/"
  6. install -v -o 1000 -g 1000 -m 755 targets/configure_fr24feed.sh "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/PiSDR/Software/dump1090/"
  7. on_chroot << EOF
  8. cd "/home/${FIRST_USER_NAME}/PiSDR/Software/dump1090"
  9. mkdir -p /usr/local/share/adsb-wiki/readsb-install
  10. apt-get update
  11. apt-get install --no-install-recommends --no-install-suggests -y git build-essential debhelper libusb-1.0-0-dev \
  12. pkg-config dh-systemd libncurses5-dev lighttpd zlib1g-dev zlib1g unzip
  13. rm -rf /usr/local/share/adsb-wiki/readsb-install/git
  14. if ! git clone --branch stale --depth 1 https://github.com/wiedehopf/readsb.git "/usr/local/share/adsb-wiki/readsb-install/git"
  15. then
  16. echo "Unable to git clone the repository"
  17. exit 1
  18. fi
  19. rm -rf /usr/local/share/adsb-wiki/readsb-install/readsb*.deb
  20. cd /usr/local/share/adsb-wiki/readsb-install/git
  21. sed -i 's/librtlsdr0, librtlsdr-dev, //g' debian/control
  22. export DEB_BUILD_OPTIONS=noddebs
  23. if ! dpkg-buildpackage -b -Prtlsdr -ui -uc -us
  24. then
  25. echo "Something went wrong building the debian package, exiting!"
  26. exit 1
  27. fi
  28. echo "Installing the Package"
  29. if ! dpkg -i ../readsb_*.deb
  30. then
  31. echo "Something went wrong installing the debian package, exiting!"
  32. exit 1
  33. fi
  34. echo "Package installed!"
  35. cp -n debian/lighttpd/* /etc/lighttpd/conf-available
  36. # script to change gain
  37. mkdir -p /usr/local/bin
  38. cat >/usr/local/bin/readsb-gain <<"EOF"
  39. #!/bin/bash
  40. gain=$(echo $1 | tr -cd '[:digit:].-')
  41. if [[ $gain == "" ]]; then echo "Error, invalid gain!"; exit 1; fi
  42. if ! grep gain /etc/default/readsb &>/dev/null; then sed -i -e 's/RECEIVER_OPTIONS="/RECEIVER_OPTIONS="--gain 49.6 /' /etc/default/readsb; fi
  43. sudo sed -i -E -e "s/--gain .?[0-9]*.?[0-9]* /--gain $gain /" /etc/default/readsb
  44. sudo systemctl restart readsb
  45. EOF
  46. chmod a+x /usr/local/bin/readsb-gain
  47. # set-location
  48. cat >/usr/local/bin/readsb-set-location <<"EOF"
  49. #!/bin/bash
  50. lat=$(echo $1 | tr -cd '[:digit:].-')
  51. lon=$(echo $2 | tr -cd '[:digit:].-')
  52. if ! awk "BEGIN{ exit ($lat > 90) }" || ! awk "BEGIN{ exit ($lat < -90) }"; then
  53. echo
  54. echo "Invalid latitude: $lat"
  55. echo "Latitude must be between -90 and 90"
  56. echo
  57. echo "Example format for latitude: 51.528308"
  58. echo
  59. echo "Usage:"
  60. echo "readsb-set-location 51.52830 -0.38178"
  61. echo
  62. exit 1
  63. fi
  64. if ! awk "BEGIN{ exit ($lon > 180) }" || ! awk "BEGIN{ exit ($lon < -180) }"; then
  65. echo
  66. echo "Invalid longitude: $lon"
  67. echo "Longitude must be between -180 and 180"
  68. echo
  69. echo "Example format for latitude: -0.38178"
  70. echo
  71. echo "Usage:"
  72. echo "readsb-set-location 51.52830 -0.38178"
  73. echo
  74. exit 1
  75. fi
  76. echo
  77. echo "setting Latitude: $lat"
  78. echo "setting Longitude: $lon"
  79. echo
  80. if ! grep -e '--lon' /etc/default/readsb &>/dev/null; then sed -i -e 's/DECODER_OPTIONS="/DECODER_OPTIONS="--lon -0.38178 /' /etc/default/readsb; fi
  81. if ! grep -e '--lat' /etc/default/readsb &>/dev/null; then sed -i -e 's/DECODER_OPTIONS="/DECODER_OPTIONS="--lat 51.52830 /' /etc/default/readsb; fi
  82. sed -i -E -e "s/--lat .?[0-9]*.?[0-9]* /--lat $lat /" /etc/default/readsb
  83. sed -i -E -e "s/--lon .?[0-9]*.?[0-9]* /--lon $lon /" /etc/default/readsb
  84. systemctl restart readsb
  85. EOF
  86. chmod a+x /usr/local/bin/readsb-set-location
  87. echo --------------
  88. cd /usr/local/share/adsb-wiki/readsb-install
  89. wget -O tar1090-install.sh https://raw.githubusercontent.com/wiedehopf/tar1090/master/install.sh
  90. bash tar1090-install.sh /run/readsb
  91. if ! systemctl show readsb | grep 'ExecMainStatus=0' -qs; then
  92. echo --------------
  93. echo --------------
  94. journalctl -u readsb | tail -n30
  95. echo --------------
  96. echo --------------
  97. echo "ERROR: readsb service didn't start, if inquiring about the issue please post the above 30 lines of log!"
  98. echo " common issues: SDR not plugged in."
  99. echo " the webinterface will show an error until readsb is running!"
  100. echo --------------
  101. fi
  102. echo --------------
  103. echo "[PiSDR] Disabling services. To enable them, run 'bash enable.sh'."
  104. systemctl disable --now readsb
  105. systemctl disable --now tar1090
  106. systemctl disable --now lighttpd
  107. echo "[PiSDR] Deleting build files to save space."
  108. rm -fr /usr/local/share/tar1090/git-db
  109. rm -fr /usr/local/share/tar1090/git
  110. EOF