From ae1af23a4b2f182e8ebf8b1b09f09531ac700bed Mon Sep 17 00:00:00 2001 From: Benjamin Sonntag Date: Tue, 16 May 2006 18:20:14 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20du=20script=20fixperms.sh=20qui=20perme?= =?UTF-8?q?t=20de=20remettre=20=C3=A0=20plat=20les=20permissions=20et=20pr?= =?UTF-8?q?oprietaires=20des=20fichiers.=20Ref=20#416?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 2 +- install/local.php | 49 ---------------------------------- src/Makefile | 2 +- src/fixperms.sh | 67 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 51 deletions(-) delete mode 100644 install/local.php create mode 100755 src/fixperms.sh diff --git a/.gitattributes b/.gitattributes index eff9d989..a83df368 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/install/local.php b/install/local.php deleted file mode 100644 index e5898128..00000000 --- a/install/local.php +++ /dev/null @@ -1,49 +0,0 @@ - SUIVANT !!! */ - -?> diff --git a/src/Makefile b/src/Makefile index 6fe376ec..55f6bbd2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 diff --git a/src/fixperms.sh b/src/fixperms.sh new file mode 100755 index 00000000..8b8b0177 --- /dev/null +++ b/src/fixperms.sh @@ -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 +