Attached is a patch that adds the rebase functionality to setup.exe.
I would like to get some feedback before I start to resolve the following
issues:

    o How to handle a missing config file (i.e., /etc/setup/rebase.conf)?
    o Need to handle in-use files.
    o How to handle corruptible (by rebasing) files?
    o How should dependent DLLs be handled?

and some other more niggling items.

I re-installed 30 out of the 33 packages that contain DLLs and my system
is functioning normally.  Python can even fork too!  I only skipped curl,
postgresql, and rxvt because the DLLs contained by these packages get
corrupted by rebasing.

If you would like to test out a setup.exe which includes the rebase
functionality, then a pre-built version is available at:

    http://www.tishler.net/jason/software/setup-rebase/setup-rebase-2002-02-02-1.exe

Before you run this setup.exe, you should download the default rebase
configuration file:

    http://www.tishler.net/jason/software/setup-rebase/rebase.conf

to /etc/setup.

I also have a stand-alone rebase.exe that I would like to contribute to
Cygwin so that users can rebase without having to run setup.exe.

Here is the current usage statement from rebase.exe:

    usage: rebase [-i|-r|-u] [-d CygwinRootDir] ImageFileName ...
    where:
        -i => install ImageFileName(s)
        -r => re-install ImageFileName(s) (default)
        -u => uninstall ImageFileName(s)
        -d => set Cygwin root directory (defaults to ".")

A pre-built version of rebase.exe is available at:

    http://www.tishler.net/jason/software/setup-rebase/rebase.exe

I see the following uses for this program:

    o makefiles
    o resync system (hopefully never needed)
    o used by a one-shot converter script

The following is an example of a postinstall script, rebase.bat, that
could rebase the entire user's system without have to reinstall
"everything":

    gzip -d -c /etc/setup/*.lst.gz | grep "\.dll$" | sed "s=^=/=" | xargs -n 1 cygpath 
-wa >rebase.tmp
    rebase -r -f rebase.tmp
    del rebase.tmp

The above assumes that I have added a "-f" option to rebase.exe and
changed the default value for the "-d" option to be the Cygwin root
directory obtained from the Registry.

Any feedback on the above would be greatly appreciated.

Thanks,
Jason
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/Makefile.in,v
retrieving revision 2.49
diff -u -p -r2.49 Makefile.in
--- Makefile.in 2002/01/27 06:36:06     2.49
+++ Makefile.in 2002/02/07 11:58:26
@@ -69,11 +69,12 @@ libmingw32.a        := $(mingw_build)/libmingw3
 libuser32      := $(w32api_lib)/libuser32.a
 libkernel32    := $(w32api_lib)/libkernel32.a
 libcomctl32    := $(w32api_lib)/libcomctl32.a
+libimagehlp    := $(w32api_lib)/libimagehlp.a
 
 ALL_DEP_LDLIBS := $(ZLIB) $(BZ2LIB) $(w32api_lib)/libole32.a 
$(w32api_lib)/libwsock32.a \
                $(w32api_lib)/libnetapi32.a $(w32api_lib)/libadvapi32.a \
                $(w32api_lib)/libuuid.a $(libkernel32) $(libuser32) \
-               $(libcomctl32) $(libmingw32)
+               $(libcomctl32) $(libimagehlp) $(libmingw32)
 
 ALL_LDLIBS     := ${patsubst $(mingw_build)/lib%.a,-l%,\
              ${patsubst $(w32api_lib)/lib%.a,-l%,\
@@ -99,13 +100,17 @@ OBJS = \
        compress_bz.o \
        compress_gz.o \
        concat.o \
+       config_file.o \
+       config_file_reader.o \
+       config_file_writer.o \
        cygpackage.o \
        desktop.o \
        dialog.o \
        diskfull.o \
        download.o \
-       find.o \
        filemanip.o \
+       find.o \
+       free_list.o \
        fromcwd.o \
        geturl.o \
        hash.o \
@@ -120,6 +125,7 @@ OBJS = \
        localdir.o \
        log.o \
        main.o \
+       main.o \
        mingw_getopt.o \
        mkdir.o \
        mklink2.o \
@@ -127,10 +133,10 @@ OBJS = \
        msg.o \
        net.o \
        netio.o \
-       nio-ie5.o \
        nio-file.o \
        nio-ftp.o \
        nio-http.o \
+       nio-ie5.o \
        package_db.o \
        package_meta.o \
        package_source.o \
@@ -142,6 +148,7 @@ OBJS = \
        postinstall.o \
        proppage.o \
        propsheet.o \
+       rebaser.o \
        res.o \
        rfc1738.o \
        root.o \
@@ -153,6 +160,7 @@ OBJS = \
        splash.o \
        state.o \
        threebar.o \
+       used_list.o \
        version.o \
        win32.o \
        window.o \
Index: install.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/install.cc,v
retrieving revision 2.39
diff -u -p -r2.39 install.cc
--- install.cc  2002/01/27 06:36:06     2.39
+++ install.cc  2002/02/07 11:58:32
@@ -62,6 +62,7 @@ static const char *cvsid = "\n%%% $Id: i
 #include "package_source.h"
 
 #include "port.h"
+#include "rebaser.h"
 
 #include "threebar.h"
 extern ThreeBarProgressPage Progress;
@@ -291,6 +292,8 @@ install_one_source (packagemeta & pkgm, 
                    }
                }
            }
+         else
+           rebaser::get_instance ()->rerebase (cygpath (prefixPath, fn, 0));
 
          progress (tmp->tell ());
          num_installs++;
Index: log.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/log.cc,v
retrieving revision 2.7
diff -u -p -r2.7 log.cc
--- log.cc      2002/01/22 12:30:50     2.7
+++ log.cc      2002/02/07 11:58:32
@@ -34,6 +34,7 @@ static const char *cvsid =
 #include "concat.h"
 #include "mkdir.h"
 #include "mount.h"
+#include "rebaser.h"
 
 struct LogEnt
 {
@@ -116,6 +117,8 @@ exit_setup (int exit_code)
 
   if (exit_msg)
     note (NULL, exit_msg);
+
+  rebaser::delete_instance ();
 
   log (LOG_TIMESTAMP, "Ending cygwin install");
 
Index: package_meta.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/package_meta.cc,v
retrieving revision 2.15
diff -u -p -r2.15 package_meta.cc
--- package_meta.cc     2002/01/22 09:03:55     2.15
+++ package_meta.cc     2002/02/07 11:58:32
@@ -42,6 +42,7 @@ static const char *cvsid = "\n%%% $Id: p
 #include "cygpackage.h"
 #include "package_meta.h"
 #include "package_db.h"
+#include "rebaser.h"
 
 static const char *standard_dirs[] = {
   "/bin",
@@ -167,6 +168,7 @@ packagemeta::uninstall ()
              log (LOG_BABBLE, "unlink %s", d);
              SetFileAttributes (d, dw & ~FILE_ATTRIBUTE_READONLY);
              DeleteFile (d);
+             rebaser::get_instance ()->unrebase (d);
            }
          /* Check for Windows shortcut of same name. */
          d = concat (d, ".lnk", NULL);
