fixing fixperms so that 'read' never exit with !=0 (crashing the -e in postinst)
This commit is contained in:
parent
1fc489c6e8
commit
94290b09f9
|
@ -1,13 +1,9 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
#
|
#
|
||||||
# $Id: fixperms.sh,v 1.1 2005/08/29 19:21:31 benjamin Exp $
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
# AlternC - Web Hosting System
|
# AlternC - Web Hosting System
|
||||||
# Copyright (C) 2002 by the AlternC Development Team.
|
# Copyright (C) 2000-2012 by the AlternC Development Team.
|
||||||
# http://alternc.org/
|
# https://alternc.org/
|
||||||
# ----------------------------------------------------------------------
|
|
||||||
# Based on:
|
|
||||||
# Valentin Lacambre's web hosting softwares: http://altern.org/
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
# LICENSE
|
# LICENSE
|
||||||
#
|
#
|
||||||
|
@ -23,19 +19,18 @@
|
||||||
#
|
#
|
||||||
# To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
# 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, ACL and ownership of AlternC's files
|
||||||
# Purpose of file: Fix permission and ownership of html files
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
|
||||||
#Default Query : fixperms for all account
|
# Default Query : fixperms for all account
|
||||||
query="SELECT uid,login FROM membres"
|
query="SELECT uid,login FROM membres"
|
||||||
sub_dir=""
|
sub_dir=""
|
||||||
file=""
|
file=""
|
||||||
#Two optionals argument
|
# Two optionals argument
|
||||||
# -l string : a specific login to fix
|
# -l string : a specific login to fix
|
||||||
# -u interger : a specific uid to fix
|
# -u integer : a specific uid to fix
|
||||||
# -f interger : a specific file to fix according to a given uid
|
# -f integer : a specific file to fix according to a given uid
|
||||||
|
|
||||||
while getopts "l:u:f:d:" optname
|
while getopts "l:u:f:d:" optname
|
||||||
do
|
do
|
||||||
|
@ -105,7 +100,7 @@ doone() {
|
||||||
INITIALE=`echo $LOGIN |cut -c1`
|
INITIALE=`echo $LOGIN |cut -c1`
|
||||||
REP="$ALTERNC_LOC/html/$INITIALE/$LOGIN/$sub_dir"
|
REP="$ALTERNC_LOC/html/$INITIALE/$LOGIN/$sub_dir"
|
||||||
|
|
||||||
# Set the file readable only for the AlternC User
|
# Set the file readable only for the AlternC User
|
||||||
chown -R alterncpanel:$GID "$REP"
|
chown -R alterncpanel:$GID "$REP"
|
||||||
chmod 2770 -R "$REP"
|
chmod 2770 -R "$REP"
|
||||||
|
|
||||||
|
@ -115,11 +110,11 @@ doone() {
|
||||||
-Rm g:alterncpanel:rwx -m u:$GID:rwx -m g:$GID:rwx -m mask:rwx\
|
-Rm g:alterncpanel:rwx -m u:$GID:rwx -m g:$GID:rwx -m mask:rwx\
|
||||||
"$REP"
|
"$REP"
|
||||||
|
|
||||||
read GID LOGIN
|
read GID LOGIN || true
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
fixefile(){
|
fixfile() {
|
||||||
read GID LOGIN
|
read GID LOGIN
|
||||||
/usr/bin/setfacl -bk $file
|
/usr/bin/setfacl -bk $file
|
||||||
echo "gid: $GID"
|
echo "gid: $GID"
|
||||||
|
@ -131,9 +126,9 @@ fixefile(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $file != "" ]]; then
|
if [[ "$file" != "" ]]; then
|
||||||
if [ -e $file ]; then
|
if [ -e "$file" ]; then
|
||||||
mysql --defaults-file=/etc/alternc/my.cnf --skip-column-names -B -e "$query" |fixefile
|
mysql --defaults-file=/etc/alternc/my.cnf --skip-column-names -B -e "$query" |fixfile
|
||||||
else
|
else
|
||||||
echo "file not found"
|
echo "file not found"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue