OpenBSD customization:

- hack for XFree86 3.3.x X servers
- ssh-agent integration
- fvwm default window manager
This commit is contained in:
matthieu 2006-11-26 17:17:57 +00:00
parent a972c460fa
commit 7304755a48
5 changed files with 82 additions and 50 deletions

View File

@ -81,7 +81,9 @@ PROGCPPDEFS = \
-DXTERM=@XTERM@ \
-DXSERVER=@XSERVER@ \
-DXAUTH=@XAUTH@ \
-DXINIT=@XINIT@
-DXINIT=@XINIT@ \
-DWM=@WM@ \
-DXCONSOLE=@XCONSOLE@
SCRIPTDEFS = \
-DXINITDIR=$(XINITDIR) $(PROGCPPDEFS) -DLIBDIR=$(libdir) \

View File

@ -49,6 +49,8 @@ DEFAULT_XTERM=xterm
DEFAULT_XSERVER=${bindir}/X
DEFAULT_XAUTH=xauth
DEFAULT_XINIT=xinit
DEFAULT_WM=fvwm
DEFAULT_XCONSOLE=xconsole
AC_ARG_WITH(xrdb,
AS_HELP_STRING([--with-xrdb=XRDB], [Path to xrdb]),
@ -90,6 +92,16 @@ AC_ARG_WITH(xinit,
[XINIT="$withval"],
[XINIT="$DEFAULT_XINIT"])
AC_ARG_WITH(wm,
AS_HELP_STRING([--with-wm=WM], [Path to default window manager]),
[WM="$withval"],
[WM="$DEFAULT_WM"])
AC_ARG_WITH(xconsole,
AS_HELP_STRING([--with-xconsole=XCONSOLE], [Path to xconsole]),
[XCONSOLE="$withval"],
[XCONSOLE="$DEFAULT_XCONSOLE"])
# Checks for pkg-config packages
PKG_CHECK_MODULES(XINIT, x11)
@ -104,6 +116,13 @@ AC_SUBST(XINIT_LIBS)
AC_PATH_PROGS(MCOOKIE, [mcookie], [$MCOOKIE],
[$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/local/bin])
case $host_os in
*openbsd*)
MCOOKIE='dd if=/dev/urandom bs=16 count=1 2>/dev/null | hexdump -e \\\"%08x\\\"'
;;
esac
if test "x$MCOOKIE" != x ; then
STARTX_COOKIE_FLAGS='-DHAS_COOKIE_MAKER -DMK_COOKIE="$(MCOOKIE)"'
fi
@ -131,6 +150,8 @@ AC_SUBST(XTERM)
AC_SUBST(XSERVER)
AC_SUBST(XAUTH)
AC_SUBST(XINIT)
AC_SUBST(WM)
AC_SUBST(XCONSOLE)
# Defines which X servers are listed in help output in xinit.c
# Cheat, lie, and assume all the world is Xorg for now

View File

@ -191,6 +191,7 @@ dummy=0
XCOMM create a file with auth information for the server. ':0' is a dummy.
xserverauthfile=$HOME/.serverauth.$$
trap "rm -f $xserverauthfile" ERR HUP INT QUIT ILL TRAP KILL BUS TERM
xauth -q -f $xserverauthfile << EOF
add :$dummy . $mcookie
EOF

View File

