This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: experimental texmf packages


Jan Nieuwenhuizen <janneke@gnu.org> writes:

> > BTW: can you freshed up your postremove patch? I'd like that to be
> > included in setup.
> 
> Yes, will do.


cygwin-installer-20011208.ChangeLog
2001-12-08  Jan Nieuwenhuizen  <janneke@gnu.org>

	* Makefile.in (CFLAGS): Remove -Werror to allow build.
	(realclean): more clean.

	* configure.in (LIB_AC_PROG_CXX): Bugfix for CXXFLAGS override.

	* desktop.cc (etc_profile): Remove line breaks and spaces from PS1.

	* Forward port cygwin-20010707.jcn3.patch.
	
	* postinstall.cc (do_postinstall): Split off:
	(init_run_script): New function.
	(run_script_in_etc_postinstall): New function.

	* package_meta.cc (try_run_script): New function.
	(uninstall): Run pre- and postremove scripts.

	* install.cc (do_install): Run script initialisation.


cygwin-installer-20011208.patch
diff -purN --exclude=*~ --exclude=configure --exclude=setup_version.c --exclude=inilex.l --exclude=zlib --exclude=ChangeLog ../cinstall.orig/Makefile.in ./Makefile.in
--- ../cinstall.orig/Makefile.in	Mon Dec  3 23:22:08 2001
+++ ./Makefile.in	Sat Dec  8 15:01:16 2001
@@ -35,7 +35,7 @@ CC		:= @CC@
 CC_FOR_TARGET	:= $(CC)
 CXX		:= @CXX@
 
-CFLAGS		:= @CFLAGS@ -Werror -Winline -Wall -Wpointer-arith -Wcast-align\
+CFLAGS		:= @CFLAGS@ -Winline -Wall -Wpointer-arith -Wcast-align\
 	-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
 	-Wmissing-declarations -Wcomments
 CXXFLAGS	:= @CXXFLAGS@ $(CFLAGS) -fno-rtti
@@ -169,7 +169,8 @@ clean:
 	$(MAKE) -C zlib clean
 
 realclean: clean
-	rm -f  Makefile config.cache
+	rm -f Makefile *.d
+	rm -f config.cache config.log config.status 
 
 install: all
 	$(SHELL) $(updir1)/mkinstalldirs $(bindir) $(etcdir)
diff -purN --exclude=*~ --exclude=configure --exclude=setup_version.c --exclude=inilex.l --exclude=zlib --exclude=ChangeLog ../cinstall.orig/configure.in ./configure.in
--- ../cinstall.orig/configure.in	Mon Dec 11 01:07:56 2000
+++ ./configure.in	Sat Dec  8 14:19:19 2001
@@ -64,7 +64,7 @@ if test -z "$CXX"; then
   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
 fi
 
-CXXFLAGS='$(CFLAGS)'
+CXXFLAGS="$CFLAGS"
 ])
 
 AC_CANONICAL_SYSTEM
