Compare commits

...

3 commits

Author SHA1 Message Date
af32c0015a
[ADDED] Script vpn_check.sh para verificar conexión a VPN
- Nuevo script que utiliza las funciones de detección de VPN en base.lib
- Muestra el tipo de VPN al que se está conectado o información si no hay conexión
- Añadidos mensajes internacionalizados en head.es
- Actualizada documentación en README.md

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-22 15:14:42 -05:00
bc5b424a61
[IMPROVED] Funciones para detección de VPN en base.lib
- Añadida función 'is_connected_to_vpn' para detectar conexiones VPN activas
- Añadida función 'get_vpn_type' para identificar el tipo específico de VPN
- Mejorada la detección de Pritunl para identificarlo correctamente
- Soporte para múltiples tipos de VPN: OpenVPN, Pritunl, WireGuard, NordVPN, etc.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-22 15:08:08 -05:00
9bf5f1bf7a
[ADDED] Scripts ollama_up.sh y ollama_down.sh para gestionar servicio Ollama (IA local)
- Creados scripts para iniciar y detener el servicio Ollama con podman-compose
- Actualizada la configuración para usar la imagen oficial desde docker.io
- Implementada compatibilidad con docker y podman
- Añadida documentación en README.md

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-21 20:08:22 -05:00
16 changed files with 589 additions and 29 deletions

View file

@ -31,7 +31,7 @@
- Use `bin/config/bash.header` how example to bash comment header - Use `bin/config/bash.header` how example to bash comment header
- For new projects created by Claude Code, use author: "Cortana Rosero One <cortana@rosero.one>" - For new projects created by Claude Code, use author: "Cortana Rosero One <cortana@rosero.one>"
- Include reference indicating generation by Claude Code and the version used - Include reference indicating generation by Claude Code and the version used
- Example header comment: - Example header comment for Cortana:
``` ```
# [Author] Cortana Rosero One <cortana@rosero.one> # [Author] Cortana Rosero One <cortana@rosero.one>
# [Generated] Created by Claude Code (claude-3-7-sonnet-20250219) # [Generated] Created by Claude Code (claude-3-7-sonnet-20250219)

View file

@ -67,6 +67,9 @@ bin/update.sh
| `bin/sora_enable.sh` | Activa el alias 'sora' para Aider permanentemente | | `bin/sora_enable.sh` | Activa el alias 'sora' para Aider permanentemente |
| `bin/sora_disable.sh` | Desactiva el alias 'sora' para Aider | | `bin/sora_disable.sh` | Desactiva el alias 'sora' para Aider |
| `bin/ai_token.sh` | Gestiona tokens de múltiples proveedores de IA vía SOPS | | `bin/ai_token.sh` | Gestiona tokens de múltiples proveedores de IA vía SOPS |
| `bin/ollama_up.sh` | Inicia el servicio Ollama (IA local) con podman-compose |
| `bin/ollama_down.sh` | Detiene el servicio Ollama (IA local) |
| `bin/ollama.sh` | Cliente para interactuar con Ollama (auto-inicia el servicio si es necesario) |
### Herramientas para Editores de Código ### Herramientas para Editores de Código
@ -93,6 +96,7 @@ bin/update.sh
| `bin/vpn_install.sh` | Instala el cliente Pritunl VPN | | `bin/vpn_install.sh` | Instala el cliente Pritunl VPN |
| `bin/vpn_install.sh --update` | Actualiza el cliente VPN a la última versión | | `bin/vpn_install.sh --update` | Actualiza el cliente VPN a la última versión |
| `bin/vpn_users.sh` | Gestiona usuarios de la VPN | | `bin/vpn_users.sh` | Gestiona usuarios de la VPN |
| `bin/vpn_check.sh` | Verifica conexión a VPN y muestra el tipo de VPN activo |
| `bin/gpg_init.sh` | Inicializa configuración GPG para cifrado seguro | | `bin/gpg_init.sh` | Inicializa configuración GPG para cifrado seguro |
### Gestión de Perfiles ### Gestión de Perfiles

View file

@ -1,11 +1,11 @@
--- ---
# Include: includes/load_messages.yaml # Apps: MRDevs Tools
# Include: bin/ansible/includes/load_messages.yaml
# Description: load messages languages # Description: load messages languages
# Author: Mauro Rosero P. # Author: Mauro Rosero P.
# Email: mauro@rosero.one (mauro.rosero@gmail.com) # Email: mauro@rosero.one (mauro.rosero@gmail.com)
# Organization: ROSERO ONE # Created: 2025-01-04 12:00:00
# Created: Ene 04, 2025 12:00:00 # Modified: 2025-01-05 00:00:00
# Updated: 2025-01-05 00:00:00
- name: Include language vars messages file - name: Include language vars messages file
ansible.builtin.include_vars: ansible.builtin.include_vars:

View file

@ -1,11 +1,11 @@
--- ---
# Include: includes/sops_credentials.yaml # Apps: MRDevs Tools
# Include: bin/ansible/includes/sops_credentials.yaml
# Description: Get sops secure encrypted credentials # Description: Get sops secure encrypted credentials
# Author: Mauro Rosero P. # Author: Mauro Rosero P.
# Email: mauro@rosero.one (mauro.rosero@gmail.com) # Email: mauro@rosero.one (mauro.rosero@gmail.com)
# Organization: ROSERO ONE # Created: 2025-01-04 12:00:00
# Created: Ene 04, 2025 12:00:00 # Modified: 2025-01-05 00:00:00
# Updated: 2025-01-05 00:00:00
- name: Get if credential access exists - name: Get if credential access exists
ansible.builtin.stat: ansible.builtin.stat:

View file

@ -5,16 +5,20 @@
# Global Definitions & Parameters # Global Definitions & Parameters
# Created 2024-03-14-00:12:00 # Created 2024-03-14-00:12:00
# Updated 2024-06-01-00:41:00 # Updated 2024-06-01-00:41:00
console: info: "INFO"
info: warn: "ALERTA"
hello: "{{ info }}Bienvenido, esto es una prueba" fail: "ERROR"
warn:
hello: "{{ warn }}Bienvenido, esto es una prueba" console:
error: info:
hello: "{{ fail }}Bienvenido, esto es una prueba" hello: "{{ info }}Bienvenido, esto es una prueba"
no_credentials: "{{ fail }}Archivo de credenciales sops no definido!" warn:
credentials_fail: "{{ fail }}Archivo de credenciales es incorrecto!" hello: "{{ warn }}Bienvenido, esto es una prueba"
no_pritunl_user: "{{ fail }}USUARIO PRITUNL VPN no fue definido!" error:
no_pritunl_email: "{{ fail }}Correo electrónico de USUARIO PRITUNL VPN no fue definido!" hello: "{{ fail }}Bienvenido, esto es una prueba"
no_pritunl_action: "{{ fail }}Acción para gestión de USUARIO PRITUNL VPN es invalida!" no_credentials: "{{ fail }}Archivo de credenciales sops no definido!"
credentials_fail: "{{ fail }}Archivo de credenciales es incorrecto!"
no_pritunl_user: "{{ fail }}USUARIO PRITUNL VPN no fue definido!"
no_pritunl_email: "{{ fail }}Correo electrónico de USUARIO PRITUNL VPN no fue definido!"
no_pritunl_action: "{{ fail }}Acción para gestión de USUARIO PRITUNL VPN es invalida!"

View file

@ -1,13 +1,11 @@
--- ---
# Devops Ansible Script # Apps: MRDevs Tools
# Playbook: pritunl_users.yaml # Playbook: bin/ansible/pritunl_users.yaml
# Description: Add, enable, disable or remove pritunl vpn users # Description: Add, enable, disable or remove pritunl vpn users
# Author: Mauro Rosero P. # Author: Mauro Rosero P.
# Email: mauro@rosero.one (mauro.rosero@gmail.com) # Email: mauro@rosero.one (mauro.rosero@gmail.com)
# Organization: ROSERO ONE # Created: 2025-01-04 12:00:00
# Created: Ene 04, 2025 12:00:00 # Modified: 2025-01-05 00:00:00
# Updated: 2025-01-05 00:00:00
- name: PLAYBOOK - {{ playbook_program | upper }} ({{ playbook_description | upper }}) - name: PLAYBOOK - {{ playbook_program | upper }} ({{ playbook_description | upper }})
hosts: [localhost] hosts: [localhost]

View file

@ -6,7 +6,7 @@
"gemini","Google Gemini API",0,1,0 "gemini","Google Gemini API",0,1,0
"hface","HuggingFace API",0,1,0 "hface","HuggingFace API",0,1,0
"brave","Brave Search API",0,1,0 "brave","Brave Search API",0,1,0
"replica","Replicate API",0,1,0 "digital","Replicate API (digital)",0,1,0
"serper","Serper Search API",0,1,0 "serper","Serper Search API",0,1,0
"voyage","Voyage RAG API",0,1,0 "voyage","Voyage RAG API",0,1,0
"apify","Apify Scrapping API",0,1,0 "apify","Apify Scrapping API",0,1,0

View file

@ -529,3 +529,157 @@ remove_cortana_alias() {
return 2 return 2
fi fi
} }
# Verifica si el sistema está conectado a una VPN
# Devuelve 0 si está conectado a una VPN, 1 si no lo está
is_connected_to_vpn() {
local vpn_interfaces=("tun" "tap" "ppp" "wg" "wireguard" "nordlynx" "mullvad" "proton")
local found_vpn=0
# Verificar si existe alguna interfaz VPN activa
for vpn_type in "${vpn_interfaces[@]}"; do
if ip addr | grep -q "${vpn_type}"; then
found_vpn=1
break
fi
done
# Verificar si hay procesos VPN en ejecución
if [ $found_vpn -eq 0 ]; then
for proc in "openvpn" "wireguard" "wg" "nordvpn" "protonvpn" "pritunl" "anyconnect" "vpnc"; do
if pgrep -x "$proc" >/dev/null; then
found_vpn=1
break
fi
done
fi
# Verificar conexiones de red que puedan indicar VPN
if [ $found_vpn -eq 0 ]; then
if netstat -rn | grep -q "tun\|tap\|ppp\|wg"; then
found_vpn=1
fi
fi
# Verificar reglas de firewall que puedan indicar VPN
if [ $found_vpn -eq 0 ]; then
if command -v iptables >/dev/null && iptables -L | grep -qi "vpn\|tunnel"; then
found_vpn=1
fi
fi
if [ $found_vpn -eq 1 ]; then
return 0 # Está conectado a una VPN
else
return 1 # No está conectado a una VPN
fi
}
# Identifica el tipo de VPN al que está conectado el sistema
# Devuelve el nombre del tipo de VPN o "Unknown" si no se puede determinar
# Si no está conectado a ninguna VPN, devuelve "Not Connected"
get_vpn_type() {
# Primero verificamos si hay una conexión VPN
is_connected_to_vpn
if [ $? -ne 0 ]; then
echo ""
return 1
fi
# Mapa de procesos VPN y su tipo correspondiente
declare -A vpn_process_map=(
["openvpn"]="OpenVPN"
["pritunl"]="Pritunl"
["pritunl-client"]="Pritunl"
["nordvpnd"]="NordVPN"
["protonvpn"]="ProtonVPN"
["wg-quick"]="WireGuard"
["wg"]="WireGuard"
["mullvad"]="Mullvad"
["expressvpnd"]="ExpressVPN"
["anyconnect"]="Cisco AnyConnect"
["vpnc"]="Cisco VPN"
["openconnect"]="OpenConnect"
["pppd"]="PPTP/L2TP"
["sstp-client"]="SSTP"
["tailscaled"]="Tailscale"
["zerotier-one"]="ZeroTier"
)
# Buscar procesos VPN conocidos
for proc in "${!vpn_process_map[@]}"; do
if pgrep -x "$proc" >/dev/null; then
echo "${vpn_process_map[$proc]}"
return 0
fi
done
# Si no encontramos procesos específicos, intentamos identificar por interfaces
if ip addr | grep -q "tun"; then
# Identificar si es Pritunl (tiene prioridad)
if systemctl is-active --quiet pritunl-client.service || pgrep -f "pritunl-client" >/dev/null || ps aux | grep -q "[p]ritunl"; then
echo "Pritunl"
# Verificar configuración de Pritunl
elif [ -d "$HOME/.pritunl" ] || [ -d "/etc/pritunl-client" ]; then
echo "Pritunl"
# Buscar indicadores adicionales de Pritunl
elif grep -q "pritunl" /var/log/syslog 2>/dev/null || grep -q "pritunl" /var/log/messages 2>/dev/null; then
echo "Pritunl"
# Verificar si es OpenVPN genérico
elif ps aux | grep -q "[o]penvpn"; then
echo "OpenVPN"
else
echo "TUN-based VPN"
fi
return 0
elif ip addr | grep -q "wg"; then
echo "WireGuard"
return 0
elif ip addr | grep -q "ppp"; then
echo "PPP-based VPN"
return 0
elif ip addr | grep -q "nordlynx"; then
echo "NordVPN (NordLynx)"
return 0
elif ip addr | grep -q "proton"; then
echo "ProtonVPN"
return 0
elif ip addr | grep -q "mullvad"; then
echo "Mullvad"
return 0
elif ip addr | grep -q "tailscale"; then
echo "Tailscale"
return 0
elif ip addr | grep -q "zt"; then
echo "ZeroTier"
return 0
fi
# Verificar servicios conocidos de VPN
if systemctl is-active --quiet nordvpnd; then
echo "NordVPN"
return 0
elif systemctl is-active --quiet protonvpn; then
echo "ProtonVPN"
return 0
elif systemctl is-active --quiet wg-quick@; then
echo "WireGuard"
return 0
elif systemctl is-active --quiet tailscaled; then
echo "Tailscale"
return 0
elif systemctl is-active --quiet zerotier-one; then
echo "ZeroTier"
return 0
fi
# Verificar específicamente Pritunl (adicional)
if systemctl is-active --quiet pritunl-client.service || [ -d "$HOME/.pritunl" ] || [ -d "/etc/pritunl-client" ]; then
echo "Pritunl"
return 0
fi
# Si llegamos hasta aquí, no pudimos identificar específicamente el tipo de VPN
echo "Unknown VPN"
return 0
}