@ -1,5 +1,6 @@
/* $Xorg: xinit.c,v 1.5 2001/02/09 02:05:49 xorgcvs Exp $ */
/* $XdotOrg: $ */
/* $XdotOrg: xc/programs/xinit/xinit.c,v 1.4 2005/10/04 01:27:34 ajax Exp $ */
/* $OpenBSD: xinit.c,v 1.2 2006/11/26 17:17:57 matthieu Exp $ */
/*
@ -36,6 +37,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xos.h>
#include <stdio.h>
#include <ctype.h>
#include <sys/param.h>
#ifdef X_POSIX_C_SOURCE
#define _POSIX_C_SOURCE X_POSIX_C_SOURCE
@ -156,6 +158,9 @@ char xserverrcbuf[256];
#define OK_EXIT 0
#define ERR_EXIT 1
char *default_wrapper = BINDIR "/Xwrapper";
char real_server[MAXPATHLEN];
char test_path[MAXPATHLEN];
char *default_server = "X";
char *default_display = ":0"; /* choose most efficient */
char *default_client[] = {"xterm", "-geometry", "+1+1", "-n", "login", NULL};
@ -273,7 +278,8 @@ main(int argc, char *argv[], char *envp[])
register char **sptr = server;
register char **cptr = client;
register char **ptr;
int pid;
char *path, *p;
int pid, n;
int client_given = 0, server_given = 0;
int client_args_given = 0, server_args_given = 0;
int start_of_client_args, start_of_server_args;
@ -346,7 +352,36 @@ main(int argc, char *argv[], char *envp[])
if (argc == 0 ||
#ifndef __UNIXOS2__
(**argv != '/' && **argv != '.')) {
*sptr++ = default_server;
/* hack for the Xfree86 3.3.6 servers: if the X link
points to XF86_*, start Xwrapper instead of X */
path = strdup(getenv("PATH"));
if (path == NULL) {
Error("Can't find PATH\n");
exit(1);
}
/* Walk through the PATH */
for (p = strtok(path, ":"); p != NULL; p = strtok(NULL, ":")) {
strlcpy(test_path, p, sizeof(test_path));
strlcat(test_path, "/", sizeof(test_path));
strlcat(test_path, default_server, sizeof(test_path));
if ((n = readlink(test_path, real_server,
sizeof(real_server) - 1)) > 0) {
real_server[n] = '\0';
/* if the target path contains XF86_, we
need Xwrapper */
if (strstr(real_server, "XF86_") != NULL) {
*sptr++ = default_wrapper;
} else {
*sptr++ = default_server;
}
break;
}
}
if (p == NULL) {
Error("Can't find X link\n");
exit(1);
}
free(path);
#else
(**argv != '/' && **argv != '\\' && **argv != '.' &&
!(isalpha(**argv) && (*argv)[1]==':'))) {

View File

@ -1,5 +1,6 @@
XCOMM!SHELL_CMD
XCOMM $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $
XCOMM $OpenBSD: xinitrc.cpp,v 1.2 2006/11/26 17:17:57 matthieu Exp $
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
@ -24,52 +25,24 @@ if [ -f $usermodmap ]; then
XMODMAP $usermodmap
fi
XCOMM if we have private ssh key(s), start ssh-agent and add the key(s)
id1=$HOME/.ssh/identity
id2=$HOME/.ssh/id_dsa
id3=$HOME/.ssh/id_rsa
if [ -x /usr/bin/ssh-agent ] && [ -f $id1 -o -f $id2 -o -f $id3 ];
then
eval `ssh-agent -s`
ssh-add < /dev/null
fi
XCOMM start some nice programs
#if defined(__SCO__) || defined(__UNIXWARE__)
if [ -r /etc/default/xdesktops ]; then
. /etc/default/xdesktops
fi
if [ -r $HOME/.x11rc ]; then
. $HOME/.x11rc
else
if [ -r /etc/default/X11 ]; then
. /etc/default/X11
fi
fi
#if defined(__SCO__)
if [ -n "$XSESSION" ]; then
case "$XSESSION" in
[Yy][Ee][Ss])
[ -x /usr/bin/X11/scosession ] && exec /usr/bin/X11/scosession
;;
esac
fi
if [ -n "$XDESKTOP" ]; then
exec `eval echo $"$XDESKTOP"`
else
if [ -x /usr/bin/X11/pmwm -a -x /usr/bin/X11/scoterm ]; then
/usr/bin/X11/scoterm 2> /dev/null &
exec /usr/bin/X11/pmwm 2> /dev/null
fi
fi
#elif defined(__UNIXWARE__)
if [ -n "$XDESKTOP" ]; then
exec `eval echo $"$XDESKTOP"`
else
if [ -x /usr/X/bin/pmwm ]; then
exec /usr/X/bin/pmwm 2> /dev/null
fi
fi
#endif
XCOMM This is the fallback case if nothing else is executed above
#endif /* !defined(__SCO__) && !defined(__UNIXWARE__) */
TWM &
XCLOCK -geometry 50x50-1+1 &
XTERM -geometry 80x50+494+51 &
XTERM -geometry 80x20+494-0 &
exec XTERM -geometry 80x66+0+0 -name login
XCONSOLE -iconic &
XTERM -geometry 80x24 &
WM || XTERM
if [ "$SSH_AGENT_PID" ]; then
ssh-add -D < /dev/null
eval `ssh-agent -s -k`
fi