#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1997-07-18 00:46 IDT by <amos@birnam>.
# Source directory was `/home/amos'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#    317 -rwxr-xr-x autologin/autologin
#   1426 -rwxr-xr-x autologin/autologin_client
#    465 -rwxr-xr-x autologin/do-autologin
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
  if test "$gettext_dir" = FAILED && test -f $dir/gettext \
     && ($dir/gettext --version >/dev/null 2>&1)
  then
    set `$dir/gettext --version 2>&1`
    if test "$3" = GNU
    then
      gettext_dir=$dir
    fi
  fi
  if test "$locale_dir" = FAILED && test -f $dir/shar \
     && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
  then
    locale_dir=`$dir/shar --print-text-domain-dir`
  fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
  echo=echo
else
  TEXTDOMAINDIR=$locale_dir
  export TEXTDOMAINDIR
  TEXTDOMAIN=sharutils
  export TEXTDOMAIN
  echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  $echo 'WARNING: not restoring timestamps.  Consider getting and'
  $echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh03151; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
# ============= autologin/autologin ==============
if test ! -d 'autologin'; then
  $echo 'x -' 'creating directory' 'autologin'
  mkdir 'autologin'
fi
if test -f 'autologin/autologin' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'autologin/autologin' '(file already exists)'
else
  $echo 'x -' extracting 'autologin/autologin' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'autologin/autologin' &&
#! /bin/sh
X
# NOTE: when this script is enabled (i.e. have links from /etc/rc[2-5].d/)
# XDM should be disabled, otherwise they'll conflict
X
# run the autologin script in the background (so not to hang the
# boot process) if found
if [ -x /usr/local/bin/do-autologin ]
then
X  /usr/local/bin/do-autologin &
fi
X
Xexit 0
SHAR_EOF
  $shar_touch -am 0718004497 'autologin/autologin' &&
  chmod 0755 'autologin/autologin' ||
  $echo 'restore of' 'autologin/autologin' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'autologin/autologin:' 'MD5 check failed'
115c0a2fd9b329b6782dd7620d447974  autologin/autologin
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'autologin/autologin'`"
    test 317 -eq "$shar_count" ||
    $echo 'autologin/autologin:' 'original size' '317,' 'current size' "$shar_count!"
  fi
fi
# ============= autologin/autologin_client ==============
if test -f 'autologin/autologin_client' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'autologin/autologin_client' '(file already exists)'
else
  $echo 'x -' extracting 'autologin/autologin_client' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'autologin/autologin_client' &&
#!/usr/bin/perl
X
# This script is invoked by xinit (passed to it by the autologin script)
X
# name of file which contains the name of the user to autologin
$LOGIN_FILE = '/etc/autologin';
X
# read the login name
open (LOGIN_FILE, $LOGIN_FILE) || die "$0: $LOGIN_FILE: $!\n";
chop ($login = <LOGIN_FILE>);
close LOGIN_FILE;
X
# get the user's home directory
$home = (getpwnam ($login))[7] or die "$login not found\n";
X
# set the system path, copied from xdm-config
$ENV{'PATH'} = '/usr/local/sbin:/usr/local/bin:/usr/sbin/:/usr/bin:' .
X	       '/sbin:/bin:/usr/bin/X11';
X
# reset the X server, called by XDM before the login widget is presented
system '/etc/X11/xdm/Xsetup';
X
# called by XDM as root after the user logs in, set a utmp entry
system '/etc/X11/xdm/Xstartup';
X
if ($pid = fork) {
X	# the parent:
X
X	# if the fork failed then abort
X	($pid < 0) && die "$0: fork failed: $!\n";
X
X	# wait for the user to logout
X	wait;
X
X	# cleanup the utmp entry and exit, exiting here will cause
X	# xinit(1) to abort
X	exec '/etc/X11/xdm/Xreset';
} else {
X	# the child process - run the Xsession file
X
X	# chdir to user's home directory or die
X	chdir $home or die "Can't chdir to $home: $!\n";
X
X	# user path as copied from xdm-config
X	$ENV{'PATH'}='/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games';
X
X	# set the home envariable
X	$ENV{'HOME'} = $home;
X
X	# execute Xsession as the user
X	exec "/bin/su $login -c 'exec /etc/X11/Xsession'";
}
SHAR_EOF
  $shar_touch -am 0718004297 'autologin/autologin_client' &&
  chmod 0755 'autologin/autologin_client' ||
  $echo 'restore of' 'autologin/autologin_client' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'autologin/autologin_client:' 'MD5 check failed'
87ead71cc896d985889a591a8cfb8560  autologin/autologin_client
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'autologin/autologin_client'`"
    test 1426 -eq "$shar_count" ||
    $echo 'autologin/autologin_client:' 'original size' '1426,' 'current size' "$shar_count!"
  fi
fi
# ============= autologin/do-autologin ==============
if test -f 'autologin/do-autologin' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'autologin/do-autologin' '(file already exists)'
else
  $echo 'x -' extracting 'autologin/do-autologin' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'autologin/do-autologin' &&
#!/usr/bin/perl
X
# ran by /etc/init.d/autologin.
X
# run xinit with the proper client and wait for it to exit.
# after xinit exits, run /etc/init.d/xdm as usual
X
$XINIT = '/usr/bin/X11/xinit';
$XINIT_CLIENT = '/usr/local/bin/autologin_client';
$XINIT_SERVER = '/usr/bin/X11/X :0';
X
# run xinit with a proper client
system "$XINIT $XINIT_CLIENT -- $XINIT_SERVER";
X
# the automatic user logged out, run XDM
exec '/etc/init.d/xdm start' || die "/etc/init.d/xdm: $!\n";
SHAR_EOF
  $shar_touch -am 0718004297 'autologin/do-autologin' &&
  chmod 0755 'autologin/do-autologin' ||
  $echo 'restore of' 'autologin/do-autologin' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'autologin/do-autologin:' 'MD5 check failed'
80788259d8c49fa6d26cd64717cc59f3  autologin/do-autologin
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'autologin/do-autologin'`"
    test 465 -eq "$shar_count" ||
    $echo 'autologin/do-autologin:' 'original size' '465,' 'current size' "$shar_count!"
  fi
fi
rm -fr _sh03151
exit 0