View file

@ -38,6 +38,9 @@ head_nodockerfile="No existe el archivo de configuración Dockerfile"
head_nobuilded="No se pudo completar la construcción del contenedor" head_nobuilded="No se pudo completar la construcción del contenedor"
head_builded="Construcción del contenedor completada!" head_builded="Construcción del contenedor completada!"
head_zip="Utilitario zip no ha sido instalado!" head_zip="Utilitario zip no ha sido instalado!"
head_vpn_type="Tipo de VPN"
head_vpn_no_connected="VPN no conectado!"
head_vpn_unknown="VPN Desconocido!"
head_key_end="999999END" head_key_end="999999END"
head_superuser="Super Usuario" head_superuser="Super Usuario"
head_canceled="Cancelado" head_canceled="Cancelado"

86
bin/ollama.sh Executable file
View file

@ -0,0 +1,86 @@
#!/bin/bash
#Script : ollama.sh
#Apps : MRDEVS TOOLS
#Description : Cliente para interactuar con Ollama (IA local)
#Author : Mauro Rosero Pérez
#Company Email : mauro@rosero.one
#Personal Email : mauro.rosero@gmail.com
#Created : 2024/12/01 15:27:00
#Modified : 2025/03/19 11:57:08
#Version : 1.2.0
#==============================================================================
# Derechos de Autor [2025] [Mauro Rosero P. <mauro@rosero.one>]
#==============================================================================
# Este programa es software libre: usted puede redistribuirlo y/o modificarlo
# bajo los términos de la Licencia Pública Affero General de GNU tal como
# lo publica la Free Software Foundation, ya sea la versión 3 de la licencia,
# o (a su elección) cualquier versión posterior.
#
# Este programa se distribuye con la esperanza de que sea útil,
# pero SIN NINGUNA GARANTÍA; sin siquiera la garantía implícita de
# COMERCIABILIDAD o IDONEIDAD PARA UN PROPÓSITO PARTICULAR. Consulte la
# Licencia Pública Affero General de GNU para obtener más detalles.
#
# Debería haber recibido una copia de la Licencia Pública Affero General
# junto con este programa. Si no la recibió, consulte <https://www.gnu.org/licenses/>.
# Configuración inicial
# Usar DEVELOPER_DIR de base.lib
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BIN_BASE="bin"
BIN_LIBS="lib"
BIN_MESG="msg"
BIN_CFGS="config"
# Leer DEVSPATH desde el archivo de configuración o usar "devs" por defecto
if [ -f "$SCRIPT_DIR/config/devspath.dat" ]; then
DEVSPATH=$(cat "$SCRIPT_DIR/$BIN_CFGS/devspath.dat")
else
DEVSPATH="devs"
fi
BIN_HOME="$HOME/$DEVSPATH"
BIN_PATH=$BIN_HOME/$BIN_BASE
VERSION=$(cat "$BIN_HOME/$BIN_BASE/$BIN_CFGS/version")
# CHECK SHELL LANGUAGE
BIN_LANG=${LANG:0:2}
# Importar bibliotecas necesarias
if [ -f "${BIN_HOME}/${BIN_BASE}/${BIN_LIBS}/base.lib" ]; then
source "${BIN_HOME}/${BIN_BASE}/${BIN_LIBS}/base.lib"
# Cargar mensajes en el idioma del sistema o español por defecto
load_messages "${BIN_HOME}/${BIN_BASE}" "${BIN_MESG}" "${BIN_LANG}" "head"
title="${head_000} ${head_002}"
fi
# Check if we should use podman or docker (prefer podman)
if command -v podman >/dev/null 2>&1; then
CONTAINER_CMD="podman"
elif command -v docker >/dev/null 2>&1; then
CONTAINER_CMD="docker"
else
echo "Error: Neither podman nor docker is installed"
exit 1
fi
# Verificar si el contenedor Ollama está en ejecución
if ${CONTAINER_CMD} ps | grep -q "ollama"; then
# Si está en ejecución, ejecutar el comando pasado como argumento
${CONTAINER_CMD} exec -it ollama ollama "$@"
else
echo "El servicio Ollama no está en ejecución. Iniciándolo..."
"${BIN_PATH}/ollama_up.sh"
# Esperar un momento para que el servicio esté listo
echo "Esperando a que el servicio esté listo..."
sleep 5
# Verificar nuevamente si el contenedor está en ejecución
if ${CONTAINER_CMD} ps | grep -q "ollama"; then
${CONTAINER_CMD} exec -it ollama ollama "$@"
else
echo "Error: No se pudo iniciar el servicio Ollama correctamente."
exit 1
fi
fi

View file

@ -0,0 +1,12 @@
version: "3.8"
services:
ollama:
image: docker.io/ollama/ollama:latest
container_name: ollama
privileged: true
ports:
- "11434:11434"
volumes:
- ../../data:/root/.ollama
restart: unless-stopped

94
bin/ollama_down.sh Executable file
View file

@ -0,0 +1,94 @@
#!/bin/bash
#Script : ollama_down.sh
#Apps : MRDEVS TOOLS
#Description : Detener ollama (IA) en modo local
#Author : Mauro Rosero Pérez
#Company Email : mauro@rosero.one
#Personal Email : mauro.rosero@gmail.com
#Created : 2025/03/21 19:27:08
#Modified : 2025/03/21 19:27:08
#Version : 1.2.0
#==============================================================================
# Derechos de Autor [2025] [Mauro Rosero P. <mauro@rosero.one>]
#==============================================================================
# Este programa es software libre: usted puede redistribuirlo y/o modificarlo
# bajo los términos de la Licencia Pública Affero General de GNU tal como
# lo publica la Free Software Foundation, ya sea la versión 3 de la licencia,
# o (a su elección) cualquier versión posterior.
#
# Este programa se distribuye con la esperanza de que sea útil,
# pero SIN NINGUNA GARANTÍA; sin siquiera la garantía implícita de
# COMERCIABILIDAD o IDONEIDAD PARA UN PROPÓSITO PARTICULAR. Consulte la
# Licencia Pública Affero General de GNU para obtener más detalles.
#
# Debería haber recibido una copia de la Licencia Pública Affero General
# junto con este programa. Si no la recibió, consulte <https://www.gnu.org/licenses/>.
# Configuración inicial
# Usar DEVELOPER_DIR de base.lib
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BIN_BASE="bin"
BIN_LIBS="lib"
BIN_MESG="msg"
BIN_CFGS="config"
# Leer DEVSPATH desde el archivo de configuración o usar "devs" por defecto
if [ -f "$SCRIPT_DIR/config/devspath.dat" ]; then
DEVSPATH=$(cat "$SCRIPT_DIR/$BIN_CFGS/devspath.dat")
else
DEVSPATH="devs"
fi
BIN_HOME="$HOME/$DEVSPATH"
BIN_PATH=$BIN_HOME/$BIN_BASE
VERSION=$(cat "$BIN_HOME/$BIN_BASE/$BIN_CFGS/version")
# CHECK SHELL LANGUAGE
BIN_LANG=${LANG:0:2}
set -e
# Importar bibliotecas necesarias
source "${BIN_HOME}/${BIN_BASE}/${BIN_LIBS}/base.lib"
# Cargar mensajes en el idioma del sistema o español por defecto
load_messages "${BIN_HOME}/${BIN_BASE}" "${BIN_MESG}" "${BIN_LANG}" "head"
title="${head_000} ${head_002}"
# Change to the directory containing the compose file
cd "${BIN_HOME}/${BIN_BASE}/ollama"
# Check if we should use podman or docker (prefer podman)
if command -v podman >/dev/null 2>&1; then
CONTAINER_CMD="podman"
elif command -v docker >/dev/null 2>&1; then
CONTAINER_CMD="docker"
else
echo "Error: Neither podman nor docker is installed"
exit 1
fi
# Check if compose command exists
if command -v ${CONTAINER_CMD}-compose >/dev/null 2>&1; then
COMPOSE_CMD="${CONTAINER_CMD}-compose"
elif command -v podman-compose >/dev/null 2>&1; then
COMPOSE_CMD="podman-compose"
elif command -v docker-compose >/dev/null 2>&1; then
COMPOSE_CMD="docker-compose"
else
echo "Error: No compose command found (podman-compose or docker-compose)"
exit 1
fi
echo "Using ${COMPOSE_CMD} to stop Ollama service..."
# Try to stop with compose first
${COMPOSE_CMD} down || echo "Warning: Issue with ${COMPOSE_CMD} down command"
# If the container is still running, try to stop it directly
if ${CONTAINER_CMD} container exists ollama 2>/dev/null && ${CONTAINER_CMD} ps | grep -q ollama; then
echo "Stopping ollama container directly..."
${CONTAINER_CMD} stop ollama
fi
echo "${head_002} Ollama service stopped successfully"

115
bin/ollama_up.sh Executable file
View file

@ -0,0 +1,115 @@
#!/bin/bash
#Script : ollama_up.sh
#Apps : MRDEVS TOOLS
#Description : Ejecutar ollama (IA) en modo local
#Author : Mauro Rosero Pérez
#Company Email : mauro@rosero.one
#Personal Email : mauro.rosero@gmail.com
#Created : 2025/03/21 19:27:08
#Modified : 2025/03/21 19:27:08
#Version : 1.2.0
#==============================================================================
# Derechos de Autor [2025] [Mauro Rosero P. <mauro@rosero.one>]
#==============================================================================
# Este programa es software libre: usted puede redistribuirlo y/o modificarlo
# bajo los términos de la Licencia Pública Affero General de GNU tal como
# lo publica la Free Software Foundation, ya sea la versión 3 de la licencia,
# o (a su elección) cualquier versión posterior.
#
# Este programa se distribuye con la esperanza de que sea útil,
# pero SIN NINGUNA GARANTÍA; sin siquiera la garantía implícita de
# COMERCIABILIDAD o IDONEIDAD PARA UN PROPÓSITO PARTICULAR. Consulte la
# Licencia Pública Affero General de GNU para obtener más detalles.
#
# Debería haber recibido una copia de la Licencia Pública Affero General
# junto con este programa. Si no la recibió, consulte <https://www.gnu.org/licenses/>.
# Configuración inicial
# Usar DEVELOPER_DIR de base.lib
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BIN_BASE="bin"
BIN_LIBS="lib"
BIN_MESG="msg"
BIN_CFGS="config"
# Leer DEVSPATH desde el archivo de configuración o usar "devs" por defecto
if [ -f "$SCRIPT_DIR/config/devspath.dat" ]; then
DEVSPATH=$(cat "$SCRIPT_DIR/$BIN_CFGS/devspath.dat")
else
DEVSPATH="devs"
fi
BIN_HOME="$HOME/$DEVSPATH"
BIN_PATH=$BIN_HOME/$BIN_BASE
VERSION=$(cat "$BIN_HOME/$BIN_BASE/$BIN_CFGS/version")
# CHECK SHELL LANGUAGE
BIN_LANG=${LANG:0:2}
set -e
# Importar bibliotecas necesarias
source "${BIN_HOME}/${BIN_BASE}/${BIN_LIBS}/base.lib"
# Cargar mensajes en el idioma del sistema o español por defecto
load_messages "${BIN_HOME}/${BIN_BASE}" "${BIN_MESG}" "${BIN_LANG}" "head"
title="${head_000} ${head_002}"
# Change to the directory containing the compose file
cd "${BIN_HOME}/${BIN_BASE}/ollama"
# Check if we should use podman or docker (prefer podman)
if command -v podman >/dev/null 2>&1; then
CONTAINER_CMD="podman"
elif command -v docker >/dev/null 2>&1; then
CONTAINER_CMD="docker"
else
echo "Error: Neither podman nor docker is installed"
exit 1
fi
# Check if compose command exists
if command -v ${CONTAINER_CMD}-compose >/dev/null 2>&1; then
COMPOSE_CMD="${CONTAINER_CMD}-compose"
elif command -v podman-compose >/dev/null 2>&1; then
COMPOSE_CMD="podman-compose"
elif command -v docker-compose >/dev/null 2>&1; then
COMPOSE_CMD="docker-compose"
else
echo "Error: No compose command found (podman-compose or docker-compose)"
exit 1
fi
echo "Using ${COMPOSE_CMD} to start Ollama service..."
# Fix relative path in volume mount if needed
if grep -q "../../data:/root/.ollama" "${BIN_HOME}/${BIN_BASE}/ollama/podman-compose.yml"; then
# Create data directory if it doesn't exist
mkdir -p "${BIN_HOME}/data"
# Start Ollama service with compose
${COMPOSE_CMD} -f podman-compose.yml up -d
else
${COMPOSE_CMD} up -d
fi
# Verify container is running
if ! ${CONTAINER_CMD} container exists ollama 2>/dev/null || ! ${CONTAINER_CMD} ps | grep -q ollama; then
echo "Warning: Container may not be running properly. Trying direct container command..."
# Try to start it directly if it exists
if ${CONTAINER_CMD} container exists ollama 2>/dev/null; then
echo "Starting existing ollama container..."
${CONTAINER_CMD} start ollama
else
echo "Creating ollama container directly..."
${CONTAINER_CMD} run -d --name ollama \
--privileged \
-p 11434:11434 \
-v "${BIN_HOME}/data:/root/.ollama" \
--restart unless-stopped \
docker.io/ollama/ollama:latest
fi
fi
echo "${head_002} Ollama service started successfully"

68
bin/vpn_check.sh Executable file
View file

@ -0,0 +1,68 @@
#!/bin/bash
#Script : vpn_check.sh
#Apps : MRDEVS TOOLS
#Description : Verifica conexión a VPN
#Author : Mauro Rosero Pérez
#Company Email : mauro@rosero.one
#Personal Email : mauro.rosero@gmail.com
#Created : 2025/03/22 14:57:08
#Modified : 2025/03/22 14:57:08
#Version : 1.2.0
#==============================================================================
# Derechos de Autor [2025] [Mauro Rosero P. <mauro@rosero.one>]
#==============================================================================
# Este programa es software libre: usted puede redistribuirlo y/o modificarlo
# bajo los términos de la Licencia Pública Affero General de GNU tal como
# lo publica la Free Software Foundation, ya sea la versión 3 de la licencia,
# o (a su elección) cualquier versión posterior.
#
# Este programa se distribuye con la esperanza de que sea útil,
# pero SIN NINGUNA GARANTÍA; sin siquiera la garantía implícita de
# COMERCIABILIDAD o IDONEIDAD PARA UN PROPÓSITO PARTICULAR. Consulte la
# Licencia Pública Affero General de GNU para obtener más detalles.
#
# Debería haber recibido una copia de la Licencia Pública Affero General
# junto con este programa. Si no la recibió, consulte <https://www.gnu.org/licenses/>.
# Configuración inicial
# Usar DEVELOPER_DIR de base.lib
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BIN_BASE="bin"
BIN_LIBS="lib"
BIN_MESG="msg"
BIN_CFGS="config"
# Leer DEVSPATH desde el archivo de configuración o usar "devs" por defecto
if [ -f "$SCRIPT_DIR/config/devspath.dat" ]; then
DEVSPATH=$(cat "$SCRIPT_DIR/$BIN_CFGS/devspath.dat")
else
DEVSPATH="devs"
fi
BIN_HOME="$HOME/$DEVSPATH"
BIN_PATH=$BIN_HOME/$BIN_BASE
VERSION=$(cat "$BIN_HOME/$BIN_BASE/$BIN_CFGS/version")
# CHECK SHELL LANGUAGE
BIN_LANG=${LANG:0:2}
# Importar bibliotecas necesarias
if [ -f "${BIN_HOME}/${BIN_BASE}/${BIN_LIBS}/base.lib" ]; then
source "${BIN_HOME}/${BIN_BASE}/${BIN_LIBS}/base.lib"
# Cargar mensajes en el idioma del sistema o español por defecto
load_messages "${BIN_HOME}/${BIN_BASE}" "${BIN_MESG}" "${BIN_LANG}" "head"
title="${head_000} ${head_002}"
fi
# Verificar tipo de VPN conectado
vpn_type=$(get_vpn_type)
vpn_result=$?
if [ $vpn_result -eq 0 ]; then
echo "$head_vpn_type: $vpn_type"
else
if [ $vpn_result -eq 1 ]; then
echo "$head_vpn_no_connected"
else
echo "$head_vpn_unknown"
fi
fi

View file

