Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bumped version number, wrote default configuration for xlshd, minor

fixes.
  • Loading branch information...
commit 4ebbe74c04b28ab3c04c96eee6fdc8c0fe36c567 1 parent fab3376
@Nadrin authored
View
12 Makefile
@@ -1,6 +1,9 @@
# xlsh - eXtended Login Shell
# See COPYING file for license details.
+DESTDIR ?= /usr/local
+CONFDIR ?= /etc
+
XLSH_SOURCE = src/xlsh.c src/libxlsh.c
XLSH_HEADERS = include/xlsh.h include/libxlsh.h include/config.h
XLSH_LIBS = -lreadline -lpam
@@ -16,7 +19,14 @@ xlsh: ${XLSH_SOURCE} ${XLSH_HEADERS}
xlshd: ${XLSHD_SOURCE} ${XLSHD_HEADERS}
${CC} -g -Wall -o $@ -I./include ${XLSHD_SOURCE} ${CFLAGS} ${LDFLAGS}
+install: all
+ install -m 755 xlsh ${DESTDIR}/sbin/
+ install -m 755 xlshd ${DESTDIR}/sbin/
+ install -d -m 755 ${CONFDIR}/xlsh
+ install -m 644 etc/xlshrc ${CONFDIR}/xlsh
+ install -m 644 etc/Xresources ${CONFDIR}/xlsh
+
clean:
rm -f xlsh xlshd
-.PHONY: all clean
+.PHONY: all install clean
View
17 README
@@ -5,5 +5,20 @@ A simple login shell with readline functionality and PAM integration.
* When run stand-alone on a virtual console it can replace standard "login" program.
* When run in cooperation with X daemon component (xlshd) it can replace XDM/GDM/KDM.
+Features:
+ * Small and simple, written entirely in C.
+ * Easily hackable because of compact codebase (~950 source lines).
+ * Uses PAM for authorization and session management.
+ * Entirely keyboard driven display manager replacement (when used with xlshd)
+ without the need for any fat libraries or GUI toolkits.
+ * Defaults configured before compilation, some of them can be changed by
+ setting few environment variables.
+ * Single shell script file (/etc/xlsh/xlshrc) for customizing how
+ xlshd launches xlsh.
+ * Introduces a concept of "pre-login shell" known from GNU/HURD.
+ * Only *three* important commands: 'login', 'reboot' and 'shutdown'.
+ * New commands can be easily added (if you need any) by editing xlsh.c
+ * Username autocompletion on TAB.
+
The only build dependencies are: make, a decent C compiler, libreadline and libpam.
-Configuration options can be edited in src/config.h before compiling.
+Configuration options can be edited in include/config.h before compiling.
View
5 etc/Xresources
@@ -0,0 +1,5 @@
+! Default resources for XLSH xterm instance.
+*foreground: white
+*background: black
+*cursorColor: grey90
+*visualBell: off
View
16 etc/xlshrc
@@ -0,0 +1,16 @@
+#!/bin/sh
+# XLSH default startup script for X11.
+TERMINAL=xterm
+XRESFILE=/etc/xlsh/Xresources
+
+screen_w=$(xwininfo -root | grep Width | cut -f2 -d':')
+screen_h=$(xwininfo -root | grep Height | cut -f2 -d':')
+px=$(($screen_w/2 - 240))
+py=$(($screen_h/2 - 150))
+
+if ! which xlsh; then
+ xmessage -center 'xlsh cannot be found in PATH!'
+ exit 1
+fi
+[ -f "$XRESFILE" ] && xrdb "$XRESFILE"
+exec $TERMINAL -g 80x24+$px+$py $(which xlsh)
View
3  include/config.h
@@ -17,6 +17,7 @@
#define XLSH_PATH "/bin:/usr/bin:/usr/local/bin"
#define XLSH_REBOOT "/sbin/shutdown -r now"
#define XLSH_HALT "/sbin/shutdown -h now"
+#define XLSH_XRDB "/usr/bin/xrdb -remove"
#define XLSH_XTTY "/dev/console"
#define XLSH_XTTY_NAME "X11"
#define XLSH_DATEFMT "%Y-%m-%d"
@@ -28,7 +29,7 @@
#define XLSHD_XSERVER "/usr/bin/X"
#define XLSHD_XOPTIONS "-nolisten tcp -noreset"
#define XLSHD_XDISPLAY ":0"
-#define XLSHD_XLSHRC "/etc/xlshrc"
+#define XLSHD_XLSHRC "/etc/xlsh/xlshrc"
#define XLSHD_XWAIT 1
#define XLSHD_XRETRY 2
View
4 include/libxlsh.h
@@ -7,8 +7,8 @@
#ifndef __XLSH_LIBXLSH_H
#define __XLSH_LIBXLSH_H
-#define XLSH_VERSION_API 1
-#define XLSH_VERSION_STRING "0.1.0"
+#define XLSH_VERSION_API 2
+#define XLSH_VERSION_STRING "0.2.0"
#define XLSH_EOK 0x00
#define XLSH_EFATAL 0x01
View
7 src/xlsh.c
@@ -285,6 +285,7 @@ int xlsh_session_exec(pam_handle_t* handle, const char* session, const char* arg
const char* pwname;
char terminal[256];
pid_t proc_shell;
+ int proc_wait = 0;
const char* _arg0 = arg0;
if(!arg0) _arg0 = session;
@@ -315,10 +316,14 @@ int xlsh_session_exec(pam_handle_t* handle, const char* session, const char* arg
setenv("HOME", pwinfo->pw_dir, 1);
setenv("PATH", xlsh_config[XLSH_ID_PATH].value, 1);
- if(xlsh_config[XLSH_ID_DISPLAY].value)
+ if(xlsh_X) {
setenv("DISPLAY", xlsh_config[XLSH_ID_DISPLAY].value, 1);
+ if(libxlsh_proc_exec(XLSH_XRDB, 0) > 0)
+ wait(&proc_wait);
+ }
else
setenv("SHELL", session, 1);
+
if(terminal[0])
setenv("TERM", terminal, 1);
Please sign in to comment.
Something went wrong with that request. Please try again.