diff --git a/tor/.md5sum b/tor/.md5sum index 6ee878bba..d4cd0eeac 100644 --- a/tor/.md5sum +++ b/tor/.md5sum @@ -1,2 +1,2 @@ -6cfe65643f3874a9709f0c19e7c648e0 tor-0.1.2.18.tar.gz +4b3f9963b843010af5aa3bd6266d11e0 tor-0.1.2.19.tar.gz 128bcc0a2ae7a3a6fa86935cabeb9a4b tor.rc diff --git a/tor/Pkgfile b/tor/Pkgfile index 7a77618cf..c8adb5186 100644 --- a/tor/Pkgfile +++ b/tor/Pkgfile @@ -5,7 +5,7 @@ # Depends on: libevent name=tor -version=0.1.2.18 +version=0.1.2.19 release=1 source=(http://tor.eff.org/dist/tor-$version.tar.gz \ tor.rc) diff --git a/tor/README b/tor/README index 3812db7a9..4b611dfe9 100644 --- a/tor/README +++ b/tor/README @@ -7,8 +7,9 @@ PRECAUTION: PRE-INSTALL: - Tor expects to have a user and group dedicated to it, a pre-install script has - been added to the port which takes care of this. + Tor expects to have a user and group dedicated to it, a + pre-install script has been added to the port which takes + care of this. POST-INSTALL: @@ -18,5 +19,6 @@ POST-REMOVE: NOTES: - Please edit /etc/tor/torrc and add "tor" to the SERVICES array in /etc/rc.conf + Please edit /etc/tor/torrc and add "tor" to the SERVICES + array in /etc/rc.conf diff --git a/tor/pre-install b/tor/pre-install old mode 100644 new mode 100755 index e4b902309..b89114fb1 --- a/tor/pre-install +++ b/tor/pre-install @@ -8,29 +8,35 @@ USER_COMMENT="Tor Daemon" USER_HOME=/var/empty USER_SHELL=/bin/sh -if [ $GROUP ] - then - if ! grep -qi $GROUP /etc/group - then - /usr/sbin/groupadd $GROUP - if [ $? -eq 0 ] - then - echo "Group: $GROUP added." - fi - else - echo "Group: $GROUP already exists! Skipping." - fi -fi - -if ! grep -qi $USER /etc/shadow - then - /usr/sbin/useradd -g $GROUP -c "$USER_COMMENT" -d $USER_HOME -s $USER_SHELL $USER - if [ $? -eq 0 ] - then - /usr/bin/passwd -l $USER - echo "User: $USER added." - fi - else - echo "User: $USER already exists! Skipping." +if [ ! $(id -u) = 0 ]; then + echo "ERROR: you need to be root to run this!" + exit 1 +fi + +if [ $GROUP ]; then + if ! getent group $GROUP > /dev/null; then + /usr/sbin/groupadd $GROUP + if [ $? -eq 0 ]; then + echo "Group: $GROUP added." + fi + else + echo "Group: $GROUP already exists! Skipping." + fi +fi + +if ! getent passwd $USER > /dev/null; then + /usr/sbin/useradd -g $GROUP -c "$USER_COMMENT" -d $USER_HOME -s $USER_SHELL $USER + if [ $? -eq 0 ]; then + echo "User: $USER added." + /usr/bin/passwd -l $USER + if [ $? -eq 0 ]; then + echo "Locked $USER account." + fi + else + echo "ERROR: unable to lock $USER account." + /usr/sbin/userdel $USER + fi + else + echo "User: $USER already exists! Skipping." fi