]> git.donarmstrong.com Git - cran2deb.git/commitdiff
sudo to cran2deb user prior to commands if not already user
authorblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sun, 6 Jun 2010 18:50:23 +0000 (18:50 +0000)
committerblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sun, 6 Jun 2010 18:50:23 +0000 (18:50 +0000)
git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@311 edb9625f-4e0d-4859-8d74-9fd3b1da38cb

trunk/exec/cran2deb

index 7efedc751a484296ff30eb77cc3ed568cebc6635..3b2794acf3ba570e3622072d037c1257e5a6cff1 100755 (executable)
@@ -7,4 +7,10 @@ if [ ! -x "$root/exec/$cmd" ]; then
     echo unknown command $cmd
     exit 1
 fi
-"$root/exec/$cmd" "$root" $*
+
+precmd=""
+if [ "$(id -un)" != c2d ]; then
+       precmd="sudo -u c2d -E"
+fi
+
+$precmd "$root/exec/$cmd" "$root" $*