source: server/bin/checkperms @ 1d1e06d

Last change on this file since 1d1e06d was 4816ea5, checked in by OpenGnSys Support Team <soporte-og@…>, 5 years ago

#971 Remove ogAdmAgent initialization

All the functionalities of the ogAdmAgent are now in the ogAdmServer.
So, the it is not needed anymore.

This commit remove the installation and update of the ogAdmAgent, adds a
check to remove it if exists and removes it from the OpenGnsys init
script.

A future patch will remove all the code related to the ogAdmAgent.

  • Property mode set to 100755
File size: 3.0 KB
Line 
1#!/bin/bash
2# checkperms: Comprueba que los permisos de los ficheros sean correctos.
3# Nota: Las siguientes variables de entorno pueden usarse para retocar los
4#       valores por defecto:
5#       - OPENGNSYS_USER - usuario de OpenGnsys.
6#       - OPENGNSYS_DIR  - directorio de instalación.
7#       - APACHE_USER    - usuario de Apache.
8#       - APACHE_GROUP   - grupo de Apache.
9# Uso:  checkperms
10#       variable1=valor1 ... checkperms
11# Autor: Ramon Gomez - Univ. Sevilla, noviembre 2010
12# Fecha: 2012/07/13
13
14
15# Variables.
16OPENGNSYS_USER=${OPENGNSYS_USER:-"opengnsys"}   # Usuario del cliente para acceso remoto
17OPENGNSYS_DIR=${OPENGNSYS_DIR:-/opt/opengnsys}  # Directorio de instalación de OpenGnsys
18APACHE_USER=${APACHE_USER:-"www-data"}          # Usuario de ejecución de Apache
19APACHE_GROUP=${APACHE_GROUP:-"www-data"}        # Grupo de ejecución de Apache
20PROG=$(basename "$0")
21
22# Control de errores.
23if [ "$USER" != "root" ]; then
24        echo "$PROG: Error: solo ejecutable por root" >&2
25        exit 1
26fi
27if [ "$OPENGNSYS_USER" == "root" -o -z "$(getent passwd "$OPENGNSYS_USER" 2>/dev/null)" ]; then
28        echo "$PROG: Error: el usuario de OpenGnsys debe existir y no ser root (OPENGNSYS_USER=\"$OPENGNSYS_USER\")" >&2
29        exit 1
30fi
31if [ ! -d "$OPENGNSYS_DIR" ]; then
32        echo "$PROG: Error: sin acceso al directorio de OpenGnsys (OPENGNSYS_DIR=\"$OPENGNSYS_DIR\")". >&2
33        exit 1
34fi
35if [ -z "$(getent passwd "$APACHE_USER" 2>/dev/null)" -o -z "$(getent group "$APACHE_GROUP" 2>/dev/null)" ]; then
36        echo "$PROG: Error: no se detectan el usuario o el grupo de Apache (APACHE_USER=\"$APACHE_USER\", APACHE_GROUP=\"$APACHE_GROUP\")" >&2
37        exit 1
38fi
39
40mkdir -p $OPENGNSYS_DIR/{log/clients,images/groups}
41chown -R :$OPENGNSYS_USER $OPENGNSYS_DIR/{log/clients,images/groups}
42find $OPENGNSYS_DIR/log/clients -type f -exec chmod 664 {} \;
43find $OPENGNSYS_DIR/images -maxdepth 1 -exec chown :$OPENGNSYS_USER {} \;
44find $OPENGNSYS_DIR/images -maxdepth 1 -type d -exec chmod 775 {} \;
45find $OPENGNSYS_DIR/images -maxdepth 1 -type f -exec chmod 664 {} \;
46find $OPENGNSYS_DIR/client/{interfaceAdm,scripts} ! -name "*.txt" -exec chmod +x {} \;
47chown -R $OPENGNSYS_USER:$OPENGNSYS_USER $OPENGNSYS_DIR/client/etc/ssl/private
48chmod -R go-rwx $OPENGNSYS_DIR/client/etc/ssl/private
49chown $OPENGNSYS_USER:$OPENGNSYS_USER $OPENGNSYS_DIR/client/interfaceAdm/CambiarAcceso
50chmod 700 $OPENGNSYS_DIR/client/interfaceAdm/CambiarAcceso
51chown root:$APACHE_GROUP $OPENGNSYS_DIR/{www/controlacceso*.php,etc/ogAdmRepo*.cfg,etc/ogAdmServer*.cfg}
52chmod 640 $OPENGNSYS_DIR/{www/controlacceso*.php,etc/ogAdmRepo*.cfg,etc/ogAdmServer*.cfg}
53chown -R $APACHE_USER:$APACHE_GROUP $OPENGNSYS_DIR/www/images/{fotos,iconos}
54mkdir -p $OPENGNSYS_DIR/www/{api,tmp}
55chown -R $APACHE_USER:$APACHE_GROUP $OPENGNSYS_DIR/www/{api,tmp}
56chown -R $APACHE_USER:$APACHE_GROUP $OPENGNSYS_DIR/tftpboot/{menu.lst,grub}
57chown -R :$OPENGNSYS_USER $OPENGNSYS_DIR/tftpboot/ogLive*
58find -L $OPENGNSYS_DIR/tftpboot -type d -exec chmod 755 {} \;
59find -L $OPENGNSYS_DIR/tftpboot -type f -exec chmod 644 {} \;
60chown $APACHE_USER:$APACHE_GROUP $OPENGNSYS_DIR/log/{ogagent,remotepc,rest}.log
61
Note: See TracBrowser for help on using the repository browser.