Ajout du script fixperms.sh qui permet de remettre à plat les permissions et proprietaires des fichiers. Ref #416

This commit is contained in:
Benjamin Sonntag 2006-05-16 18:20:14 +00:00
parent 6a877e1008
commit ae1af23a4b
4 changed files with 69 additions and 51 deletions

2
.gitattributes vendored
View File

@ -317,7 +317,6 @@ install/domaines.template -text
install/dopo.sh -text
install/header_checks -text
install/initrep.sh -text
install/local.php -text
install/mysql.sh -text
install/mysql.sql -text
install/newone.php -text
@ -353,6 +352,7 @@ src/.cvsignore -text
src/Makefile -text
src/basedir_prot.sh -text
src/du.pl -text
src/fixperms.sh -text
src/mail_add -text
src/mail_del -text
src/mem_add -text

View File

@ -1,49 +0,0 @@
<?php
/*
$Id: local.php,v 1.6 2005/04/01 16:40:16 benjamin Exp $
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
Based on:
Valentin Lacambre's web hosting softwares: http://altern.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file:
Purpose of file: Variables spécifique au serveur (locales)
----------------------------------------------------------------------
*/
global $L_MYSQL_HOST,$L_MYSQL_LOGIN,$L_MYSQL_PWD,$L_MYSQL_DATABASE,$L_MYSQL_CLIENT,$L_SHOWVERSION,$L_VERSION,$L_FQDN,$L_HOSTING,$L_NS2,$L_NS1,$L_MX;
$L_MX="%%mx%%";
$L_NS1="%%ns1%%";
$L_NS2="%%ns2%%";
$L_HOSTING="%%hosting%%";
$L_FQDN="%%fqdn%%";
$L_MYSQL_HOST="%%dbhost%%";
$L_MYSQL_LOGIN="%%dbuser%%";
$L_MYSQL_PWD="%%dbpwd%%";
$L_MYSQL_DATABASE="%%dbname%%";
$L_MYSQL_CLIENT="%%dbclient%%";
$L_SHOWVERSION=1; /* Faut-il afficher la version d'AlternC dans le menu ? */
$L_VERSION="%%version%%"; /* Contient la version d'AlternC, ne pas modifier */
/* ATTENTION : AUCUNE CARACTERE APRES LE ? > SUIVANT !!! */
?>

View File

@ -26,7 +26,7 @@
# ----------------------------------------------------------------------
#
SETUID=mail_add mail_del quota_edit quota_get mem_add mem_del
SCRIPTS=quota_edit.sh quota_get.sh basedir_prot.sh sqlbackup.sh rawstat.daily quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php
SCRIPTS=quota_edit.sh quota_get.sh basedir_prot.sh sqlbackup.sh rawstat.daily quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh
BIN=$(DESTDIR)/usr/lib/alternc/
install: all

67
src/fixperms.sh Executable file
View File

@ -0,0 +1,67 @@
#!/bin/sh -e
#
# $Id: fixperms.sh,v 1.1 2005/08/29 19:21:31 benjamin Exp $
# ----------------------------------------------------------------------
# AlternC - Web Hosting System
# Copyright (C) 2002 by the AlternC Development Team.
# http://alternc.org/
# ----------------------------------------------------------------------
# Based on:
# Valentin Lacambre's web hosting softwares: http://altern.org/
# ----------------------------------------------------------------------
# LICENSE
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# To read the license please visit http://www.gnu.org/copyleft/gpl.html
# ----------------------------------------------------------------------
# Original Author of file: Benjamin Sonntag for Metaconsult
# Purpose of file: Fix permission and ownership of html files
# ----------------------------------------------------------------------
#
CONFIG_FILE="/etc/alternc/local.sh"
PATH=/sbin:/bin:/usr/sbin:/usr/bin
umask 022
if [ ! -r "$CONFIG_FILE" ]; then
echo "Can't access $CONFIG_FILE."
exit 1
fi
if [ `id -u` -ne 0 ]; then
echo "fixperms.sh must be launched as root"
exit 1
fi
. "$CONFIG_FILE"
function doone {
read GID LOGIN
while [ "$LOGIN" ]
do
if [ "$DEBUG" ]; then
echo "Setting rights and ownership for user $LOGIN having gid $GID"
fi
INITIALE=`echo $LOGIN |cut -c1`
REP="$ALTERNC_LOC/html/$INITIALE/$LOGIN"
find $REP -type d -exec chmod g+s \{\} \;
chown -R 33.$GID $REP
read GID LOGIN
done
}
mysql -h"$MYSQL_HOST" -p"$MYSQL_PASS" -u"$MYSQL_USER" "$MYSQL_DATABASE" -B -e "select uid,login from membres" |grep -v ^uid|doone