@ -34,6 +34,7 @@ BIN_BASE="bin"
BIN_LIBS="lib" BIN_LIBS="lib"
BIN_MESG="msg" BIN_MESG="msg"
BIN_CFGS="config" BIN_CFGS="config"
BIN_ANSIBLE="ansible"
# Leer DEVSPATH desde el archivo de configuración o usar "devs" por defecto # Leer DEVSPATH desde el archivo de configuración o usar "devs" por defecto
if [ -f "$SCRIPT_DIR/$BIN_CFGS/devspath.dat" ]; then if [ -f "$SCRIPT_DIR/$BIN_CFGS/devspath.dat" ]; then

21
sops/digital.sops.yaml Normal file
View file

@ -0,0 +1,21 @@
{
"data": "ENC[AES256_GCM,data:wzUuXCw/03iQx/uBbYZaH2RUUOS9kRNsOxeYnf9gxg9EtTnHcAKCdgsi57MjCAOoJNFModUP1oiI,iv:0OxbnDf+YpAUxPKD4pwWr1m2SKigjltl2Tia9Ebvha0=,tag:IfBggkQeIxnNIa1L6WOp8Q==,type:str]",
"sops": {
"kms": null,
"gcp_kms": null,
"azure_kv": null,
"hc_vault": null,
"age": null,
"lastmodified": "2025-03-22T19:17:45Z",
"mac": "ENC[AES256_GCM,data:3DYGOmI8egY+KHpzhF8grzCs1cJ0nMc0YeQlDV7X0B4+vEK/Ja7YR7bUG4zIR38OhpENZbHMDK2ciyoifJdO4hPZKQk/+MsmdmfxV9WF+lJ0AXe3U/mGmpDv5W9KHmR13zgaN0On2cQT9cLziA7KpaSGw4CfLNgxKU/OSJC7iW0=,iv:J34Sj4LMzGCD6TOB6IU71kT8Sxj7orUb0A0yRfyB8kI=,tag:quu2v+T8lTyqRKGtE7vs8Q==,type:str]",
"pgp": [
{
"created_at": "2025-03-22T19:17:45Z",
"enc": "-----BEGIN PGP MESSAGE-----\n\nhQIMAx5Q8cfEImn/AQ//TNSynZiJbXr16tKHNusO/8UHpS1bWIuSjJG0lcdc7c/7\nGbmDzl5mRxi38FhP/evzNiArB8uL81P0hfKogdNIFe+19yVXzuCBxd9FMLLKnFkX\nvm+0O7fkQsAU266w0snbDZdZuM6gDqiERdgeUrUh4rSdgjeHMoa2MvfpL62ncjF3\nhZL8RMGSF6Q2mjYWkjgJqVbPzKeB4x7adm3HD7YTTzSBoAChVXXSUhXl4ZMfglWb\nlF9bXrOXFwzZtiWDsLfciJdlM6hy7sDsMUIXcMXTEPNv4cMkftKzKSbD9iN1MYP0\nZC7r/yhQtZqbN1IKjtqmSBPgvhS6CbCGt7GG5iH5ohqt1L/+bJYiEkuves1DRkBq\nREDiVhHL0Dn4qTafBuE2zDB8T1MzKagUS62qJM5ODyHaC8UXz7C2OSsFIxwccZI6\njkCCW5Kx9inxNvvtwkQo8f1RH1ui+CE1f18quxCR9cTqM4Z1hADZSRQCc9DFOBC/\nVVMcdlXRluD2cwtqUyzjIAMzmDske4GRVgJsEib8b8m1Y6P783kfHJI6qjFCzLmE\npnTwOYs946K8NmVawcl6FgdDxuIZltQgMuD7xCaVR+p3IDFUNH1EYPEO8lhtTGAS\n7ScRrZYmOM+T+sHk3U+3T4OtDUjWrWMPXVC4+FrFaBUhZQ4jsjNnBkuQeqPshy3S\nXAHS4cfo9VIixvbwVibiAVkGCc4eUFiIQO/7FArmQ66Cp1YxtmbD2jCyoHAl+bMl\nlfOnww8y4AwB3+cnj2PkxnEPr2D5bvC4XPWSqhcPziUY/y7m9GUkYadKSIRq\n=wLIg\n-----END PGP MESSAGE-----",
"fp": "ACB17A9DB7A680D0FED714E2A17ADF8EA1E9DB07"
}
],
"unencrypted_suffix": "_unencrypted",
"version": "3.9.2"
}
}