| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- # version 1.0.4
- # install essential software
- # sudo apt-get update
- installer_version=1.0.4
- programspath=~/programs
- installerpath=$(pwd)
- configfile='/etc/fourier-config.json'
- gitbase="gogs@git.miralo.xyz:AudioValid"
- tunnel_user=rtunnel
- datapath='/var/fourier'
- serverhost='monitor.audiovalid.com'
- tunnelfile="$programspath/ssh-tunnel.sh"
- mysql_user=fourier
- mysql_passwd='Sup3rDuper!'
- mysql_db=fourier
- mount_point=/media/datadrive
- echo "Fourier installer $installer_version"
- echo "------------------------------------"
- clonerepo() {
- GIT_SSH_COMMAND="ssh -i $installerpath/repokey -o StrictHostKeychecking=no" \
- git clone $gitbase/$1 $2
- }
- [ ! -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
- read -p "Box ID: " BOX_ID
- read -p "API secret: " API_SECRET
- sudo apt-get install -y python python-pip python-setuptools
- findmnt "$mount_point"
- if [ "$?" -neq 0 ]; then
- echo -e 'Data drive is not mounted'
- fi
- keyspath=~/.ssh
- keyfile="$keyspath/id_rsa"
- [ ! -d "$keyspath" ] && mkdir $keyspath
- ssh-keygen -t rsa -b 2048 -C "$HOSTNAME" -P "" -f $keyfile
- keycontent=$(cat $keyfile.pub)
- curl -X POST -F "key=$keycontent" \
- -H "Authorization: $BOX_ID $API_SECRET" \
- https://api.audiovalid.com/public-key
- # Give permissions to tune DVB devices
- # So it can use the devices in /dev/dvb/adapter*
- sudo usermod -a -G video fourier
- curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
- sudo apt-get install -y alsa-utils alsa-tools
- sudo apt-get install -y libudev-dev
- 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
- # Install to fix usb permission
- sudo apt-get install -y rtl-sdr
- sudo apt-get install -y libusb-1.0-0-dev
- sudo apt-get install -y sqlite3
- sudo apt-get install -y portaudio19-dev
- sudo apt-get install -y dvb-apps
- sudo pip install pyaudio pyusb pydub numpy requests \
- scipy python-firebase tornado mutagen \
- pyopenssl google-auth
- sudo apt-get install -y ffmpeg
- sudo apt-get install -y gfortran libopenblas-dev liblapack-dev
- sudo apt-get install -y python-matplotlib
- sudo apt-get install -y curl
- sudo apt-get install -y libshout3 libshout3-dev
- sudo npm install -g http-server
- cd tools
- sudo python ./setup.py install
- cd ..
- sudo chmod 0600 $installerpath/repokey
- cd $installerpath
- sudo mv fourier-key.json /etc/Fourier-key.json
- cd $programspath
- clonerepo fourier-module.git module
- clonerepo fourier-common.git common
- clonerepo fourier-recorder.git recorder
- clonerepo fourier-fourier.git fourier
- clonerepo fourier-alt.git fourier-alt
- clonerepo fourier-monitor.git monitor
- clonerepo fourier-uploader.git uploader
- clonerepo fourier-ondemand.git ondemand
- clonerepo rtl-sdr.git rtl-sdr
- cd $programspath/recorder
- npm install
- cd $programspath/monitor
- npm install
- cd $programspath/uploader
- npm install
- cd $programspath/module
- sudo python setup.py install
- cd $programspath/ondemand
- sudo python setup.py install
- # Build sdr library
- 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
- #sudo make install
- echo "SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", MODE:="0666"" | sudo tee -a /etc/udev/rules.d/rtl-sdr.rules
- sudo npm install -g pm2
- [ ! -f "$configfile" ] && \
- sudo python $installerpath/configure.py \
- $installerpath/fourier-config.json \
- $configfile \
- -programs "$programspath" \
- -receivers $RECEIVERS_COUNT \
- -api-secret $API_SECRET \
- -box-id "$BOX_ID"
- echo "** Downloading TV channels."
- fourier tv update
- if [ "$?" -eq 0 ]; then
- cd "$programspath"
- pm2 start recorder
- pm2 start monitor
- pm2 start uploader
- pm2 start ondemand/ondemand/service.py \
- --interpreter=python \
- --name=ondemand
- cd "$datapath"
- pm2 start http-server
- cd "$programspath"
- pm2 save
- pm2 startup
- sudo env PATH=$PATH:/usr/bin \
- /usr/lib/node_modules/pm2/bin/pm2 \
- startup systemd -u fourier \
- --hp ~/
- fi
- if [ ! -f "/etc/systemd/system/ssh-tunnel.service" ]; then
- 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
- sudo mv $installerpath/ssh-tunnel.service \
- /etc/systemd/system/ssh-tunnel.service
- sudo systemctl enable ssh-tunnel
- sudo systemctl start ssh-tunnel
- fi
|