[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Make OSX installer install files owned by root, not by nick...
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] Make OSX installer install files owned by root, not by nick...
- From: nickm@xxxxxxxx (Nick Mathewson)
- Date: Wed, 22 Dec 2004 18:37:51 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Wed, 22 Dec 2004 18:38:13 -0500
- Reply-to: or-dev@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Update of /home/or/cvsroot/tor/contrib/osx
In directory moria.mit.edu:/tmp/cvs-serv29238/contrib/osx
Modified Files:
Tag: tor-0_0_9-patches
Makefile.am StartupParameters.plist Tor package.sh
Added Files:
Tag: tor-0_0_9-patches
.cvsignore TorPostflight addsysuser
Log Message:
Make OSX installer install files owned by root, not by nickm. Also, have it run as _tor, not as root.
--- NEW FILE: .cvsignore ---
Makefile
Makefile.in
TorBundleDesc.plist
TorBundleInfo.plist
TorDesc.plist
TorInfo.plist
Index: Makefile.am
===================================================================
RCS file: /home/or/cvsroot/tor/contrib/osx/Attic/Makefile.am,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- Makefile.am 19 Dec 2004 04:48:34 -0000 1.1.2.2
+++ Makefile.am 22 Dec 2004 23:37:48 -0000 1.1.2.3
@@ -4,5 +4,5 @@
ReadMe.rtf StartupParameters.plist Tor TorBundleDesc.plist.in \
TorBundleInfo.plist.in TorBundleWelcome.rtf TorDesc.plist.in \
TorInfo.plist.in TorStartupDesc.plist TorStartupInfo.plist \
- package.sh privoxy.config
+ package.sh privoxy.config TorPostflight addsysuser
Index: StartupParameters.plist
===================================================================
RCS file: /home/or/cvsroot/tor/contrib/osx/Attic/StartupParameters.plist,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- StartupParameters.plist 19 Dec 2004 04:26:30 -0000 1.1.2.1
+++ StartupParameters.plist 22 Dec 2004 23:37:48 -0000 1.1.2.2
@@ -1,10 +1,10 @@
{
- Description = "Tor";
+ Description = "Tor";
Provides = ("tor");
Requires = ("Network");
Uses = ("Network");
- OrderPreference = "Last";
- Messages =
+ OrderPreference = "Last";
+ Messages =
{
start = "Starting Tor";
stop = "Stopping Tor";
Index: Tor
===================================================================
RCS file: /home/or/cvsroot/tor/contrib/osx/Attic/Tor,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- Tor 19 Dec 2004 04:26:30 -0000 1.1.2.1
+++ Tor 22 Dec 2004 23:37:48 -0000 1.1.2.2
@@ -1,5 +1,12 @@
#!/bin/sh
+TORCONF=/usr/local/etc/tor/torrc
+TORDIR=/usr/local/var/lib/tor
+TORPID=/var/run/Tor.pid
+TORUSER=_tor
+TORGROUP=daemon
+TORCMD=/usr/local/bin/tor
+
##
# Tor Service
##
@@ -9,15 +16,15 @@
StartService ()
{
- if [ -f /usr/local/bin/tor ]; then
+ if [ -f $TORCMD ]; then
if pid=$(GetPID Tor); then
return 0
else
ConsoleMessage "Starting Tor Service"
# Tentative
# Making sure it is not running (I know it is not a best approarch)
- killall tor
- /usr/local/bin/tor -f /usr/local/etc/tor/torrc --runasdaemon 1 --pidfile /var/run/Tor.pid &
+ killall tor 2>/dev/null
+ $TORCMD -f $TORCONF --runasdaemon 1 --pidfile $TORPID --datadirectory $TORDIR --user $TORUSER --group $TORGROUP &
fi
fi
}
@@ -28,11 +35,11 @@
ConsoleMessage "Stopping Tor Service"
kill -TERM "${pid}"
# Just for sanity (sometimes necessary.)
- killall tor
+ killall tor 2>/dev/null
else
ConsoleMessage "Tor Service not responding."
-# Just for sanity (sometimes necessary.)
- killall tor
+# Just for sanity (sometimes necessary.)
+ killall tor 2>/dev/null
fi
}
--- NEW FILE: TorPostflight ---
#!/bin/sh
# TorPostflight gets invoked after any install or upgrade.
ADDSYSUSER=$RECEIPT_PATH/addsysuser
if [ ! -x "$ADDSYSUSER" ]; then
echo "Could not find addsysuser script."
exit 1
fi
TORUSER=_tor
TORGROUP=daemon
TORDIR=/usr/local/var/lib/tor
# Create user $TORUSER in group daemon. If it's already there, great.
$ADDSYSUSER $TORUSER "Tor System user" $TORDIR
# Create the tor directory, if it doesn't exist.
if [ ! -d $TORDIR ]; then
mkdir -p $TORDIR
fi
# Check its permissions.
chown $TORUSER $TORDIR
chgrp daemon $TORDIR
chmod 700 $TORDIR
--- NEW FILE: addsysuser ---
#!/bin/sh
#
# Original adduser 05 Feb 2002 by Jon L. Gardner
#
# Modified for Tor installer by Nick Mathewson
if [ "`whoami`" != "root" ]; then
echo "You must be root to execute this script."
exit
fi
if [ "x$3" = "x" ]; then
echo 'Usage: addsysuser <username> "<full name>" <homedir>'
exit 0
fi
username=$1
realname=$2
homedir=$3
# GID 20 is "staff" which is the default. Change it if you want.
gid=`niutil -readprop / /groups/daemon gid`
if [ "x`niutil -list / /users|cut -f2 -d' '|grep $username`" != "x" ]; then
echo The account $username already exists.
exit 0
fi
# home is the local path to the home directory
home=/Users/$username
# defhome is what goes into NetInfo
defhome="/Network/Servers/MyServer/Users"
#echo "Determining next available uid (please be patient)..."
uiddef=`nidump passwd / | cut -d: -f3 | sort -n | tail -n 1`
uiddef=`echo $uiddef + 1 |bc`
echo Creating account for $username...
niutil -create / /users/$username
niutil -createprop / /users/$username _writers_tim_passwd $username
niutil -createprop / /users/$username realname $realname
niutil -createprop / /users/$username _writers_passwd $username
niutil -createprop / /users/$username uid $uiddef
#niutil -createprop / /users/$username home_loc "<home_dir><url>afp://afp.server.com/Users/</url><path>$username</path></home_dir>"
niutil -createprop / /users/$username gid $gid
niutil -createprop / /users/$username home $homedir
niutil -createprop / /users/$username name $username
niutil -createprop / /users/$username passwd '*'
niutil -createprop / /users/$username shell /dev/null
Index: package.sh
===================================================================
RCS file: /home/or/cvsroot/tor/contrib/osx/Attic/package.sh,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -d -r1.1.2.5 -r1.1.2.6
--- package.sh 21 Dec 2004 04:03:56 -0000 1.1.2.5
+++ package.sh 22 Dec 2004 23:37:48 -0000 1.1.2.6
@@ -34,7 +34,9 @@
umask 022
-rm -rf $BUILD_DIR
+echo I might ask you for your password now, so you can sudo.
+
+sudo rm -rf $BUILD_DIR
mkdir $BUILD_DIR || exit 1
for subdir in tor_packageroot tor_resources \
torstartup_packageroot \
@@ -46,8 +48,11 @@
### Make Tor package.
make install DESTDIR=$BUILD_DIR/tor_packageroot
+cp $BUILD_DIR/tor_packageroot/usr/local/etc/tor/torrc.sample $BUILD_DIR/tor_packageroot/usr/local/etc/tor/torrc
cp contrib/osx/ReadMe.rtf $BUILD_DIR/tor_resources
cp contrib/osx/License.rtf $BUILD_DIR/tor_resources
+cp contrib/osx/TorPostflight $BUILD_DIR/tor_resources/postflight
+cp contrib/osx/addsysuser $BUILD_DIR/tor_resources/addsysuser
cat <<EOF > $BUILD_DIR/tor_resources/Welcome.txt
Tor: an anonymous Internet communication system
@@ -55,6 +60,8 @@
others to do so.
EOF
+find $BUILD_DIR/tor_packageroot -print0 |sudo xargs -0 chown root:admin
+
$PACKAGEMAKER -build \
-p $BUILD_DIR/output/Tor.pkg \
-f $BUILD_DIR/tor_packageroot \
@@ -66,6 +73,8 @@
mkdir -p $BUILD_DIR/privoxyconf_packageroot/Library/Privoxy
cp contrib/osx/privoxy.config $BUILD_DIR/privoxyconf_packageroot/Library/Privoxy/config
+find $BUILD_DIR/privoxyconf_packageroot -print0 |sudo xargs -0 chown root:admin
+
$PACKAGEMAKER -build \
-p $BUILD_DIR/output/privoxyconf.pkg \
-f $BUILD_DIR/privoxyconf_packageroot \
@@ -78,6 +87,7 @@
cp contrib/osx/Tor contrib/osx/StartupParameters.plist \
$BUILD_DIR/torstartup_packageroot/Library/StartupItems/Tor
+find $BUILD_DIR/torstartup_packageroot -print0 | sudo xargs -0 chown root:admin
$PACKAGEMAKER -build \
-p $BUILD_DIR/output/torstartup.pkg \
-f $BUILD_DIR/torstartup_packageroot \
@@ -126,8 +136,12 @@
### Package it all into a DMG
+find $BUILD_DIR/output -print0 | sudo xargs -0 chown root:admin
+
mv $BUILD_DIR/output "$BUILD_DIR/Tor $VERSION Bundle"
rm -f "Tor $VERSION Bundle.dmg"
-hdiutil create -format UDZO -srcfolder "$BUILD_DIR/Tor $VERSION Bundle" "Tor $VERSION Bundle.dmg"
+USER="`whoami`"
+sudo hdiutil create -format UDZO -srcfolder "$BUILD_DIR/Tor $VERSION Bundle" "Tor $VERSION Bundle.dmg"
+sudo chown "$USER" "Tor $VERSION Bundle.dmg"
-rm -rf $BUILD_DIR
+sudo rm -rf $BUILD_DIR