Update update.sh

merge-requests/1/head
Esteban Mackay Q 2 years ago
parent 0f7f8a7429
commit 0db80961c1

@ -6,92 +6,6 @@ if [[ $EUID -ne 0 ]]; then
exit 1
fi
# Actualizar la lista de paquetes una vez al principio
sudo apt-get update
# Función para verificar e instalar una aplicación
check_and_install() {
app=$1
if ! dpkg -s $app >/dev/null 2>&1; then
echo "$app no está instalado. Instalando..."
sudo apt-get install $app -y
echo "$app instalado correctamente."
else
echo "Verificando si hay actualizaciones para $app..."
available_version=$(apt-cache policy $app | grep 'Candidate' | awk '{print $2}')
current_version=$(dpkg -s $app | grep 'Version' | awk '{print $2}')
if [ "$available_version" != "$current_version" ]; then
echo "Hay una versión actualizada de $app disponible. Actualizando..."
sudo apt-get install --only-upgrade $app -y
echo "$app actualizado correctamente."
else
echo "$app ya está instalado y actualizado."
fi
fi
}
# Lista de aplicaciones para verificar e instalar
apps=("wget" "git" "sudo" "python3" "python3-pip" "python3-dev" "python3-venv" "libffi-dev" "libssl-dev" "cargo" "pkg-config" "sed" "default-libmysqlclient-dev" "libmysqlclient-dev" "build-essential" "zip" "unzip" "python3-distutils" "python3-twisted" "python3-bitarray" "rrdtool" "openssl")
# Verificar e instalar cada aplicación
for app in "${apps[@]}"; do
check_and_install $app
done
# Verificar y actualizar python3-venv si no está instalado
if ! dpkg -s python3-venv >/dev/null 2>&1; then
echo "python3-venv no está instalado. Instalando..."
sudo apt-get install python3-venv -y
echo "python3-venv instalado correctamente."
fi
# Crear y activar un entorno virtual
cd /opt/
python3 -m venv myenv
source myenv/bin/activate
# Instalar pip en el entorno virtual
wget https://bootstrap.pypa.io/pip/get-pip.py
python3 get-pip.py
rm get-pip.py
# Instalar paquetes en el entorno virtual
sudo apt install -y libssl-dev
python3 -m pip install --no-cache-dir --upgrade pip setuptools
python3 -m pip install --no-cache-dir cryptography pyopenssl autobahn Twisted dmr_utils3 bitstring jinja2 markupsafe bitarray configparser aprslib attrs
# Instalar Rust y configurar versión
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustup install 1.71.1
rustup default 1.71.1
# Desactivar el entorno virtual
deactivate
# Crear archivo requirements.txt y instalar paquetes
cat <<EOF | sudo tee /opt/requirements.txt
cryptography
pyopenssl
autobahn
Twisted
dmr_utils3
bitstring
jinja2
markupsafe
bitarray
configparser
aprslib
attrs
EOF
sudo pip install --no-cache-dir --upgrade -r /opt/requirements.txt
echo "Instalación completa."
##############
cd /
@ -419,8 +333,77 @@ fi
############
sudo cat > /opt/fdmr-update.sh <<- "EOFD1"
#!/bin/bash
#####################################################################################################################
#!/bin/bash
# Verificar si el usuario tiene permisos de root
if [[ $EUID -ne 0 ]]; then
echo "Este script debe ejecutarse como usuario ROOT"
exit 1
fi
# Actualizar la lista de paquetes una vez al principio
sudo apt-get update
# Función para verificar e instalar una aplicación
check_and_install() {
app=$1
if ! dpkg -s $app >/dev/null 2>&1; then
echo "$app no está instalado. Instalando..."
sudo apt-get install $app -y
echo "$app instalado correctamente."
else
echo "Verificando si hay actualizaciones para $app..."
available_version=$(apt-cache policy $app | grep 'Candidate' | awk '{print $2}')
current_version=$(dpkg -s $app | grep 'Version' | awk '{print $2}')
if [ "$available_version" != "$current_version" ]; then
echo "Hay una versión actualizada de $app disponible. Actualizando..."
sudo apt-get install --only-upgrade $app -y
echo "$app actualizado correctamente."
else
echo "$app ya está instalado y actualizado."
fi
fi
}
# Lista de aplicaciones para verificar e instalar
apps=("wget" "git" "sudo" "python3" "python3-pip" "python3-dev" "python3-venv" "libffi-dev" "libssl-dev" "cargo" "pkg-config" "sed" "default-libmysqlclient-dev" "libmysqlclient-dev" "build-essential" "zip" "unzip" "python3-distutils" "python3-twisted" "python3-bitarray" "rrdtool" "openssl" "mariadb-server" "php" "libapache2-mod-php" "php-zip" "php-mbstring" "php-cli" "php-common" "php-curl" "php-xml" "php-mysql")
# Verificar e instalar cada aplicación
for app in "${apps[@]}"; do
check_and_install $app
done
# Verificar y actualizar python3-venv si no está instalado
if ! dpkg -s python3-venv >/dev/null 2>&1; then
echo "python3-venv no está instalado. Instalando..."
sudo apt-get install python3-venv -y
echo "python3-venv instalado correctamente."
fi
# Crear y activar un entorno virtual
cd /opt/
python3 -m venv myenv
source myenv/bin/activate
# Instalar pip en el entorno virtual
wget https://bootstrap.pypa.io/pip/get-pip.py
python3 get-pip.py
rm get-pip.py
# Instalar paquetes en el entorno virtual
sudo apt install -y libssl-dev
python3 -m pip install --no-cache-dir --upgrade pip setuptools
python3 -m pip install --no-cache-dir cryptography pyopenssl autobahn Twisted dmr_utils3 bitstring jinja2 markupsafe bitarray configparser aprslib attrs
# Instalar Rust y configurar versión
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustup install 1.71.1
rustup default 1.71.1
##############
cd /
variable=$(grep "SERVER_ID:" /opt/FreeDMR/config/FreeDMR.cfg | grep -Eo '[0-9]{1,9}')
if [ -z "$variable" ]
@ -499,8 +482,8 @@ then
sudo rm -rf /var/log/FreeDMR
fi
#
sudo -H pip3 install --upgrade pip
pip install pyopenssl --upgrade
#sudo -H pip3 install --upgrade pip
#pip install pyopenssl --upgrade
cd /opt
git clone https://gitlab.hacknix.net/hacknix/FreeDMR.git
sudo rm /opt/FreeDMR/hotspot_proxy_v2.py
@ -572,25 +555,105 @@ EOFD1
######################################### FDMR-Monitor Update ###############################################################
sudo cat > /opt/monitor-update.sh <<- "EOFB1"
#!/bin/bash
#####################################################################################################################
# rust
#####################################################################################################################
#!/bin/bash
if command -v rustc &>/dev/null; then
echo "Rust está instalado. Versión:"
rustc --version
# Verificar si el usuario tiene permisos de root
if [[ $EUID -ne 0 ]]; then
echo "Este script debe ejecutarse como usuario ROOT"
exit 1
fi
# Actualizar la lista de paquetes una vez al principio
sudo apt-get update
# Función para verificar e instalar una aplicación
check_and_install() {
app=$1
if ! dpkg -s $app >/dev/null 2>&1; then
echo "$app no está instalado. Instalando..."
sudo apt-get install $app -y
echo "$app instalado correctamente."
else
echo "Rust no está instalado. Instalando..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh
chmod +x rustup.sh
./rustup.sh -y
source "$HOME/.cargo/env"
rustup update
rustup update stable
echo "Rust ha sido instalado correctamente. Versión:"
rustc --version
rm rustup.sh
echo "Verificando si hay actualizaciones para $app..."
available_version=$(apt-cache policy $app | grep 'Candidate' | awk '{print $2}')
current_version=$(dpkg -s $app | grep 'Version' | awk '{print $2}')
if [ "$available_version" != "$current_version" ]; then
echo "Hay una versión actualizada de $app disponible. Actualizando..."
sudo apt-get install --only-upgrade $app -y
echo "$app actualizado correctamente."
else
echo "$app ya está instalado y actualizado."
fi
fi
}
# Lista de aplicaciones para verificar e instalar
apps=("wget" "git" "sudo" "python3" "python3-pip" "python3-dev" "python3-venv" "libffi-dev" "libssl-dev" "cargo" "pkg-config" "sed" "default-libmysqlclient-dev" "libmysqlclient-dev" "build-essential" "zip" "unzip" "python3-distutils" "python3-twisted" "python3-bitarray" "rrdtool" "openssl" "mariadb-server" "php" "libapache2-mod-php" "php-zip" "php-mbstring" "php-cli" "php-common" "php-curl" "php-xml" "php-mysql")
# Verificar e instalar cada aplicación
for app in "${apps[@]}"; do
check_and_install $app
done
# Verificar y actualizar python3-venv si no está instalado
if ! dpkg -s python3-venv >/dev/null 2>&1; then
echo "python3-venv no está instalado. Instalando..."
sudo apt-get install python3-venv -y
echo "python3-venv instalado correctamente."
fi
# Crear y activar un entorno virtual
cd /opt/
python3 -m venv myenv
source myenv/bin/activate
# Instalar pip en el entorno virtual
wget https://bootstrap.pypa.io/pip/get-pip.py
python3 get-pip.py
rm get-pip.py
# Instalar paquetes en el entorno virtual
sudo apt install -y libssl-dev
python3 -m pip install --no-cache-dir --upgrade pip setuptools
python3 -m pip install --no-cache-dir cryptography pyopenssl autobahn Twisted dmr_utils3 bitstring jinja2 markupsafe bitarray configparser aprslib attrs
# Instalar Rust y configurar versión
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustup install 1.71.1
rustup default 1.71.1
# Desactivar el entorno virtual
deactivate
# Crear archivo requirements.txt y instalar paquetes
cat <<EOF | sudo tee /opt/requirements.txt
cryptography
pyopenssl
autobahn
Twisted
dmr_utils3
bitstring
jinja2
MarkupSafe
bitarray
configparser
aprslib
attrs
setuptools
wheel
service_identity
pyOpenSSL
mysqlclient
EOF
sudo pip install --no-cache-dir --upgrade -r /opt/requirements.txt
echo "Instalación completa."
##############
cd /opt
variable1=$(grep "REPORT_NAME =" /opt/FDMR-Monitor/fdmr-mon.cfg)
variable2=$(grep "THEME_COLOR =" /opt/FDMR-Monitor/fdmr-mon.cfg)
@ -752,7 +815,7 @@ sudo sed -i "s/www\/html/www\/fdmr/g" /opt/FDMR-Monitor/html/*.*
sudo sed -i "s/www\/html/www\/fdmr/g" /opt/FDMR-Monitor/sysinfo/*.*
# Install the required support programs
sudo pip install -U -r requirements.txt
#sudo pip install -U -r requirements.txt
cd /opt/FDMR-Monitor/
cp /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg /opt/FDMR-Monitor/fdmr-mon.cfg
###############################
@ -1162,26 +1225,105 @@ EOFB1
######################################### FDMR-Monitor2 Update ###############################################################
sudo cat > /opt/monitor-update2.sh <<- "EOFB2"
#!/bin/bash
#####################################################################################################################
# rust
#####################################################################################################################
#!/bin/bash
if command -v rustc &>/dev/null; then
echo "Rust está instalado. Versión:"
rustc --version
# Verificar si el usuario tiene permisos de root
if [[ $EUID -ne 0 ]]; then
echo "Este script debe ejecutarse como usuario ROOT"
exit 1
fi
# Actualizar la lista de paquetes una vez al principio
sudo apt-get update
# Función para verificar e instalar una aplicación
check_and_install() {
app=$1
if ! dpkg -s $app >/dev/null 2>&1; then
echo "$app no está instalado. Instalando..."
sudo apt-get install $app -y
echo "$app instalado correctamente."
else
echo "Rust no está instalado. Instalando..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh
chmod +x rustup.sh
./rustup.sh -y
source "$HOME/.cargo/env"
rustup update
rustup update stable
echo "Rust ha sido instalado correctamente. Versión:"
rustc --version
rm rustup.sh
echo "Verificando si hay actualizaciones para $app..."
available_version=$(apt-cache policy $app | grep 'Candidate' | awk '{print $2}')
current_version=$(dpkg -s $app | grep 'Version' | awk '{print $2}')
if [ "$available_version" != "$current_version" ]; then
echo "Hay una versión actualizada de $app disponible. Actualizando..."
sudo apt-get install --only-upgrade $app -y
echo "$app actualizado correctamente."
else
echo "$app ya está instalado y actualizado."
fi
fi
}
# Lista de aplicaciones para verificar e instalar
apps=("wget" "git" "sudo" "python3" "python3-pip" "python3-dev" "python3-venv" "libffi-dev" "libssl-dev" "cargo" "pkg-config" "sed" "default-libmysqlclient-dev" "libmysqlclient-dev" "build-essential" "zip" "unzip" "python3-distutils" "python3-twisted" "python3-bitarray" "rrdtool" "openssl" "mariadb-server" "php" "libapache2-mod-php" "php-zip" "php-mbstring" "php-cli" "php-common" "php-curl" "php-xml" "php-mysql")
# Verificar e instalar cada aplicación
for app in "${apps[@]}"; do
check_and_install $app
done
# Verificar y actualizar python3-venv si no está instalado
if ! dpkg -s python3-venv >/dev/null 2>&1; then
echo "python3-venv no está instalado. Instalando..."
sudo apt-get install python3-venv -y
echo "python3-venv instalado correctamente."
fi
# Crear y activar un entorno virtual
cd /opt/
python3 -m venv myenv
source myenv/bin/activate
# Instalar pip en el entorno virtual
wget https://bootstrap.pypa.io/pip/get-pip.py
python3 get-pip.py
rm get-pip.py
# Instalar paquetes en el entorno virtual
sudo apt install -y libssl-dev
python3 -m pip install --no-cache-dir --upgrade pip setuptools
python3 -m pip install --no-cache-dir cryptography pyopenssl autobahn Twisted dmr_utils3 bitstring jinja2 markupsafe bitarray configparser aprslib attrs
# Instalar Rust y configurar versión
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustup install 1.71.1
rustup default 1.71.1
# Desactivar el entorno virtual
deactivate
# Crear archivo requirements.txt y instalar paquetes
cat <<EOF | sudo tee /opt/requirements.txt
cryptography
pyopenssl
autobahn
Twisted
dmr_utils3
bitstring
jinja2
MarkupSafe
bitarray
configparser
aprslib
attrs
setuptools
wheel
service_identity
pyOpenSSL
mysqlclient
EOF
sudo pip install --no-cache-dir --upgrade -r /opt/requirements.txt
echo "Instalación completa."
##############
cd /
if systemctl status http.server-fdmr.service |grep "active" >/dev/null 2>&1
then systemctl stop http.server-fdmr.service
@ -1281,7 +1423,7 @@ cd /opt
sudo git clone https://github.com/CS8ABG/FDMR-Monitor.git /opt/FDMR-Monitor2
cd /opt/FDMR-Monitor2
sudo git checkout Self_Service
sudo pip install -U -r requirements.txt
#sudo pip install -U -r requirements.txt
chmod 777 /opt/FDMR-Monitor2/data

Loading…
Cancel
Save

Powered by TurnKey Linux.