tags 384697 + patch
thanks

Hello Faré!

On Sat, 26 Aug 2006 06:08:39 +0200, Faré wrote:
> I'm not sure we either need or want a /etc/cl-launchrc or a
> ~/.cl-launchrc.

I still think that's the way to go, but obviously we need more
feedbacks from the other CL-Debian developers/users (especially Peter
and René).  Xavier, this is the reason I explicitly cc:ed you again, I
hope you don't mind :-)

The attached patch is a very simple support for ~/.cl-launchrc, based
on the CL-Launch available in Debian, thus 1.85-1.  To apply it:

  $ [save the patch somewhere]
  $ cp /usr/share/common-lisp/source/cl-launch/wrapper.sh ~/
  $ patch wrapper.sh < /path/to/the/patch
  $ [modify your CL-Launch script to call include ~/wrapper.sh instead
    of the /usr/share/common-lisp/source/cl-launch/wrapper.sh]

~/.cl-launchrc is a shell file, with the following structure:

  [value of $SOFTWARE_SYSTEM in the CL-Launch script] = \
    [Common Lisp implementation to be used]

I assume that the value of $SOFTWARE_SYSTEM will always be the name of
the script, i.e. /usr/bin/$SOFTWARE_SYSTEM.  Thus, for StumpWM would
be something like the following:

  stumpwm=sbcl

ATM the patch is quite dirty, because it uses grep and the BASH
parameter substitution to assign the value, while the same function
should be very simple as:

  check_lisp_variable () {
    test -r /etc/cl-launchrc && . /etc/cl-launchrc
    test -r "$HOME/.cl-launchrc" && . "$HOME/.cl-launchrc"
    test -n ${SOFTWARE_SYSTEM} && LISP=${SOFTWARE_SYSTEM}
  }

The last line is obviously fault, what I'd like to do is:

  if the variable called with the name of the value of
  $SOFTWARE_SYSTEM is not-empty set the LISP variable to that value

Unfortunately, I don't know how to do it in shell language, I quickly
and unsuccessfully read `man bash`, so I post here in case someone
with more shell skills would help.

> After all, the user (or root) may already export the variable $LISP
> to override things at runtime (or at dump time), whatever the --lisp
> or $LISPS variable be, unless explicitly prevented with a --wrap
> argument (or a resetting of $LISP), and I think that's all we need.

If we ship a CL-Launch script I'd like to avoid special forms like:

  $ LISP=sbcl /usr/bin/stumpwm
  $ /usr/bin/stumpwm --lisp sbcl

> As for stumpwm, note that I prefer the more versatile --init
> argument:
>   '(stumpwm:stumpwm (cl-launch:getenv "DISPLAY"))'
> to a hardcoded :0.

OK, I noticed it and I completely agree, as this is The Right Thing™,
because we can't assume $DISPLAY always :0.0.

> If multiple dumped versions are wanted, they should each have a
> different name, and the main script would select amongst them.

Well, for sure I'm not going to support multiple versions (would be
them dumped images or not).  IMHO, if a Debian package ships a
CL-Launch script at /usr/bin/$SOFTWARE_SYSTEM, this should be the more
generic possible, i.e. $LISPS should contains all the Common Lisp
implementation that the _Debian package_ support.

Thx, bye,
Gismo / Luca

--- /usr/share/common-lisp/source/cl-launch/wrapper.sh	2006-08-11 08:21:06.000000000 +0200
+++ wrapper.sh	2006-08-26 15:46:24.000000000 +0200
@@ -203,7 +203,14 @@
   LAUNCH_FORM="(progn${MAYBE_PACKAGE_FORM}${HASH_BANG_FORM}${LAUNCH_FORMS})"
   exec $LISP_BIN $IMAGE_OPT $IMAGE $OPTIONS $EVAL "$LAUNCH_FORM" $ENDARGS "$@"
 }
+check_lisp_variable () {
+  LISP_USER="`grep $SOFTWARE_SYSTEM $HOME/.cl-launchrc 2>/dev/null`"
+  if [ -n "$LISP_USER" ]; then
+      LISP=${LISP_USER##*=}
+  fi
+}
 launch_self () {
+  check_lisp_variable
   LAUNCH_FORMS="$(load_form "$PROG")"
   try_all_lisps "$@"
 }

Attachment: pgpkGpcF7Sd7p.pgp
Description: PGP signature

Reply via email to