| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- # version 1.0.1
- #install essential software
- #sudo apt-get update
- programspath=~/programs
- installerpath=$(pwd)
- configfile='/etc/fourier-config.json'
- gitbase="https://git.miralo.xyz/AudioValid"
- tunnel_user=rtunnel
- datapath='/var/fourier'
- serverhost='audiovalid.com'
- if [[ "$OSTYPE" == darwin* ]]; then
- programspath=~/fourier
- fi
- [ ! -d "$programspath" ] && mkdir $programspath
- read -p "Whats this box port (last 3 numbers with zero for padding)?" PORT
- read -p "How many receivers has this box? " RECEIVERS_COUNT
- if [[ "$OSTYPE" == darwin* ]]; then
- keyfile="$programspath/fourier.key"
- [ ! -f "$keyfile" ] && ssh-keygen -t rsa -b 2048 -f $keyfile
- else
- keyspath=~/.ssh
- keyfile="$keyspath/.ssh"
- [ ! -d "$keyspath" ] && mkdir $keyspath
- ssh-keygen -t rsa -b 2048 -C "$HOSTNAME" -f $keyfile
- fi
- echo "Please add the following public key to server's authorized keys:"
- cat $keyfile.pub
- read -p "Press enter to continue"
- if [[ "$OSTYPE" != darwin* ]]; then
- tunnelfile="$programspath/ssh-tunnel.sh"
- echo "/usr/bin/autossh -N -f -M 7$PORT -oPubkeyAuthentication=yes -oPasswordAuthentication=no -oLogLevel=error -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -i $keyfile -R 6$PORT:localhost:22 $tunnel_user@$serverhost -p 22" > $tunnelfile
- curl -L -o ssh-tunnel.service https://gist.githubusercontent.com/niofis/bc24f1b33414fd77d77f/raw/
- sudo mv ssh-tunnel.service /etc/systemd/system/ssh-tunnel.service
-
- sudo systemctl enable ssh-tunnel
- sudo systemctl start ssh-tunnel
- fi
- if [[ "$OSTYPE" == darwin* ]]; then
- depend=( python gcc vim tmux autossh lame nodejs \
- ezstream libusb rtl-sdr nim portaudio )
- for dep in "${depend[@]}"
- do
- brew list $dep > /dev/null
- [ "$?" -eq 1 ] && brew install $dep
- done
- envpath="$programspath/env"
- [ ! -d "$envpath" ] && virtualenv $programspath/env
- source $envpath/bin/activate
- pip install -r $installerpath/requirements.txt
- else
- curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
- sudo apt-get install -y tmux
- sudo apt-get install -y vim
- sudo apt-get install -y autossh
- sudo apt-get install -y git-core
- sudo apt-get install -y build-essential
- sudo apt-get install -y nodejs
- sudo apt-get install -y python-dev
- sudo apt-get install -y lame
- sudo apt-get install -y ezstream
- sudo apt-get install -y cmake
- sudo apt-get install -y rtl-sdr
- wget https://bootstrap.pypa.io/get-pip.py
- sudo python get-pip.py
- sudo apt-get install -y portaudio19-dev
- sudo pip install pyaudio
- sudo apt-get install -y ffmpeg
- sudo pip install pydub
- sudo pip install numpy
- sudo apt-get install -y gfortran libopenblas-dev liblapack-dev
- sudo pip install scipy
- sudo apt-get install -y python-matplotlib
- #sudo apt-get install -y python-mysqldb
- sudo apt-get install -y curl
- #sudo pip install mysql-connector==2.1.4
- sudo pip install requests
- fi
- cd $programspath
- #download fourier software
- git clone $gitbase/fourier-common.git common
- git clone $gitbase/fourier-server.git server
- git clone $gitbase/fourier-fourier.git fourier
- git clone $gitbase/fourier-alt.git fourier-alt
- git clone $gitbase/fourier-monitor.git monitor
- git clone $gitbase/fourier-uploader.git uploader
- git clone $gitbase/fourier-ondemand.git ondemand
- #install fourier-server dependencies
- cd $programspath/server
- npm install
- #install fourier-monitor dependencies
- cd $programspath/monitor
- npm install
- #install fourier-uploader dependencies
- cd $programspath/uploader
- npm install
- #install fourier-ondemand dependencies
- cd $programspath/ondemand
- npm install
- sudo npm install -g pm2
- # build sdr lib
- if [[ "$OSTYPE" != darwin* ]]; then
- sudo apt-get install -y libusb-1.0-0-dev
- cd $programspath
- git clone https://github.com/niofis/rtl-sdr.git
- cd $programspath/rtl-sdr
- mkdir build
- cd build
- cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON
- make
- sudo cp ./src/rtl_fm /usr/bin/rtl_fm
- echo "SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", MODE:="0666"" | sudo tee -a /etc/udev/rules.d/rtl-sdr.rules
- #build and install nim
- cd $programspath
- curl -L https://nim-lang.org/download/nim-0.17.0.tar.xz -o nim-0.17.0.tar.xz
- tar xvf nim-0.17.0.tar.xz
- cd nim-0.17.0
- sh build.sh
- bin/nim c koch
- ./koch tools
- echo "export PATH=$programspath/nim-0.17.0/bin:$PATH" >> ~/.bashrc
- fi
- #build fourier-alt
- cd $programspath/fourier-alt
- nimble build
- #configure ramdisk
- #sudo mkdir -p /mnt/ramdisk
- #echo "ramfs /mnt/ramdisk ramfs nodev,nosuid,noexec,nodiratime,umask=000,noatime,size=256m 0 0" | sudo tee -a /etc/fstab
- #sudo chgrp plugdev /mnt/ramdisk
- #sudo chmod g+w /mnt/ramdisk
- #sudo chmod +t /mnt/ramdisk
- #cd ~
- #curl -L -o fourier.service https://gist.githubusercontent.com/niofis/86e6e3fbe72a01263fbd388bde7953ea/raw/
- #sudo mv fourier.service /etc/systemd/system/fourier.service
- #sudo systemctl enable fourier
- [ ! -f "$configfile" ] && \
- python $installerpath/configure.py \
- $installerpath/fourier-config.json \
- $configfile \
- -programs "$programspath" \
- -receivers $RECEIVERS_COUNT
-
- if [[ "$OSTYPE" != darwin* ]]; then
- sudo mysql -u root -e "create database fourier;"
- sudo mysql -u root -e "create user 'fourier'@'localhost' identified by 'Sup3rDuper!';"
- sudo mysql -u root -e "grant all privileges on fourier.* to 'fourier'@'localhost';flush privileges;"
- cd ~
- curl -L -o fourier.sql https://gist.githubusercontent.com/niofis/cd843500ac96fe8ddc8f39a58a4afc55/raw/
- sudo mysql -u root -h localhost fourier < fourier.sql
- curl -L -o Fourier-key.json https://gist.githubusercontent.com/niofis/7f8ced8fc878acf8c9b45d8db3bb5458/raw/
- sudo mv Fourier-key.json /etc/Fourier-key.json
- fi
- echo "****************************************************************************"
- echo "REMEMBER: Initialize attached storage and create a symlink named $datapath pointing to the storage volume"
- echo "****************************************************************************"
|