From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7655 invoked from network); 20 Jul 2005 18:04:24 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 20 Jul 2005 18:04:24 -0000 Received: (qmail 33040 invoked from network); 20 Jul 2005 18:04:18 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 20 Jul 2005 18:04:18 -0000 Received: (qmail 24488 invoked by alias); 20 Jul 2005 18:04:16 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21500 Received: (qmail 24479 invoked from network); 20 Jul 2005 18:04:15 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 20 Jul 2005 18:04:15 -0000 Received: (qmail 32819 invoked from network); 20 Jul 2005 18:04:15 -0000 Received: from mailhost1.csr.com (HELO MAILSWEEPER01.csr.com) (81.105.217.43) by a.mx.sunsite.dk with SMTP; 20 Jul 2005 18:04:09 -0000 Received: from exchange03.csr.com (unverified [10.100.137.60]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Wed, 20 Jul 2005 19:02:06 +0100 Received: from news01.csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 20 Jul 2005 19:06:11 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.1/8.12.11) with ESMTP id j6KI47FP004994 for ; Wed, 20 Jul 2005 19:04:07 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.13.1/8.13.1/Submit) with ESMTP id j6KI474K004991 for ; Wed, 20 Jul 2005 19:04:07 +0100 Message-Id: <200507201804.j6KI474K004991@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk Subject: Re: PATCH: Re: Implementation of simple newuser module (how to start?) In-reply-to: <200507201401.j6KE1k5i004733@news01.csr.com> References: <200507201401.j6KE1k5i004733@news01.csr.com> Date: Wed, 20 Jul 2005 19:04:06 +0100 From: Peter Stephenson X-OriginalArrivalTime: 20 Jul 2005 18:06:11.0073 (UTC) FILETIME=[B5BD0F10:01C58D55] X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 Here's a basic newuser script to be installed and the outline of the function that will be doing the work. The function zsh-install-newuser is the file to edit to do the work; everything else should work as it is. We don't want to distribute the shell with this default version of zsh-install-newuser, which will simply make it harder to fix things later on; it would be better to have it do nothing. However, I assume it will be doing something by then. I've created a separate Scripts directory for files which will be run directly by the shell (actually sourced in this case) and adapted the function installation system to install them. Index: Makefile.in =================================================================== RCS file: /cvsroot/zsh/zsh/Makefile.in,v retrieving revision 1.13 diff -u -r1.13 Makefile.in --- Makefile.in 3 Mar 2004 19:37:53 -0000 1.13 +++ Makefile.in 20 Jul 2005 17:59:57 -0000 @@ -84,6 +84,7 @@ test x$(sitefndir) != xno && \ $(SHELL) $(sdir_top)/mkinstalldirs $(DESTDIR)$(sitefndir); \ sdir_top="$(sdir_top)" fndir="$(fndir)" dir_top="$(dir_top)" \ + scriptdir="$(scriptdir)" \ FUNCTIONS_SUBDIRS="$(FUNCTIONS_SUBDIRS)" \ INSTALL_DATA="$(INSTALL_DATA)" \ DESTDIR="$(DESTDIR)" VERSION="$(VERSION)" \ @@ -94,6 +95,7 @@ uninstall.fns: if test x$(fndir) != x && test x$(fndir) != xno; then \ fndir="$(fndir)" dir_top="$(dir_top)" \ + scriptdir="$(scriptdir)" \ FUNCTIONS_SUBDIRS="$(FUNCTIONS_SUBDIRS)" \ DESTDIR="$(DESTDIR)" VERSION="$(VERSION)" \ $(SHELL) $(sdir_top)/Config/uninstallfns.sh || exit 1; \ Index: Config/installfns.sh =================================================================== RCS file: /cvsroot/zsh/zsh/Config/installfns.sh,v retrieving revision 1.10 diff -u -r1.10 installfns.sh --- Config/installfns.sh 13 Feb 2003 16:34:36 -0000 1.10 +++ Config/installfns.sh 20 Jul 2005 17:59:57 -0000 @@ -1,6 +1,7 @@ #!/bin/sh fndir=$DESTDIR$fndir +scriptdir=$DESTDIR$scriptdir /bin/sh $sdir_top/mkinstalldirs $fndir || exit 1; @@ -25,13 +26,23 @@ Completion/*) instdir="$fndir/Completion" ;; + Scripts/*) + instdir="$scriptdir" + ;; *) subdir="`echo $file | sed -e 's%/[^/]*$%%' -e 's%^Functions/%%'`" instdir="$fndir/$subdir" ;; esac else - instdir="$fndir" + case "$file" in + Scripts/*) + instdir="$scriptdir" + ;; + *) + instdir="$fndir" + ;; + esac fi test -d $instdir || /bin/sh $sdir_top/mkinstalldirs $instdir || exit 1 $INSTALL_DATA $sdir_top/$file $instdir || exit 1 Index: Config/uninstallfns.sh =================================================================== RCS file: /cvsroot/zsh/zsh/Config/uninstallfns.sh,v retrieving revision 1.3 diff -u -r1.3 uninstallfns.sh --- Config/uninstallfns.sh 4 Dec 2000 19:21:07 -0000 1.3 +++ Config/uninstallfns.sh 20 Jul 2005 17:59:57 -0000 @@ -1,6 +1,7 @@ #!/bin/sh fndir=$DESTDIR$fndir +scriptdir=$DESTDIR$scriptdir allfuncs="`grep ' functions=' ${dir_top}/config.modules | sed -e '/^#/d' -e '/ link=no/d' -e 's/^.* functions=//'`" @@ -10,10 +11,6 @@ case $fndir in *$VERSION*) # Version specific function directory, safe to remove completely. - # However, we don't remove the top-level version directory since - # it could have other things than functions in it. We could - # do that instead in the top-level Makefile on a full uninstall, - # if we wanted. rm -rf $fndir ;; *) # The following will only apply with a custom install directory @@ -22,15 +19,39 @@ # We now have a list of files, but we need to use `test -f' to check # (1) the glob got expanded (2) we are not looking at directories. for file in $allfuncs; do - if test -f $sdir_top/$file; then - if test x$FUNCTIONS_SUBDIRS != x -a x$FUNCTIONS_SUBDIRS != xno; then - file=`echo $file | sed -e 's%%^Functions/%'` - rm -f $fndir/$file; - else - bfile="`echo $file | sed -e 's%^.*/%%'`" - rm -f "$fndir/$bfile"; \ - fi - fi + case $file in + Scripts/*) + ;; + *) + if test -f $sdir_top/$file; then + if test x$FUNCTIONS_SUBDIRS != x -a x$FUNCTIONS_SUBDIRS != xno; then + file=`echo $file | sed -e 's%%^(Functions|Completion)/%'` + rm -f $fndir/$file + else + bfile="`echo $file | sed -e 's%^.*/%%'`" + rm -f "$fndir/$bfile" + fi + fi + ;; + esac + done + ;; +esac + +case $scriptdir in + *$VERSION*) + # $scriptdir might be the parent of fndir. + rm -rf $scriptdir + ;; + *) for file in $allfuncs; do + case $file in + Scripts/*) + if test -f $sdir_top/$file; then + bfile="`echo $file | sed -e 's%^.*/%%'`" + rm -f "$scriptdir/$bfile" + fi + ;; + esac done ;; esac Index: Functions/Newuser/zsh-install-newuser =================================================================== RCS file: Functions/Newuser/zsh-install-newuser diff -N Functions/Newuser/zsh-install-newuser --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Functions/Newuser/zsh-install-newuser 20 Jul 2005 17:59:57 -0000 @@ -0,0 +1,11 @@ +# Function to install startup files for a new user. +# This dummy version simply creates a new .zshrc with a comment. +# FIXME: we don't want to distribute a file that does that, it +# would be preferable to do nothing at all. + +# Sanitize environment. +emulate -L zsh + +echo "# Created by newuser for $ZSH_VERSION" >${ZDOTDIR:-$HOME}/.zshrc + +unfunction zsh-install-newuser Index: Scripts/newuser =================================================================== RCS file: Scripts/newuser diff -N Scripts/newuser --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Scripts/newuser 20 Jul 2005 17:59:57 -0000 @@ -0,0 +1,6 @@ +# zsh script sourced at startup when a user is found to have +# no startup files. See the documentation for the zsh/newuser +# module in zshmodules(1). + +autoload -U zsh-install-newuser +zsh-install-newuser Index: Src/Modules/newuser.mdd =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Modules/newuser.mdd,v retrieving revision 1.1 diff -u -r1.1 newuser.mdd --- Src/Modules/newuser.mdd 20 Jul 2005 16:08:23 -0000 1.1 +++ Src/Modules/newuser.mdd 20 Jul 2005 17:59:57 -0000 @@ -1,8 +1,9 @@ name=zsh/newuser link=dynamic -# We will always try to load newuser, but there is -# no error if it fails. +# We will always try to load newuser, but there should +# be no error if it fails, so don't use the standard mechanism. load=no +functions='Scripts/newuser Functions/Newuser/*' objects="newuser.o" -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. **********************************************************************