delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/10/15/18:56:51

Message-ID: <3264402B.24E2@cs.com>
Date: Tue, 15 Oct 1996 18:53:47 -0700
From: "John M. Aldrich" <fighteer AT cs DOT com>
Reply-To: fighteer AT cs DOT com
Organization: Three pounds of chaos and a pinch of salt
MIME-Version: 1.0
To: grendel AT ananke DOT amu DOT edu DOT pl
CC: DJ Delorie <dj AT delorie DOT com>, eliz AT is DOT elta DOT co DOT il, djgpp-workers AT delorie DOT com
Subject: Re: Install thingy
References: <Pine DOT NEB DOT 3 DOT 95 DOT 961015131522 DOT 10709C-100000 AT ananke DOT amu DOT edu DOT pl>

Mark Habersack wrote:
> 
> You mean that I'd run install only when the batch file reports everything's
> ok, or there are just minor problems which can be corrected on-the-fly? I'd
> just have to put exit code on command line, then.

Ok, here's a basic explanation of the way my modified stub code works. 
:)

- The standard stub, upon encountering an error, prints a message and
returns an exit code of 255.

- My custom stub, upon encountering an error, prints a message and
returns a unique exit code from 100 to 110 corresponding to the error
that occurred.

- My batch file, djverify.bat, simply reads the program's exit code and,
if it is in the magic range (100-110), prints an appropriate explanatory
message, complete with recommended solutions to the problem.

This seems to me to be all that's needed to make any program fully
capable of self-diagnosis.  You can do one of two things in your
installer:

1) Write the installer as a real mode program and have it invoke the
djverify executable _directly_, interpreting the return code itself.  As
an alternative, bind a real-mode executable to the complete djgpp
program.

2) Write the installer as a djgpp program and bind it with the _custom_
stub, then use a batch file similar to mine to interpret any resulting
error.

NOTE:  If you follow the latter route, you should be aware of a
potential pitfall in the way djgpp handles the SIGINT signal.  If you
don't handle SIGINT (Ctrl-C) yourself, your program will return an error
code of 255 when it exits, which will make the batch file barf thinking
it is dealing with a standard stub.  The solution (which I followed in
djverify) is to install a handler for SIGINT which returns a benign
error code such as 1.  I discovered this minor problem while debugging a
poorly written use of cgets() in my program.  :)  I don't yet know about
Ctrl-Break handling.

> This way is certainly very comfortable but we'd end up with two almost
> identical batch files only one of them named install and the other djverify.
> BTW. How will the two programs (install & djverify) be distributed? They
> cannot be zipped cause they have to be availabe out-of-the-box. Maybe we
> should use a SFX archive?

Having two batch files is the only real way I can see around the
problem, assuming we use djgpp to write both programs.  :)  However,
since their functionality is identical, we could simply have one batch
file call the other, i.e.:

--install.bat--
@echo off
call djverify.bat -F djinst.exe
---end---

As for archiving methods, the only one I'm really familiar with is
pkzip, but you can use pkzip to create a self-extracting archive.  You
can also bind a comment to the archive that is automatically displayed
when the archive itself is extracted.  It could contain a basic blurb
plus instructions to run "install".  I'm sure something similar is
possible with the various freeware archivers, but it's best if we make
the distribution in a familiar format.

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I |        fighteer AT cs DOT com          |
| Proud owner of what might one   |   http://www.cs.com/fighteer    |
| day be a spectacular MUD...     | Plan: To make Bill Gates suffer |
---------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019