Index: root.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/root.cc,v
retrieving revision 2.8
diff -u -p -r2.8 root.cc
--- root.cc     2001/12/23 12:13:29     2.8
+++ root.cc     2002/02/07 11:58:32
@@ -36,6 +36,7 @@ static const char *cvsid =
 #include "concat.h"
 #include "log.h"
 #include "root.h"
+#include "rebaser.h"
 
 static int rb[] = { IDC_ROOT_TEXT, IDC_ROOT_BINARY, 0 };
 static int su[] = { IDC_ROOT_SYSTEM, IDC_ROOT_USER, 0 };
@@ -180,6 +181,8 @@ RootPage::OnNext ()
     return -1;
 
   NEXT (IDD_LOCAL_DIR);
+
+  rebaser::set_cygwin_root_dir (get_root_dir ());
 
   log (0, "root: %s %s %s", get_root_dir (),
        (root_text == IDC_ROOT_TEXT) ? "text" : "binary",
2002-02-07  Jason Tishler  <[EMAIL PROTECTED]>

        * Makefile.in (libimagehlp): New variable.
        (ALL_DEP_LDLIBS): Add libimagehlp.
        (OBJ): Add rebase objects.  Resort objects.
        * install.cc (install_one_source): Add call to rebaser::rerebase.
        * log.cc (exit_setup): Add call to rebaser::delete_instance.
        * package_meta.cc (packagemeta::uninstall): Add call to
        rebaser::unrebase.
        * root.cc (RootPage::OnNext): Add call to rebaser::set_cygwin_root_dir.
        * config_file.cc: New file.
        * config_file.h: New file.
        * config_file_reader.cc: New file.
        * config_file_reader.h: New file.
        * config_file_writer.cc: New file.
        * config_file_writer.h: New file.
        * free_list.cc: New file.
        * free_list.h: New file.
        * rebaser.cc: New file.
        * rebaser.h: New file.
        * used_list.cc: New file.
        * used_list.h: New file.

Attachment: rebase.tar.bz2
Description: Binary data

Reply via email to