Roxen.git/
server/
start
Branch:
Tag:
Non-build tags
All tags
No tags
2000-11-16
2000-11-16 10:56:19 by Per Hedbor <ph@opera.com>
196c3f5dfddfc6d5e91fa30f38a9a555dbf1cf56 (
60
lines) (+
59
/-
1
)
[
Show
|
Annotate
]
Branch:
5.2
Some added magic for chmod/chgrp/chown support.
Rev: server/start:1.133
1:
#!/bin/sh #
-
# $Id: start,v 1.
132
2000/11/
11
04
:
27
:
06
nilsson
Exp $
+
# $Id: start,v 1.
133
2000/11/
16
10
:
56
:
19
per
Exp $
### If --silent-start is given as the first argument, ### nothing will be printed to stdout by the script.
20:
fi }
+
+
change_owner( ) {
+
uid="$1"; shift
+
gid="$1"; shift
+
+
for a in "$@" ; do
+
ok=`ls -lgd $a 2>/dev/null | grep $uid | grep $gid | wc -l`
+
ok=`echo $ok`
+
if [ x$ok = x1 ] ; then
+
dp "$a already has the correct ownership"
+
else
+
dp "Changing ownership of $a to $uid:$gid"
+
if chown -R "$uid" "$a" 2>/dev/null ; then
+
if chgrp -R "$gid" "$a" 2>/dev/null ; then
+
:
+
else
+
dp "Group change failed"
+
fi
+
else
+
dp "Ownership change failed"
+
fi
+
fi
+
done
+
}
+
+
+
check_owner() {
+
uid=`$pike -e 'write("%d",getuid())'`
+
gargs=''
+
+
if [ x"$uid" = x0 ] ; then
+
# Shall we change uid/gid?
+
num=`grep --help 2>&1|grep gnu|wc -l`
+
num=`echo $num`
+
if [ x"$num" = x1 ] ; then
+
gargs='-a'
+
fi
+
ugid=`grep $gargs "='User'>" $DIR/Global_Variables 2>/dev/null\
+
| sed -e 's/.*<str>//' -e 's,</str>.*,,'`
+
if [ ! x$ugid = x ] ; then
+
dp "Doing uid change to $ugid"
+
oifs="$IFS";IFS=':';set $ugid;IFS="$oifs"
+
change_owner $1 $2 $DIR $VARDIR $LOGDIR
+
ok=`ls -lgd $a 2>/dev/null | grep $2 |wc -l`
+
ok=`echo $ok`
+
if [ "x$ok" = x1 ] ; then
+
dp ". is already readable by $2"
+
else
+
chgrp -R "$2" .
+
chmod -R g+w .
+
fi
+
fi
+
fi
+
}
+
+
# Breaks on linux when using symlinks. dn="`dirname $0`" case "$dn" in
592:
} start_roxen() {
+
check_owner
if [ x$remove_dumped = x1 ] ; then remove_old_dot_o_files "user request" fi