Mail Archives: cygwin-developers/2000/05/22/23:55:35
Here's a preview of something I've been toying with. My goal is to
get rid of all the .exe's setup carries around; they take up space,
slow down the install, and are cumbersome to work with. We'd also
need hooks into these processes if/when we add a GUI.
This first step removes tar and gzip, replacing them with zlib and a
built-in tar. This built-in tar also allows setup to more closely
control where files are going; it can ignore conflicting mounts the
user has set up in favor of what it knows is right, for example. It
could even do the install without changing the existing mounts at all.
It also ignores a lot of the unneeded info in the tar file, for
example being able to override read-only-ness in a file it needs to
update (well, not *yet*).
Oh - another bonus. We don't need to distribute the sources to tar
and gzip with setup.exe any more (GPL'd, you know ;)
My next goal is to remove mount/umount/cygpath, in favor of
LoadLibrary(cygwin1.dll) (or some setup-specific name) and call the
cygwin functions directly.
There are still some debug hacks in the attached patches (I'm still
working on it) but they should be easy to spot. New files attached at
the end.
? ctar.c
? tar.c
? tar.h
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/Makefile.in,v
retrieving revision 1.14
diff -p -2 -r1.14 Makefile.in
*** Makefile.in 2000/04/29 04:28:59 1.14
--- Makefile.in 2000/05/23 03:44:44
*************** ALL_LDFLAGS:=${filter-out -I%, \
*** 68,74 ****
PROGS:=setup$(EXEEXT)
! OBJS:=error.o memory.o setup.o strarry.o cinstall.o path.o pkg.o xsystem.o
! BUNDLED_FILES:=cygwin1.dll.gz $(srcdir)/tar.exe.gz $(srcdir)/gzip.exe.gz \
mount.exe.gz cygpath.exe.gz umount.exe.gz
.SUFFIXES:
--- 68,74 ----
PROGS:=setup$(EXEEXT)
! OBJS:=error.o memory.o setup.o strarry.o cinstall.o path.o pkg.o tar.o xsystem.o
! BUNDLED_FILES:=cygwin1.dll.gz \
mount.exe.gz cygpath.exe.gz umount.exe.gz
.SUFFIXES:
*************** endif
*** 89,92 ****
--- 89,95 ----
@chmod a-x $@
+ ctar.exe : ctar.o tar.o $(ALL_DEP_LDLIBS)
+ $(CC) -o $@ ctar.o tar.o $(ALL_LDFLAGS) $(ALL_LDLIBS)
+
mingw_getopt.o: $(cygwin_source)/getopt.c
$(CC) -c -o $@ $(MINGW_CFLAGS) $^
*************** $(ZLIB): zlib/Makefile
*** 116,120 ****
%.exe: $(utils_build)/%.exe
$(OBJCOPY) --strip-unneeded $? $@
!
$(utils_build)/%.exe: $(utils_build)/Makefile
@$(MAKE) -C $(utils_build) $(@F)
--- 119,123 ----
%.exe: $(utils_build)/%.exe
$(OBJCOPY) --strip-unneeded $? $@
!
$(utils_build)/%.exe: $(utils_build)/Makefile
@$(MAKE) -C $(utils_build) $(@F)
*************** cinstall.rc: $(BUNDLED_FILES)
*** 136,140 ****
%.o: %.rc
$(WINDRES) -o $@ $?
!
%.o: %.c
ifdef VERBOSE
--- 139,143 ----
%.o: %.rc
$(WINDRES) -o $@ $?
!
%.o: %.c
ifdef VERBOSE
Index: path.c
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/path.c,v
retrieving revision 1.6
diff -p -2 -r1.6 path.c
*** path.c 2000/05/02 02:12:35 1.6
--- path.c 2000/05/23 03:44:44
*************** pathcat (const char *arg1, const char *a
*** 135,153 ****
char path[_MAX_PATH];
size_t len;
- assert (!strchr (arg1, '/'));
strcpy (path, arg1);
-
- /* Remove any trailing slash */
- len = strlen (path);
- if (path[--len] == '\\')
- path[len] = '\0';
-
strcat (path, "\\");
-
- if (*arg2 == '\\')
- ++arg2;
-
strcat (path, arg2);
return xstrdup (path);
--- 135,155 ----
char path[_MAX_PATH];
size_t len;
+ char *s, *d;
strcpy (path, arg1);
strcat (path, "\\");
strcat (path, arg2);
+
+ for (s=path; *s; s++)
+ if (*s == '/')
+ *s = '\\';
+ for (s=d=path; *s; s++)
+ {
+ *d++ = *s;
+ if (*s == '\\')
+ while (s[1] == '\\')
+ s++;
+ }
+ *d = 0;
return xstrdup (path);
Index: setup.c
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/setup.c,v
retrieving revision 1.45
diff -p -2 -r1.45 setup.c
*** setup.c 2000/05/20 03:53:33 1.45
--- setup.c 2000/05/23 03:44:48
*************** char *wd = NULL;
*** 57,60 ****
--- 57,62 ----
static char *tarpgm;
+ static char *tar_map[8];
+
static int downloaddir (SA *installme, const char *url);
*************** xumount (const char *mountexedir, const
*** 258,261 ****
--- 260,266 ----
}
+ extern FILE * _tar_vfile;
+ extern int _tar_verbose;
+
static int
tarx (const char *dir, const char *fn)
*************** tarx (const char *dir, const char *fn)
*** 283,355 ****
}
- dpath = pathcat (dir, fn);
- path = dtoupath (dpath);
- sprintf (buffer, "%s xvfUz \"%s\"", tarpgm, path);
- xfree (path);
- xfree (dpath);
-
printf ("Installing %s\n", fn);
-
- if (_pipe (hpipe, 256, O_TEXT) == -1)
- return 0;
-
- hin = (HANDLE) _get_osfhandle (hpipe[1]);
- hproc = (HANDLE) xcreate_process (0, NULL, hin, hin, buffer);
- if (!hproc)
- {
- warning ("Unable to extract \"%s\": %s", fn, _strerror (""));
- return 0;
- }
! CloseHandle (hproc);
! _close (hpipe[1]);
! fp = fdopen (hpipe[0], "rt");
!
! filehere = files.index;
! while (fgets (buffer, sizeof (buffer0), fp))
! {
! char *s = strchr (buffer, '\n');
!
! if (s)
! *s = '\0';
!
! if (strchr (buffer, ':') != NULL)
! {
! s = buffer;
! fprintf (stderr, "%s\n", s);
! }
! else
! {
! if (++files.index >= files.count)
! files.array = realloc (files.array,
! NFILE_SLOP + (files.count += NFILE_LIST));
! s = buffer;
! if (*s != '/')
! *--s = '/';
! #if 0 /* too simplistic */
! e = strchr (s, '\0') - 1;
! if (e > s && *e == '/')
! {
! *e = '\0';
! xumount (wd, s);
! }
! #endif
!
! s = files.array[files.index] = utodpath (s);
! }
!
! fprintf (logfp, "%s\n", s);
! }
! fclose (fp);
!
! while (++filehere <= files.index)
! if (chmod (files.array[filehere], 0777))
! warning ("Unable to reset protection on '%s' - %s\n",
! files.array[filehere], _strerror (""));
!
! warning ("%s package '%s'\n", write_pkg (pkg, pkgname, pkgversion) ?
! "Updated" : "Refreshed", pkgname);
!
! return 1;
}
--- 288,297 ----
}
printf ("Installing %s\n", fn);
! dpath = pathcat (dir, fn);
! _tar_vfile = logfp;
! _tar_verbose = 2;
! return !tar_auto (dpath, tar_map);
}
*************** get_pkg_stuff (int updating)
*** 1421,1424 ****
--- 1363,1380 ----
}
+ static void
+ do_tar_map (int i, char *from, char *root, char *to)
+ {
+ char *t;
+ tar_map[i] = from;
+ i++;
+ tar_map[i] = (char *) xmalloc (strlen(root) + strlen(to) + 3);
+ t = tar_map[i];
+ strcpy (t, root);
+ if (t[strlen(t)-1] == '/' && to[0] == '/')
+ to ++;
+ strcat (t, to);
+ }
+
static char rev[] = "$Revision: 1.44 $ ";
*************** those as the basis for your installation
*** 1556,1559 ****
--- 1512,1519 ----
}
xfree (defroot);
+ /* convert to windows format */
+ for (defroot=root; *defroot; defroot++)
+ if (*defroot == '/')
+ *defroot == '\\';
Sleep (0);
*************** those as the basis for your installation
*** 1606,1609 ****
--- 1566,1570 ----
_chdrive (toupper (*root) - 'A' + 1);
+ #if 0
xumount (wd, "/usr");
xumount (wd, "/var");
*************** those as the basis for your installation
*** 1615,1618 ****
--- 1576,1586 ----
mkmount (wd, "bin", "/usr/bin", 1);
mkmount (wd, "lib", "/usr/lib", 1);
+ #endif
+
+ do_tar_map (0, "usr/bin/", root, "/bin/");
+ do_tar_map (2, "usr/lib/", root, "/lib/");
+ do_tar_map (4, "", root, "/");
+ tar_map[6] = tar_map[7] = 0;
+
mkdirp ("var\\run");
begin 744 new.tar.gz
M'XL(",S^*3D"`VYE=RYT87(`[1MK4]M(,E]-%?]APA:)C0U8YI%=#-QQX"3<
M.I`"<GM;0'EE2;8%MN229!SR^._7W3.CF9%DPV[=[57=6;6UL69Z9KI[^JW&
M2>QHPWGQ'WVL>GUW>YN]8(R]V:5_8<2B=WRL[?HNS%A68VMKV]IY@]-;V_47
MK/[B3W AT F,7"`L1?NW7PXY[$?3.(7_VO/#W[@#">NQ_;CQ/7#C<'A\E(ZMH+"
M,5A97EI>\CXG7A0P/TA8!T8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