diff -purN --exclude=*~ --exclude=configure --exclude=setup_version.c --exclude=inilex.l --exclude=zlib --exclude=ChangeLog ../cinstall.orig/desktop.cc ./desktop.cc
--- ../cinstall.orig/desktop.cc	Thu Nov 29 10:52:32 2001
+++ ./desktop.cc	Sat Dec  8 14:10:56 2001
@@ -81,9 +81,7 @@ static const char *etc_profile[] = {
   "done",
   "",
   "export MAKE_MODE=unix",
-  "export PS1='\\[\\033]0;\\w\\007",
-  "\\033[32m\\]\\u@\\h \\[\\033[33m\\w\\033[0m\\]",
-  "$ '",
+  "export PS1='\\[\\033]0;\\w\\007\\033[32m\\]\\u@\\h \\[\\033[33m\\w\\033[0m\\]$ '",
   "",
   "cd \"$HOME\"",
   "",
diff -purN --exclude=*~ --exclude=configure --exclude=setup_version.c --exclude=inilex.l --exclude=zlib --exclude=ChangeLog ../cinstall.orig/install.cc ./install.cc
--- ../cinstall.orig/install.cc	Thu Nov 29 10:52:33 2001
+++ ./install.cc	Sat Dec  8 14:29:13 2001
@@ -53,6 +53,7 @@ static const char *cvsid =
 #include "compress_gz.h"
 #include "archive.h"
 #include "archive_tar.h"
+#include "postinstall.h"
 
 #include "package_db.h"
 #include "package_meta.h"
@@ -418,6 +419,9 @@ do_install (HINSTANCE h)
   create_mount ("/usr/bin", cygpath ("/bin", 0), istext, issystem);
   create_mount ("/usr/lib", cygpath ("/lib", 0), istext, issystem);
   set_cygdrive_flags (istext, issystem);
+
+  /* Let's hope people won't uninstall packages before installing [b]ash */
+  init_run_script ();
 
   packagedb db;
   for (packagemeta * pkg = db.getfirstpackage (); pkg;
diff -purN --exclude=*~ --exclude=configure --exclude=setup_version.c --exclude=inilex.l --exclude=zlib --exclude=ChangeLog ../cinstall.orig/package_meta.cc ./package_meta.cc
--- ../cinstall.orig/package_meta.cc	Sun Dec  2 04:25:11 2001
+++ ./package_meta.cc	Sat Dec  8 14:50:12 2001
@@ -37,6 +37,7 @@ static const char *cvsid =
 
 
 #include "category.h"
+#include "postinstall.h"
 
 #include "package_version.h"
 #include "cygpackage.h"
@@ -61,6 +62,15 @@ static const char *standard_dirs[] = {
   0
 };
 
+static void
+try_run_script (char const *dir, char const *fname)
+{
+  if (_access (cygpath (dir, fname, ".sh", 0), 0) == 0)
+    run_script (dir, concat (fname, ".sh", 0));
+  if (_access (cygpath (dir, fname, ".bat", 0), 0) == 0)
+    run_script (dir, concat (fname, ".bat", 0));
+}
+
 void
 hash::add_subdirs (char const *tpath)
 {
@@ -112,6 +122,8 @@ packagemeta::uninstall ()
        */
       hash dirs;
       const char *line = installed->getfirstfile ();
+
+      try_run_script ("/etc/preremove/", name);
       while (line)
 	{
 	  dirs.add_subdirs (line);
@@ -135,6 +147,7 @@ packagemeta::uninstall ()
 	  if (RemoveDirectory (d))
 	    log (LOG_BABBLE, "rmdir %s", d);
 	}
+      try_run_script ("/etc/postremove/", name);
     }
   installed = 0;
 }
diff -purN --exclude=*~ --exclude=configure --exclude=setup_version.c --exclude=inilex.l --exclude=zlib --exclude=ChangeLog ../cinstall.orig/postinstall.cc ./postinstall.cc
--- ../cinstall.orig/postinstall.cc	Tue Nov 13 02:49:32 2001
+++ ./postinstall.cc	Sat Dec  8 14:38:33 2001
@@ -31,6 +31,7 @@ static const char *cvsid =
 #include "find.h"
 #include "concat.h"
 #include "mount.h"
+#include "log.h"
 
 #include "port.h"
 
@@ -60,8 +61,8 @@ run (const char *sh, const char *args, c
     WaitForSingleObject (pi.hProcess, INFINITE);
 }
 
-static void
-each (char *fname, unsigned int size)
+void
+run_script (char const *dir, char const *fname)
 {
   char *ext = strrchr (fname, '.');
   if (!ext)
@@ -69,13 +70,15 @@ each (char *fname, unsigned int size)
 
   if (sh && strcmp (ext, ".sh") == 0)
     {
-      char *f2 = concat ("/etc/postinstall/", fname, 0);
+      char *f2 = concat (dir, fname, 0);
+      log (0, "running: %s -c %s", sh, f2);
       run (sh, "-c", f2);
       free (f2);
     }
   else if (cmd && strcmp (ext, ".bat") == 0)
     {
-      char *f2 = backslash (cygpath ("/etc/postinstall/", fname, 0));
+      char *f2 = backslash (cygpath (dir, fname, 0));
+      log (0, "running: %s /c %s", cmd, f2);
       run (cmd, "/c", f2);
       free (f2);
     }
@@ -83,10 +86,15 @@ each (char *fname, unsigned int size)
     return;
 
   /* if file exists then delete it otherwise just ignore no file error */
-  remove (cygpath ("/etc/postinstall/", fname, ".done", 0));
+  remove (cygpath (dir, fname, ".done", 0));
+
+  rename (cygpath (dir, fname, 0), cygpath (dir, fname, ".done", 0));
+}
 
-  rename (cygpath ("/etc/postinstall/", fname, 0),
-	  cygpath ("/etc/postinstall/", fname, ".done", 0));
+static void
+run_script_in_etc_postinstall (char *fname, unsigned int size)
+{
+   run_script ("/etc/postinstall/", fname);
 }
 
 static const char *shells[] = {
@@ -98,11 +106,9 @@ static const char *shells[] = {
 };
 
 void
-do_postinstall (HINSTANCE h)
+init_run_script ()
 {
-  next_dialog = 0;
-  int i;
-  for (i = 0; shells[i]; i++)
+  for (int i = 0; shells[i]; i++)
     {
       sh = backslash (cygpath (shells[i], 0));
       if (_access (sh, 0) == 0)
@@ -110,7 +116,7 @@ do_postinstall (HINSTANCE h)
       free (sh);
       sh = 0;
     }
-
+  
   char old_path[_MAX_PATH];
   GetEnvironmentVariable ("PATH", old_path, sizeof (old_path));
   SetEnvironmentVariable ("PATH",
@@ -119,7 +125,6 @@ do_postinstall (HINSTANCE h)
 					      old_path, 0)));
 
   SetEnvironmentVariable ("CYGWINROOT", get_root_dir ());
-  SetCurrentDirectory (get_root_dir ());
 
   verinfo.dwOSVersionInfoSize = sizeof (verinfo);
   GetVersionEx (&verinfo);
@@ -136,6 +141,13 @@ do_postinstall (HINSTANCE h)
       cmd = "command.com";
       break;
     }
