Siebrand has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/87687


Change subject: Remove use of static base paths
......................................................................

Remove use of static base paths

Also some consistency and cleanup.

Change-Id: Ide0ebaf7df1b9bc88d93fb1ad70aac22f5ec17ea
---
M bin/repo
M bin/repocommit
M bin/repocreate
M bin/repoexport
M bin/repoupdate
M bin/udpcast
M bin/update-externals
7 files changed, 39 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/translatewiki 
refs/changes/87/87687/1

diff --git a/bin/repo b/bin/repo
index 92f187a..d39f4c5 100755
--- a/bin/repo
+++ b/bin/repo
@@ -2,10 +2,13 @@
 set -e
 umask 0002
 
+DIRSCRIPT="`dirname \"$0\"`"
+DIRSCRIPT="`( cd \"$DIRSCRIPT\" && pwd )`"
+
 COMMAND=$1
 PROJECT=$2
 DIR=/resources/projects
 
 echo "$(date --rfc-3339=seconds --utc) [$(whoami)] $0 $@" >> 
/home/betawiki/logs/repo
 
-sudo -u betawiki "/home/betawiki/config/bin/repo$COMMAND" "$PROJECT" "$DIR"
+sudo -u betawiki "${DIRSCRIPT}/repo$COMMAND" "$PROJECT" "$DIR"
diff --git a/bin/repocommit b/bin/repocommit
index 07d6610..364105b 100755
--- a/bin/repocommit
+++ b/bin/repocommit
@@ -1,13 +1,17 @@
 #!/bin/bash
 set -e
 
+DIRSCRIPT="`dirname \"$0\"`"
+DIRSCRIPT="`( cd \"$DIRSCRIPT\" && pwd )`"
+DIRLOG=/home/betawiki/logs/repo
 PROJECT=$1
+
 DIR=$2
 : ${DIR:=`pwd`}
-source /home/betawiki/config/bin/findexportroot
+source ${DIRSCRIPT}/findexportroot
 cd "$DIR"
 
-echo "$(date --rfc-3339=seconds --utc) [$(whoami) at $DIR] $0 $@" >> 
/home/betawiki/logs/repo
+echo "$(date --rfc-3339=seconds --utc) [$(whoami) at $DIR] $0 $@" >> ${DIRLOG}
 
 COMMITMSG="Localisation updates from http://translatewiki.net.";
 
@@ -196,6 +200,6 @@
        cd ..
 
 else
-       echo "Unknown project"
+       echo "`basename $0`: Unknown project"
        exit 1
 fi
diff --git a/bin/repocreate b/bin/repocreate
index 4a215fa..8863284 100755
--- a/bin/repocreate
+++ b/bin/repocreate
@@ -1,13 +1,17 @@
 #!/bin/bash
 set -e
 
+DIRSCRIPT="`dirname \"$0\"`"
+DIRSCRIPT="`( cd \"$DIRSCRIPT\" && pwd )`"
+DIRLOG=/home/betawiki/logs/repo
 PROJECT=$1
+
 DIR=$2
 : ${DIR:=`pwd`}
-source /home/betawiki/config/bin/findexportroot
+source ${DIRSCRIPT}/findexportroot
 cd "$DIR"
 
-echo "$(date --rfc-3339=seconds --utc) [$(whoami) at $DIR] $0 $@" >> 
/home/betawiki/logs/repo
+echo "$(date --rfc-3339=seconds --utc) [$(whoami) at $DIR] $0 $@" >> ${DIRLOG}
 
 if [ "$PROJECT" = "commons-android" ]
 then
@@ -372,5 +376,6 @@
        git clone "$REPO_WLMMOBILE" $PROJECT
 
 else
-       echo "Unknown project"
+       echo "`basename $0`: Unknown project"
+       exit 1
 fi
diff --git a/bin/repoexport b/bin/repoexport
index aaacf65..802deaf 100755
--- a/bin/repoexport
+++ b/bin/repoexport
@@ -1,15 +1,19 @@
 #!/bin/bash
 set -e
 
+DIRSCRIPT="`dirname \"$0\"`"
+DIRSCRIPT="`( cd \"$DIRSCRIPT\" && pwd )`"
+DIRLOG=/home/betawiki/logs/repo
 PROJECT=$1
+WIKI=/www/translatewiki.net/w
+
 DIR=$2
 : ${DIR:=`pwd`}
-source /home/betawiki/config/bin/findexportroot
+source ${DIRSCRIPT}/findexportroot
 cd "$DIR"
 
-echo "$(date --rfc-3339=seconds --utc) [$(whoami) at $DIR] $0 $@" >> 
/home/betawiki/logs/repo
+echo "$(date --rfc-3339=seconds --utc) [$(whoami) at $DIR] $0 $@" >> ${DIRLOG}
 
-WIKI=/www/translatewiki.net/w
 EXPORTER=$WIKI/extensions/Translate/scripts/export.php
 SKIPLANGS="test, be-x-old, crh, dk, en, fiu-vro, gan, got, hif, kbd, kk, 
kk-cn, iu, kk-kz, kk-tr, ko-kp, ku, ku-arab, no, ruq, simple, sr, tg, tp, tt, 
ug, zh, zh-classical, zh-cn, zh-sg, zh-hk, zh-min-nan, zh-mo, zh-my, zh-tw, 
zh-yue, bbc, ady"
 THRESHOLD="--threshold 35"
@@ -260,6 +264,6 @@
        php "$EXPORTER" --target . --group=out-wikimedia-mobile-wlm --lang qqq
 
 else
-       echo "repoexport: Unknown project"
+       echo "`basename $0`: Unknown project"
        exit 1
 fi
diff --git a/bin/repoupdate b/bin/repoupdate
index d372801..eba354d 100755
--- a/bin/repoupdate
+++ b/bin/repoupdate
@@ -259,6 +259,6 @@
        svn up $PROJECT
 
 else
-       echo "Unknown project"
+       echo "`basename $0`: Unknown project"
        exit 1
 fi
diff --git a/bin/udpcast b/bin/udpcast
index 1490495..0e868f1 100755
--- a/bin/udpcast
+++ b/bin/udpcast
@@ -1,2 +1,7 @@
 #!/bin/sh
-php /home/betawiki/config/bin/scripts/snedUdpMessage.php --host=127.0.0.1 
--port=8966 --quiet=1 \[`whoami`\] $@
+set -e
+
+DIRSCRIPT="`dirname \"$0\"`"
+DIRSCRIPT="`( cd \"$DIRSCRIPT\" && pwd )`"
+
+php ${DIRSCRIPT}/scripts/snedUdpMessage.php --host=127.0.0.1 --port=8966 
--quiet=1 \[`whoami`\] $@
diff --git a/bin/update-externals b/bin/update-externals
index a650ca5..8d0d538 100755
--- a/bin/update-externals
+++ b/bin/update-externals
@@ -2,6 +2,9 @@
 set -e
 umask 0002
 
+DIRSCRIPT="`dirname \"$0\"`"
+DIRSCRIPT="`( cd \"$DIRSCRIPT\" && pwd )`"
+
 WIKI=/www/translatewiki.net/w
 
 for PROJECT in \
@@ -37,11 +40,11 @@
 WLMMobile
 do
        echo "Updating ${PROJECT}..."
-       /home/betawiki/config/bin/repo update "$PROJECT" && echo "$PROJECT 
done!" &
+       ${DIRSCRIPT}/repo update "$PROJECT" && echo "$PROJECT done!" &
 done
 wait
 echo "All projects updated!"
-/home/betawiki/config/bin/createmi
+${DIRSCRIPT}/createmi
 wait
 php $WIKI/extensions/Translate/scripts/processMessageChanges.php
 echo "Really. Go to https://translatewiki.net/wiki/Special:ManageMessageGroups 
for the last bits"

-- 
To view, visit https://gerrit.wikimedia.org/r/87687
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide0ebaf7df1b9bc88d93fb1ad70aac22f5ec17ea
Gerrit-PatchSet: 1
Gerrit-Project: translatewiki
Gerrit-Branch: master
Gerrit-Owner: Siebrand <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to