4 ###APPDATE: Sat Mar 22 03:05:47 2008
6 ###APPDESC: A su front-end
7 ###APPUSAGE: username cmd
8 ###APPEXAMPLE: r-sudo xiaoranzzz firefox -P xiaoranzzz
10 use lib
$ENV{XR_PERL_MODULE_DIR
};
12 use MyPlace
::Script
::Usage qw
/help_even_empty/;
14 exit 0 if(help_even_empty
($0,@ARGV));
20 if($U eq $ENV{USER
}) {
21 exit exec($CMD,@ARGV);
25 $DOER="su" unless(`which "$DOER"`);
29 $LCMD = $LCMD . " \"" . join("\" \"",@ARGV) . "\"" if(@ARGV);
30 exec $DOER,"-c",$LCMD,$U;
33 exec "gksu","--user",$U,"--message","Password of $U needed to run '$CMD @ARGV'","--",$CMD,@ARGV;