+}
 
-  find (cygpath ("/etc/postinstall", 0), each);
+void
+do_postinstall (HINSTANCE h)
+{
+  next_dialog = 0;
+  init_run_script ();
+  SetCurrentDirectory (get_root_dir ());
+  find (cygpath ("/etc/postinstall", 0), run_script_in_etc_postinstall);
 }
diff -purN --exclude=*~ --exclude=configure --exclude=setup_version.c --exclude=inilex.l --exclude=zlib --exclude=ChangeLog ../cinstall.orig/postinstall.h ./postinstall.h
--- ../cinstall.orig/postinstall.h	Thu Jan  1 01:00:00 1970
+++ ./postinstall.h	Sat Dec  8 14:38:17 2001
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2001, Jan Nieuwenhuizen.
+ *
+ *     This program is free software; you can redistribute it and/or modify
+ *     it under the terms of the GNU General Public License as published by
+ *     the Free Software Foundation; either version 2 of the License, or
+ *     (at your option) any later version.
+ *
+ *     A copy of the GNU General Public License can be found at
+ *     http://www.gnu.org/
+ *
+ * Written by Jan Nieuwenhuizen <janneke@gnu.org>
+ *
+ */
+#ifndef POSTINSTALL_H
+#define POSTINSTALL_H
+
+/* Run the script fname, found in dir.  If fname has suffix .sh, and
+   we have a Bourne shell, execute it using sh.  Otherwise, if fname
+   has suffix .bat, execute using cmd */
+   
+void run_script (char const *dir, char const *fname);
+
+/* Initialisation stuff for run_script: sh, cmd, CYGWINROOT and PATH */
+void init_run_script ();
+
+#endif /* POSTINSTALL_H */
+


-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]