diff --git a/easy-fdmr.sh b/easy-fdmr.sh index c50f191..9eae2f6 100644 --- a/easy-fdmr.sh +++ b/easy-fdmr.sh @@ -55,6 +55,11 @@ cd /opt/ python3 -m venv myenv source myenv/bin/activate +# Crear y activar un entorno virtual +cd /opt/ +python3 -m venv myenv +source myenv/bin/activate + # Instalar pip en el entorno virtual if [ -f "/opt/get-pip.py" ]; then rm /opt/get-pip.* @@ -66,41 +71,48 @@ rm get-pip.* # Instalar paquetes en el entorno virtual apt-get install -y libssl-dev -python3 -m pip install pip setuptools -python3 -m pip install cryptography Twisted bitstring MarkupSafe bitarray configparser aprslib attrs wheel service_identity pyOpenSSL mysqlclient tinydb ansi2html mysql-connector-python pandas xlsxwriter cursor pynmea2 maidenhead flask folium mysql-connector resettabletimer setproctitle requests libscrc Pyro5 dmr_utils3 spyne autobahn jinja2 service-identity - # Desactivar el entorno virtual deactivate - -# 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.72.0 -rustup default 1.72.0 - # Detectar el sistema operativo y su versión if [ -f "/etc/os-release" ]; then . /etc/os-release OS=$ID VERSION=$VERSION_ID + CODENAME=$VERSION_CODENAME else echo "No se pudo detectar el sistema operativo." exit 1 fi + # Instalación de módulos pip según el sistema operativo -if [ "$OS" == "debian" ] && [ "$VERSION" == "12" ]; then +if [ "$OS" == "debian" ] && { [ "$VERSION" == "12" ] || [ "$CODENAME" == "trixie" ]; }; then /usr/bin/python3 -m pip install --break-system-packages pyOpenSSL autobahn jinja2 dmr-utils3 ansi2html aprslib tinydb mysqlclient setproctitle pynmea2 maidenhead Twisted spyne Pyro5 bitstring bitarray dmr_utils3 configparser resettabletimer setuptools wheel MarkupSafe service-identity source myenv/bin/activate - /usr/bin/python3 -m pip uninstall --break-system-packages twisted -y - /usr/bin/python3 -m pip install --break-system-packages twisted==22.10.0 + /usr/bin/python3 -m pip uninstall --break-system-packages Twisted -y + /usr/bin/python3 -m pip install --break-system-packages Twisted==22.10. deactivate else /usr/bin/python3 -m pip install --upgrade pyOpenSSL autobahn jinja2 dmr-utils3 ansi2html aprslib tinydb mysqlclient setproctitle pynmea2 maidenhead Twisted spyne Pyro5 bitstring bitarray dmr_utils3 configparser resettabletimer setuptools wheel MarkupSafe service-identity - sudo pip3 uninstall -y twisted --quiet + sudo pip3 uninstall -y Twisted --quiet pip install Twisted==22.10.0 fi +# Función para verificar si Rust 1.72.0 o superior está instalado +is_rust_installed() { + command -v rustc &>/dev/null && { + installed_version=$(rustc --version | awk '{print $2}') + required_version="1.72.0" + [ "$(printf '%s\n' "$required_version" "$installed_version" | sort -V | head -n1)" = "$required_version" ] + } +} + +if ! is_rust_installed; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + source $HOME/.cargo/env + rustup install 1.72.0 + rustup default 1.72.0 +fi + echo "Instalación completa." # Configuración adicional (timezone, cron, etc.)