source: alternc/trunk/src/fixperms.sh @ 2169

Revision 2169, 2.0 KB checked in by anarcat, 5 years ago (diff)

remove a bashism: don't use the function keyword to declare functions,
it's not POSIX.

Note that there might be some other bashisms around, but this is the
only one I am aware of now, so...

Closes: #1122

  • Property svn:executable set to *
Line 
1#!/bin/sh -e
2
3#
4# $Id: fixperms.sh,v 1.1 2005/08/29 19:21:31 benjamin Exp $
5# ----------------------------------------------------------------------
6# AlternC - Web Hosting System
7# Copyright (C) 2002 by the AlternC Development Team.
8# http://alternc.org/
9# ----------------------------------------------------------------------
10# Based on:
11# Valentin Lacambre's web hosting softwares: http://altern.org/
12# ----------------------------------------------------------------------
13# LICENSE
14#
15# This program is free software; you can redistribute it and/or
16# modify it under the terms of the GNU General Public License (GPL)
17# as published by the Free Software Foundation; either version 2
18# of the License, or (at your option) any later version.
19#
20# This program is distributed in the hope that it will be useful,
21# but WITHOUT ANY WARRANTY; without even the implied warranty of
22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23# GNU General Public License for more details.
24#
25# To read the license please visit http://www.gnu.org/copyleft/gpl.html
26# ----------------------------------------------------------------------
27# Original Author of file: Benjamin Sonntag for Metaconsult
28# Purpose of file: Fix permission and ownership of html files
29# ----------------------------------------------------------------------
30#
31
32CONFIG_FILE="/etc/alternc/local.sh"
33
34PATH=/sbin:/bin:/usr/sbin:/usr/bin
35
36umask 022
37
38if [ ! -r "$CONFIG_FILE" ]; then
39    echo "Can't access $CONFIG_FILE."
40    exit 1
41fi
42
43if [ `id -u` -ne 0 ]; then
44    echo "fixperms.sh must be launched as root"
45    exit 1
46fi
47
48. "$CONFIG_FILE"
49
50doone {
51    read GID LOGIN
52    while [ "$LOGIN" ] 
53      do
54      if [ "$DEBUG" ]; then
55          echo "Setting rights and ownership for user $LOGIN having gid $GID"
56      fi
57      INITIALE=`echo $LOGIN |cut -c1`
58      REP="$ALTERNC_LOC/html/$INITIALE/$LOGIN"
59           
60      find $REP -type d -exec chmod g+s \{\} \;
61          chown -R 33.$GID $REP
62          read GID LOGIN
63    done
64}
65
66mysql --defaults-file=/etc/alternc/my.cnf -B -e "select uid,login from membres" |grep -v ^uid|doone
67
Note: See TracBrowser for help on using the repository browser.