mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 23:03:40 +01:00
Looks like final fix for xlaunch
svn path=/nixpkgs/trunk/; revision=10044
This commit is contained in:
parent
763ac687b2
commit
a677869546
1 changed files with 31 additions and 6 deletions
|
@ -3,12 +3,37 @@ stdenv.mkDerivation {
|
|||
name = "xlaunch";
|
||||
inherit xorgserver;
|
||||
buildCommand = "
|
||||
cat << EOF > realizeuid.c
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
int main(int argc, char ** argv, char ** envp)
|
||||
{
|
||||
uid_t a,b,c;
|
||||
int i;
|
||||
char *nargv[10000];
|
||||
char arg1 [10];
|
||||
nargv[0]=argv[0];
|
||||
for (i=1; i<=argc; i++){
|
||||
nargv[i+1]=argv[i];
|
||||
}
|
||||
nargv[1]=arg1;
|
||||
getresuid (&a,&b,&c);
|
||||
snprintf(arg1,8,\"%d\",a);
|
||||
setresuid(c,c,c);
|
||||
execve(\"\$out/libexec/xlaunch\", nargv, envp);
|
||||
}
|
||||
EOF
|
||||
mkdir -p \$out/bin
|
||||
echo '
|
||||
(egrep \"^ +env\" /etc/event.d/xserver | sed -e \"s/env/ export /\" ; echo X;) | bash &
|
||||
sleep 15;
|
||||
\"$@\";
|
||||
' >\$out/bin/xlaunch
|
||||
chmod a+x \$out/bin/xlaunch
|
||||
mkdir -p \$out/libexec
|
||||
gcc realizeuid.c -o \$out/bin/xlaunch
|
||||
echo '#! ${stdenv.shell}
|
||||
(egrep \"^ +env\" /etc/event.d/xserver | sed -e \"s/env/ export /\" | sed -e '\\''s/#.*//'\\'' ; echo export _XARGS_=\\\$\\( grep xserver_arguments \\\$SLIM_CFGFILE \\| sed -e s/xserver_arguments// \\) ; echo X \\\$_XARGS_ ) | bash -l &
|
||||
while ! test -e /tmp/.X11-unix/X0 &>/dev/null ; do sleep 0.5; done
|
||||
USER=\$(egrep '\\''^[-a-z0-9A-Z_]*:[^:]*:'\\''\$1'\\'':'\\'' /etc/passwd | sed -e '\\''s/:.*//'\\'' )
|
||||
shift
|
||||
su -l \${USER:-identityless-shelter} -c \"DISPLAY=:0 \$*\";
|
||||
' >\$out/libexec/xlaunch
|
||||
chmod a+x \$out/libexec/xlaunch
|
||||
";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue