diff --git a/Custom/README.md b/Custom/README.md deleted file mode 100644 index a5589fd..0000000 --- a/Custom/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# Instalación rápida - -## En un servidor nuevo -### 0) Instalar Git - -En openSUSE/SLE: - -```bash -sudo zypper -n refresh -sudo zypper -n install -y git curl -``` - -### 1) Clonar el repo en `/home` - -```bash -cd /home -git clone https://git.sapian.cloud/Sapian/vicidial_sapian.git -``` - -### 2) Ejecutar el instalador - -```bash -sudo /home/vicidial_sapian/Custom/unified_installer.sh --non-interactive -``` - -Eso instala: -- **VICIdial/ViciBox (backvicibox)** -- **Custom (CSS + logos)** - -## Logs útiles -- **Instalador unificado**: `/home/vicidial_sapian/Custom/unified_installer.log` -- **Backvicibox**: `/home/backvicibox/install-vicibox.log` -- **Vicibox**: `/var/log/vicibox.log` -- **Apache (errores)**: `/var/log/apache2/error_log` - -## URLs después de instalar -- `http:///vicidial/welcome.php` -- `http:///vicidial/admin.php` - -## Si falla -1) Revisa los logs de arriba. -2) Si ves error 500 al entrar a `admin.php`, revisa SELinux: - -```bash -getenforce -sudo tail -n 200 /var/log/messages | grep -i avc -``` - diff --git a/Custom/README.txt b/Custom/README.txt new file mode 100644 index 0000000..d0c2565 --- /dev/null +++ b/Custom/README.txt @@ -0,0 +1,85 @@ +========================================== +BACKUP DE VICIBOX - AMBIENTE DE CONFIGURACIÓN +========================================== + +Fecha de creación: Fri Feb 6 04:46:49 PM UTC 2026 + + +INSTRUCCIONES RÁPIDAS (instalación automática): +---------------------------------------------- +1. Instalar git zypper install git +2. git clone https://git.sapian.cloud/Sapian/vicidial_sapian.git (Se descargan los archivos instalador voe y custom) + +1. Copiar este directorio al servidor destino, debe quedar en la ruta /home/ ej. /home/backvicibox). + +2. Ejecutar el instalador (instala dependencias, restore, parches y express): + cd /home/backvicibox + sudo chmod +x install-vicibox.sh restore.sh apply-vicibox-patches.sh + sudo ./install-vicibox.sh + + NOTA + El script ./install-vicibox.sh ejecuta todos los sh necesarios para la instalacion + +3. Revisar el log si algo falla: install-vicibox.log + + + + +ARCHIVOS INCLUIDOS: +------------------- +1. vicibox-scripts.tar.gz + - Todos los scripts de instalación y configuración de Vicibox + - Ubicación original: /usr/share/vicibox/ + +2. astguiclient-trunk.tar.gz + - Código fuente completo de ViciDial + - Ubicación original: /usr/src/astguiclient/trunk/ + +3. restore.sh + - Script para restaurar los archivos en el servidor destino + +4. install-vicibox.sh (NUEVO) + - Instalación completa en orden: Perl → MariaDB → PHP → Apache + - Configura Apache para apuntar a /vicidial/welcome.php + - Ejecuta restore.sh, aplica parches a vicibox-install.pl y lanza --vicibox-express + - Uso: sudo ./install-vicibox.sh + +5. apply-vicibox-patches.sh (NUEVO) + - Aplica parches a vicibox-install.pl (socket MySQL, random_pass, DBI) + - Se usa automáticamente desde install-vicibox.sh si no existe patches/vicibox-install.pl + +6. patches/ + - vicibox-install.pl: copia del instalador con parches ya aplicados (recomendado) + - README.txt: descripción de los parches + +7. version-info.txt + - Información de versiones y sistema + + + +INSTRUCCIONES MANUALES (paso a paso): +------------------------------------ +1. Instalar dependencias: Perl (y DBI, DBD-mysql, LWP::Simple), Subversion, + MariaDB, PHP 8 (y apache2-mod_php8, php8-mysql), Apache2. +2. Configurar Apache para que la URL principal sirva /vicidial/welcome.php. +3. Ejecutar: sudo ./restore.sh +4. Aplicar parches (copiar patches/vicibox-install.pl a /usr/share/vicibox/ + o ejecutar apply-vicibox-patches.sh). +5. Ejecutar: echo y | sudo /usr/share/vicibox/vicibox-install.pl --vicibox-express +6. En /etc/astguiclient.conf poner VARDB_server => 127.0.0.1 para la web. + +REQUISITOS DEL SERVIDOR DESTINO: +-------------------------------- +- Sistema operativo: openSUSE Leap / SUSE Linux Enterprise (SLE 15 SP6) +- install-vicibox.sh instala: Perl, DBI, DBD-mysql, libwww-perl, subversion, + MariaDB, PHP 8, Apache2. Asterisk se gestiona por el instalador ViciBox. +- Acceso a internet (recomendado para repos y actualizaciones). + +NOTAS: +------ +- El tamaño total comprimido es aproximadamente 50-70 MB. +- Log de install-vicibox.sh: install-vicibox.log en este directorio. +- Log del instalador ViciBox: /var/log/vicibox.log. +- Acceso web tras instalación: http:///vicidial/welcome.php + +========================================== diff --git a/Custom/quick_install.sh b/Custom/quick_install.sh deleted file mode 100644 index 3d3bd55..0000000 --- a/Custom/quick_install.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash -# -# Quick installer (sin preguntas): -# - clona el repo en /home/vicidial_sapian -# - ejecuta el instalador unificado en modo --non-interactive -# -set -euo pipefail - -REPO_URL="${REPO_URL:-https://git.sapian.cloud/Sapian/vicidial_sapian.git}" -TARGET_DIR="${TARGET_DIR:-/home/vicidial_sapian}" -INSTALL_REL_PATH="${INSTALL_REL_PATH:-Custom/unified_installer.sh}" - -need_root() { - if [[ "${EUID}" -ne 0 ]]; then - echo "ERROR: ejecuta como root (sudo)." >&2 - exit 1 - fi -} - -have_cmd() { command -v "$1" >/dev/null 2>&1; } - -main() { - need_root - - if ! have_cmd git; then - echo "==> Instalando git..." - zypper --gpg-auto-import-keys -n install -y git - fi - - if [[ -d "$TARGET_DIR" ]]; then - ts="$(date +%Y%m%d_%H%M%S)" - echo "==> Moviendo existente ${TARGET_DIR} -> ${TARGET_DIR}.bak.${ts}" - mv "$TARGET_DIR" "${TARGET_DIR}.bak.${ts}" - fi - - echo "==> Clonando repo: ${REPO_URL}" - git clone "$REPO_URL" "$TARGET_DIR" - - local installer="${TARGET_DIR}/${INSTALL_REL_PATH}" - if [[ ! -f "$installer" ]]; then - echo "ERROR: no existe instalador: ${installer}" >&2 - exit 1 - fi - chmod +x "$installer" - - echo "==> Ejecutando instalador (non-interactive): ${installer}" - "$installer" --non-interactive -} - -main "$@" - diff --git a/Custom/unified_installer.log b/Custom/unified_installer.log deleted file mode 100644 index e7a34f5..0000000 --- a/Custom/unified_installer.log +++ /dev/null @@ -1,5 +0,0 @@ -[INFO] ========================================== -[INFO] Unified Installer (backvicibox + Custom) -[INFO] Base: /srv/www/htdocs/agc/css/installer/Custom -[INFO] Log: /srv/www/htdocs/agc/css/installer/Custom/unified_installer.log -[INFO] ========================================== diff --git a/Custom/unified_installer.sh b/Custom/unified_installer.sh index 3202ca2..8b10940 100644 --- a/Custom/unified_installer.sh +++ b/Custom/unified_installer.sh @@ -8,7 +8,6 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" LOG_FILE="${SCRIPT_DIR}/unified_installer.log" -DEFAULT_BUNDLE_NAME="custom_bundle.tar.gz" RED='\033[0;31m' GREEN='\033[0;32m' @@ -76,7 +75,6 @@ print_menu() { cat <<'EOF' Selecciona qué quieres ejecutar (multi-selección permitida: ej. 1,3,4): - 0) (Opcional) Generar bundle custom_bundle.tar.gz desde carpetas locales (NO borra nada) 1) Stage assets (copiar Custom/backvicibox -> /home/backvicibox y Custom/installer custom -> HTDOCS/agc/css/installer) 2) Instalar backvicibox (ejecuta /home/backvicibox/install-vicibox.sh) 3) Custom: instalar CSS/logos (HTDOCS/agc/css/installer/install_custom_css.sh install) @@ -101,84 +99,16 @@ parse_multiselect() { } require_paths() { - local bundle="${SCRIPT_DIR}/${DEFAULT_BUNDLE_NAME}" - local back_src="${SCRIPT_DIR}/backvicibox" - local inst_custom_src="${SCRIPT_DIR}/installer custom" - - if [[ -f "$bundle" ]]; then - return 0 - fi - [[ -d "$back_src" ]] || { error "No existe: ${back_src} (o crea ${DEFAULT_BUNDLE_NAME})"; exit 1; } - [[ -d "$inst_custom_src" ]] || { error "No existe: ${inst_custom_src} (o crea ${DEFAULT_BUNDLE_NAME})"; exit 1; } -} - -create_temp_dir() { - if have_cmd mktemp; then - mktemp -d -t vicidial_custom_XXXXXX - else - local d="/tmp/vicidial_custom_$$.$RANDOM" - mkdir -p "$d" - echo "$d" - fi -} - -cleanup_temp_dir() { - local d="${1:-}" - [[ -n "$d" ]] || return 0 - rm -rf "$d" 2>/dev/null || true -} - -resolve_asset_base() { - # Returns directory that contains backvicibox/ and installer custom/ - # Prefers bundle if present, otherwise uses SCRIPT_DIR directly. - local bundle="${SCRIPT_DIR}/${DEFAULT_BUNDLE_NAME}" - if [[ -f "$bundle" ]]; then - local tmpdir - tmpdir="$(create_temp_dir)" - info "Extrayendo bundle: ${bundle} -> ${tmpdir}" - tar -xzf "$bundle" -C "$tmpdir" - # Allow either: - # - backvicibox/ + installer custom/ in root of tar - # - Custom/backvicibox + Custom/installer custom inside tar - if [[ -d "${tmpdir}/backvicibox" && -d "${tmpdir}/installer custom" ]]; then - echo "$tmpdir" - return 0 - fi - if [[ -d "${tmpdir}/Custom/backvicibox" && -d "${tmpdir}/Custom/installer custom" ]]; then - echo "${tmpdir}/Custom" - return 0 - fi - error "Bundle no contiene las carpetas esperadas. Debe incluir backvicibox/ y 'installer custom/' (o dentro de Custom/)." - cleanup_temp_dir "$tmpdir" - exit 1 - fi - echo "$SCRIPT_DIR" -} - -do_build_bundle() { - local out="${SCRIPT_DIR}/${DEFAULT_BUNDLE_NAME}" local back_src="${SCRIPT_DIR}/backvicibox" local inst_custom_src="${SCRIPT_DIR}/installer custom" [[ -d "$back_src" ]] || { error "No existe: ${back_src}"; exit 1; } [[ -d "$inst_custom_src" ]] || { error "No existe: ${inst_custom_src}"; exit 1; } - - if [[ -f "$out" ]]; then - if ! prompt_yn "Ya existe ${DEFAULT_BUNDLE_NAME}. ¿Sobrescribir?" "N"; then - info "Bundle no creado." - return 0 - fi - fi - - info "Generando bundle: ${out}" - tar -czf "$out" -C "$SCRIPT_DIR" "backvicibox" "installer custom" - info "Bundle generado OK." } do_stage() { local htdocs="$1" - local asset_base="$2" - local back_src="${asset_base}/backvicibox" - local inst_custom_src="${asset_base}/installer custom" + local back_src="${SCRIPT_DIR}/backvicibox" + local inst_custom_src="${SCRIPT_DIR}/installer custom" local back_dst="/home/backvicibox" local inst_dst="${htdocs}/agc/css/installer" @@ -233,34 +163,6 @@ main() { info "Log: ${LOG_FILE}" info "==========================================" - # Modo no interactivo: no pregunta nada, asume HTDOCS=/srv/www/htdocs - # y ejecuta stage + backvicibox + custom (install). - if [[ "${1:-}" == "--non-interactive" ]]; then - local htdocs="/srv/www/htdocs" - if [[ ! -d "$htdocs" ]]; then - error "HTDOCS no existe: ${htdocs}" - exit 1 - fi - - local asset_base - local cleanup="" - asset_base="$(resolve_asset_base)" - if [[ "$asset_base" == /tmp/vicidial_custom_* || "$asset_base" == /tmp/*/Custom ]]; then - cleanup="$asset_base" - if [[ "$cleanup" == */Custom ]]; then cleanup="${cleanup%/Custom}"; fi - fi - - do_stage "$htdocs" "$asset_base" - if [[ -n "${cleanup:-}" ]]; then - info "Limpiando temporal: ${cleanup}" - cleanup_temp_dir "$cleanup" - fi - do_backvicibox_install - do_custom "$htdocs" install - info "Listo (non-interactive)." - return 0 - fi - local htdocs htdocs="$(prompt_text "Ruta HTDOCS (donde están vicidial/agc/VERM)" "/srv/www/htdocs")" @@ -270,29 +172,15 @@ main() { fi while true; do - local asset_base="" - local cleanup="" print_menu local sel sel="$(prompt_text "Opción(es)" "1,2,3")" - # Resolver base de assets 1 vez por iteración si se va a usar Stage. - # Para bundle: se extrae a un temporal y se limpia al final de la iteración. - if echo "$sel" | grep -Eq '(^|[ ,])1([ ,]|$)'; then - asset_base="$(resolve_asset_base)" - if [[ "$asset_base" == /tmp/vicidial_custom_* || "$asset_base" == /tmp/*/Custom ]]; then - cleanup="$asset_base" - # si apunta a /tmp/.../Custom limpiar el padre - if [[ "$cleanup" == */Custom ]]; then cleanup="${cleanup%/Custom}"; fi - fi - fi - local any=0 while read -r opt; do any=1 case "$opt" in - 0) do_build_bundle ;; - 1) do_stage "$htdocs" "${asset_base:-$SCRIPT_DIR}" ;; + 1) do_stage "$htdocs" ;; 2) do_backvicibox_install ;; 3) do_custom "$htdocs" install ;; 4) do_custom "$htdocs" status ;; @@ -309,11 +197,6 @@ main() { esac done < <(parse_multiselect "$sel") - if [[ -n "${cleanup:-}" ]]; then - info "Limpiando temporal: ${cleanup}" - cleanup_temp_dir "$cleanup" - fi - if [[ "$any" -eq 0 ]]; then warn "No entendí la selección: '$sel'" fi