Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. #!/bin/bash
  2. set -e
  3. RED=$(tput setaf 1)
  4. GREEN=$(tput setaf 2)
  5. YELLOW=$(tput setaf 3)
  6. BLUE=$(tput setaf 4)
  7. BOLD=$(tput bold)
  8. RESET=$(tput sgr0)
  9. die() {
  10. >&2 echo "${RED}error: $1${RESET}" && exit 1
  11. }
  12. log() {
  13. echo "$*"
  14. }
  15. log_done() {
  16. echo " ${GREEN}✓${RESET} $1"
  17. }
  18. log_running() {
  19. echo " ${YELLOW}*${RESET} $1"
  20. }
  21. success() {
  22. echo "${GREEN}$1${RESET}"
  23. }
  24. ### Verify cloned repo
  25. if [ ! -e "$HOME/raspberry-noaa" ]; then
  26. die "Is https://github.com/reynico/raspberry-noaa cloned in your home directory?"
  27. fi
  28. ### Install required packages
  29. log_running "Installing required packages..."
  30. sudo apt update -yq
  31. sudo apt install -yq predict \
  32. python-setuptools \
  33. ntp \
  34. cmake \
  35. libusb-1.0 \
  36. sox \
  37. at \
  38. bc \
  39. nginx \
  40. libncurses5-dev \
  41. libncursesw5-dev \
  42. libatlas-base-dev \
  43. python3-pip \
  44. imagemagick \
  45. libxft-dev \
  46. libxft2 \
  47. libjpeg9 \
  48. libjpeg9-dev
  49. sudo pip3 install numpy ephem tweepy Pillow
  50. log_done "Packages installed"
  51. ### Blacklist DVB modules
  52. if [ -e /etc/modprobe.d/rtlsdr.conf ]; then
  53. log_done "DVB modules were already blacklisted"
  54. else
  55. sudo cp templates/modprobe.d/rtlsdr.conf /etc/modprobe.d/rtlsdr.conf
  56. log_done "DVB modules are blacklisted now"
  57. fi
  58. ### Install RTL-SDR
  59. if [ -e /usr/local/bin/rtl_fm ]; then
  60. log_done "rtl-sdr was already installed"
  61. else
  62. log_running "Installing rtl-sdr from osmocom..."
  63. (
  64. cd /tmp/
  65. git clone https://github.com/osmocom/rtl-sdr.git
  66. cd rtl-sdr/
  67. mkdir build
  68. cd build
  69. cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON
  70. make
  71. sudo make install
  72. sudo ldconfig
  73. cd /tmp/
  74. sudo cp ./rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/
  75. )
  76. log_done "rtl-sdr install done"
  77. fi
  78. ### Install WxToIMG
  79. if [ -e /usr/local/bin/xwxtoimg ]; then
  80. log_done "WxToIMG was already installed"
  81. else
  82. log_running "Installing WxToIMG..."
  83. sudo dpkg -i software/wxtoimg-armhf-2.11.2-beta.deb
  84. log_done "WxToIMG installed"
  85. fi
  86. ### Install default config file
  87. if [ -e "$HOME/.noaa.conf" ]; then
  88. log_done "$HOME/.noaa.conf already exists"
  89. else
  90. cp "templates/noaa.conf" "$HOME/.noaa.conf"
  91. log_done "$HOME/.noaa.conf installed"
  92. fi
  93. if [ -d "$HOME/.predict" ] && [ -e "$HOME/.predict/predict.qth" ]; then
  94. log_done "$HOME/.predict/predict.qth already exists"
  95. else
  96. mkdir "$HOME/.predict"
  97. cp "templates/predict.qth" "$HOME/.predict/predict.qth"
  98. log_done "$HOME/.predict/predict.qth installed"
  99. fi
  100. if [ -e "$HOME/.wxtoimgrc" ]; then
  101. log_done "$HOME/.wxtoimgrc already exists"
  102. else
  103. cp "templates/wxtoimgrc" "$HOME/.wxtoimgrc"
  104. log_done "$HOME/.wxtoimgrc installed"
  105. fi
  106. if [ -e "$HOME/.tweepy.conf" ]; then
  107. log_done "$HOME/.tweepy.conf already exists"
  108. else
  109. cp "templates/tweepy.conf" "$HOME/.tweepy.conf"
  110. log_done "$HOME/.tweepy.conf installed"
  111. fi
  112. ### Install meteor_demod
  113. if [ -e /usr/bin/meteor_demod ]; then
  114. log_done "meteor_demod was already installed"
  115. else
  116. log_running "Installing meteor_demod..."
  117. (
  118. cd /tmp
  119. git clone https://github.com/dbdexter-dev/meteor_demod.git
  120. cd meteor_demod
  121. make
  122. sudo make install
  123. )
  124. log_done "meteor_demod installed"
  125. fi
  126. ### Install medet_arm
  127. if [ -e /usr/bin/medet_arm ]; then
  128. log_done "medet_arm was already installed"
  129. else
  130. log_running "Installing medet_arm..."
  131. sudo cp software/medet_arm /usr/bin/medet_arm
  132. sudo chmod +x /usr/bin/medet_arm
  133. log_done "medet_arm installed"
  134. fi
  135. ### Cron the scheduler
  136. crontab -l | grep -q "raspberry-noaa"
  137. if [ $? -eq 0 ]; then
  138. log_done "Crontab for schedule.sh already exists"
  139. else
  140. cat <(crontab -l) <(echo "1 0 * * * /home/pi/raspberry-noaa/schedule.sh") | crontab -
  141. log_done "Crontab installed"
  142. fi
  143. ### Setup Nginx
  144. log_running "Setting up Nginx..."
  145. sudo cp templates/nginx.cfg /etc/nginx/sites-enabled/default
  146. (
  147. sudo mkdir -p /var/www/wx
  148. sudo chown -R www-data:www-data /var/www/wx
  149. sudo usermod -a -G www-data pi
  150. sudo chmod 775 /var/www/wx
  151. )
  152. sudo systemctl restart nginx
  153. if [ ! -e /var/www/wx/index.html ]; then
  154. cp templates/index.html /var/www/wx/index.html
  155. fi
  156. log_done "Nginx configured"
  157. ### Setup ramFS
  158. cat /etc/fstab | grep -q "ramfs"
  159. if [ $? -eq 0 ]; then
  160. log_done "ramfs already setup"
  161. else
  162. sudo mkdir -p /var/ramfs
  163. cat templates/fstab | sudo tee -a /etc/fstab > /dev/null
  164. log_done "Ramfs installed"
  165. fi
  166. set +e
  167. sudo mount -a
  168. set -e
  169. sudo chmod 777 /var/ramfs
  170. success "Install (almost) done!"
  171. echo "
  172. It's time to configure your ground station
  173. You'll be asked for your latitude and longitude
  174. Use negative values for South and West
  175. "
  176. read -rp "Enter your latitude (South values are negative): "
  177. lat=$REPLY
  178. read -rp "Enter your longitude (West values are negative): "
  179. lon=$REPLY
  180. read -rp "Enter your timezone (Ex: -3 for Argentina time): "
  181. timezone=$REPLY
  182. sed -i -e "s/change_latitude/${lat}/g;s/change_longitude/${lon}/g" "$HOME/.noaa.conf"
  183. sed -i -e "s/change_latitude/${lat}/g;s/change_longitude/${lon}/g" "$HOME/.wxtoimgrc"
  184. sed -i -e "s/change_latitude/${lat}/g;s/change_longitude/$(echo "$lon * -1" | bc)/g" "$HOME/.predict/predict.qth"
  185. sed -i -e "s/change_latitude/${lat}/g;s/change_longitude/${lon}/g;s/change_tz/$(echo "$timezone * -1" | bc)/g" "sun.py"
  186. # Running WXTOIMG to have the user accept the licensing agreement
  187. wxtoimg
  188. success "Install done! Double check your $HOME/.noaa.conf settings"
  189. echo "
  190. If you want to post your images to Twitter, please setup
  191. your Twitter credentials on $HOME/.tweepy.conf
  192. "