emq-TE1/emq-TE1x.sh

335 lines
7.2 KiB
Bash

#!/bin/sh
echo Actualizando sistema
apt-get update -y
#apt-get upgrade -y
#apt-get dist-upgrade -y
############################################
echo instalando pre-requisitos
######################################################################################################
#!/bin/sh
apt-get install sudo -y
sudo apt-get purge needrestart -y
sudo apt-get install wget -y
sudo apt-get install git -y
sudo apt-get install screen -y
sudo apt-get install gcc -y
sudo apt-get install g++ -y
sudo apt-get install make -y
sudo apt-get install cmake -y
sudo apt-get install musl-dev -y
sudo apt-get install python2 -y
update-alternatives --install /usr/bin/python python /usr/bin/python3 1
sudo apt-get install libasound2-dev -y
sudo apt-get install libudev-dev -y
sudo apt-get install libusb-1.0-0-dev -y
sudo apt-get install libx11-dev -y
sudo apt-get install libfftw3-dev -y
sudo apt-get install libpulse-dev -y
sudo apt-get install build-essential -y
sudo apt-get install alsa-utils -y
sudo apt-get install rsyslog -y
sudo apt-get install logrotate -y
sudo apt-get install gpsd libgps-dev -y
sudo apt-get install qt4-qmake -y
sudo apt-get install libtool -y
sudo apt-get install autoconf -y
sudo apt-get install automake -y
sudo apt-get install python-pkg-resources -y
sudo apt-get install sox -y
sudo apt-get install git-core -y
sudo apt-get install libi2c-dev -y
sudo apt-get install i2c-tools -y
sudo apt-get install lm-sensors -y
sudo apt-get install wiringpi -y
sudo apt-get install chkconfig -y
sudo apt-get install libffi-dev -y
sudo apt-get install libssl-dev -y
sudo apt-get install cargo -y
sudo apt-get install sed -y
sudo apt install python3 -y
sudo apt install python3-pip -y
sudo apt install python3-distutils -y
sudo apt install python3-dev -y
sudo apt install python3-websockets
sudo apt install python3-psutil
sudo apt-get install python3-serial
sudo apt install python3-gpiozero -y
sudo apt-get install gpsd gpsd-clients python-gps -y
sudo pip install aprslib
sudo pip install tinydb
sudo apt install socket
sudo apt install threading
sudo apt install queue
sudo apt install sys
sudo apt install os
sudo apt install time
sudo apt install re
sudo apt install datetime
sudo apt install signal
sudo apt install datetime
sudo apt install bisect
sudo apt install struct
sudo apt install ansi2html
sudo apt install logrotate
sudo pip3 install ansi2html
sudo apt-get install python-pip -y
sudo apt-get install python-dev -y
sudo apt-get install rrdtool -y
##################
sudo cat > /opt/emq-ver <<- "EOF"
EMQ-VER: 21
EOF
#########
sh -c "$(curl -fsSL https://raw.githubusercontent.com/hp3icc/emq-TE1ws/main/menu.sh)"
########################
if [ -f "/opt/obp.txt" ]
then
echo "found file"
else
sudo cat > /opt/obp.txt <<- "EOF"
#Coloque abajo su lista de obp y peer
EOF
fi
####################
cd /home/
wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
sudo cat > /home/requirements.txt <<- "EOF"
autobahn
jinja2==2.11.3
bitstring>=3.1.5
bitarray>=0.8.1
Twisted>=16.3.0
dmr_utils3>=0.1.19
configparser>=3.0.0
aprslib>=0.6.42
tinydb
pynmea2
maidenhead
requests
libscrc
flask
folium
mysql-connector
resettabletimer>=0.7.0
setproctitle
EOF
#
pip3 install setuptools wheel
pip3 install -r requirements.txt
sudo rm requirements.txt
sudo rm get-pip.py
#
#########################
if [ -d "/var/www" ]
then
rm -r /var/www
#echo "found file"
fi
mkdir /var/www
mkdir /var/www/html
if [ -d "/var/log/ysf2dmr" ]
then
rm -r /var/log/ysf2dmr
#echo "found file"
fi
mkdir /var/log/ysf2dmr
if [ -d "/var/log/mmdvm" ]
then
rm -r /var/log/mmdvm
#echo "found file"
fi
mkdir /var/log/mmdvm
if [ -d "/var/log/direwolf" ]
then
rm -r /var/log/direwolf
#echo "found file"
fi
mkdir /var/log/direwolf
if [ -d "/var/log/mmdvmh" ]
then
rm -r /var/log/mmdvmh
#echo "found file"
fi
mkdir /var/log/mmdvmh
if [ -d "/var/log/DMRGateway" ]
then
rm -r /var/log/DMRGateway
#echo "found file"
fi
mkdir /var/log/DMRGateway
if [ -d "/var/log/FreeDMR" ]
then
rm -r /var/log/FreeDMR
#echo "found file"
fi
mkdir /var/log/FreeDMR
if [ -d "/var/log/YSFReflector" ]
then
rm -r /var/log/YSFReflector
#echo "found file"
fi
mkdir /var/log/YSFReflector
sudo chmod +777 /var/log
sudo chmod +777 /var/log/*
####################################
cd /boot
sudo sed -i 's/console=serial0,115200 //' cmdline.txt
sudo systemctl stop serial-getty@ttyAMA0.service
sudo systemctl stop bluetooth.service
sudo systemctl disable serial-getty@ttyAMA0.service
sudo systemctl disable bluetooth.service
sudo sed -i 's/#dtparam=i2c_arm=on/dtparam=i2c_arm=on/' config.txt
sudo sed -i 's/dtparam=audio=on/#dtparam=audio=on/' config.txt
echo "enable_uart=1" >> config.txt
echo "dtoverlay=pi3-disable-bt" >> config.txt
echo "dtparam=spi=on" >> config.txt
##################
cat > /lib/systemd/system/monp.service <<- "EOF"
[Unit]
Description=sudo modprobe i2c-dev
#Wants=network-online.target
#After=syslog.target network-online.target
[Service]
User=root
#ExecStartPre=/bin/sleep 1800
ExecStart=sudo modprobe i2c-dev
[Install]
WantedBy=multi-user.target
EOF
##########
##############################
cat > /usr/local/bin/rpt-on.sh <<- "EOF"
#!/bin/bash
#TI4OP Oscar, [1/25/2022 12:51 PM]
if [ "$(grep "Duplex=1" /opt/MMDVMHost/MMDVM.ini)" != "" ]; then
# echo "rpt"
sudo systemctl enable mmdvmh.service
else
# echo "gateway"
sudo systemctl disable mmdvmh.service
fi
EOF
#
sudo chmod +x /usr/local/bin/rpt-on.sh
#########################
cd /opt
git clone https://github.com/g4klx/MMDVMHost.git
cd MMDVMHost/
sudo make
sudo make install
git clone https://github.com/hallard/ArduiPi_OLED
cd ArduiPi_OLED
sudo make
cd /opt/MMDVMHost/
make clean
sudo make -f Makefile.Pi.OLED
groupadd mmdvm
useradd mmdvm -g mmdvm -s /sbin/nologin
chown mmdvm /var/log/
#################################################################################################################################
#############################################################
########
########
sudo chown -R mmdvm:mmdvm /opt/MMDVMHost/MMDVMHost
sudo chmod +777 /opt/*
sudo chmod +777 /opt/MMDVMHost-Websocketboard/*
sudo chmod +777 /opt/WSYSFDash/*
sudo chmod +777 /opt/direwolf/*
sudo chmod +777 /opt/direwolf/dw.conf
sudo chmod +777 /opt/direwolf/sdr.conf
sudo chmod +777 /opt/direwolf/src/*
sudo chmod +777 /opt/MMDVMHost/*
sudo chmod +777 /opt/MMDVMHost/MMDVM.ini
sudo chmod +777 /opt/YSF2DMR/*
sudo chmod +777 /opt/YSF2DMR/YSF2DMR.ini
sudo chmod +777 /opt/ionsphere/*
sudo chmod +777 /opt/ionsphere/ionosphere-raspberry-pi/config/config.yml
sudo chmod +777 /opt/pymultimonaprs/*
sudo chmod +777 /opt/multimon-ng/*
sudo chmod +777 /opt/kalibrate-rtl/*
sudo chmod +777 /opt/MMDVM_CM/*
sudo chmod +777 /opt/MMDVM_Bridge/*
sudo chmod +777 /opt/MMDVM_Bridge/MMDVM_Bridge.ini
sudo chmod +777 /etc/pymultimonaprs.json
sudo chmod +777 /opt/D-APRS/user_settings.txt
sudo chmod +x /opt/FDMR-Monitor/sysinfo/graph.sh
sudo chmod +x /opt/FDMR-Monitor/sysinfo/cpu.sh
sudo chmod +x /usr/bin/python3
sudo chmod +x /opt/YSF2DMR/DMRIDUpdate.sh
sudo chmod +x /opt/MMDVMHost/DMRIDUpdate.sh
sudo chmod +x /opt/D-APRS/*.py
sudo chmod +x /opt/D-APRS/dashboard/*.py
sudo chmod +x /usr/local/bin/rebooter1.sh
sudo systemctl daemon-reload
sudo systemctl disable netcheck.service
sudo systemctl disable systemd-networkd-wait-online.service
cd /tmp/
#####
##
history -c && history -w