From 38742c765d712acf8e006fe8a46815dfa52dbdb9 Mon Sep 17 00:00:00 2001 From: ruskie Date: Fri, 5 Jan 2007 15:25:43 +0100 Subject: [PATCH] utils/installwatch: initial commit --- utils/installwatch/BUILD | 3 ++ utils/installwatch/DEPENDS | 4 ++ utils/installwatch/DETAILS | 21 ++++++++++ utils/installwatch/HISTORY | 30 ++++++++++++++ utils/installwatch/INSTALL | 1 + utils/installwatch/PRE_BUILD | 13 ++++++ utils/installwatch/installwatch-buffer.diff | 33 +++++++++++++++ utils/installwatch/installwatch-cflags.diff | 24 +++++++++++ utils/installwatch/installwatch-errno.diff | 55 +++++++++++++++++++++++++ utils/installwatch/installwatch-glibc-bsd.diff | 20 +++++++++ utils/installwatch/installwatch-ld-preload.diff | 13 ++++++ utils/installwatch/installwatch-syslog.diff | 12 ++++++ 12 files changed, 229 insertions(+) create mode 100755 utils/installwatch/BUILD create mode 100755 utils/installwatch/DEPENDS create mode 100755 utils/installwatch/DETAILS create mode 100644 utils/installwatch/HISTORY create mode 100755 utils/installwatch/INSTALL create mode 100755 utils/installwatch/PRE_BUILD create mode 100644 utils/installwatch/installwatch-buffer.diff create mode 100644 utils/installwatch/installwatch-cflags.diff create mode 100644 utils/installwatch/installwatch-errno.diff create mode 100644 utils/installwatch/installwatch-glibc-bsd.diff create mode 100644 utils/installwatch/installwatch-ld-preload.diff create mode 100644 utils/installwatch/installwatch-syslog.diff diff --git a/utils/installwatch/BUILD b/utils/installwatch/BUILD new file mode 100755 index 0000000..6b6b04a --- /dev/null +++ b/utils/installwatch/BUILD @@ -0,0 +1,3 @@ +LIB="${LIB:-/lib}" +make PREFIX="${TRACK_ROOT}/usr" LIBDIR="${TRACK_ROOT}/usr/${LIB}" + diff --git a/utils/installwatch/DEPENDS b/utils/installwatch/DEPENDS new file mode 100755 index 0000000..530ddba --- /dev/null +++ b/utils/installwatch/DEPENDS @@ -0,0 +1,4 @@ +depends bzip2 && +depends gnupg && +depends smgl-fhs && +depends tar diff --git a/utils/installwatch/DETAILS b/utils/installwatch/DETAILS new file mode 100755 index 0000000..f167871 --- /dev/null +++ b/utils/installwatch/DETAILS @@ -0,0 +1,21 @@ + SPELL=installwatch + VERSION=0.6.3 + SOURCE=$SPELL-$VERSION.tgz + SOURCE_HASH=sha512:901a526171ee91c2c317328337ffd7fe93e872f3cac0a16899c04d6c7d99246b3fc24c795a386e87583895044ce87c2026a003c87b12c606a7617d699a4462fc +SOURCE_DIRECTORY=$BUILD_DIRECTORY/$SPELL-$VERSION + SOURCE_URL[0]=http://asic-linux.com.mx/~izto/checkinstall/files/source/$SOURCE + WEB_SITE=http://asic-linux.com.mx/~izto/installwatch.html + ENTERED=20011230 + UPDATED=20050106 + BUILD_API=2 + BI_ARCH_SPELL="yes" + KEYWORDS="utils" + SHORT="installwatch is a utility for tracking files during the installation of software." +cat << EOF +Installwatch is a simple utility which keeps track of which files are +created and modified during the installation of a new program. It's +fast and easy to use. It doesn't require a "pre-install" phase +because it monitors processes while they run. Installwatch works with +every dynamically linked ELF program, by intercepting system calls +that cause file system alterations. +EOF diff --git a/utils/installwatch/HISTORY b/utils/installwatch/HISTORY new file mode 100644 index 0000000..6e9c035 --- /dev/null +++ b/utils/installwatch/HISTORY @@ -0,0 +1,30 @@ +2006-03-12 Karsten Behrmann + * DETAILS: (automated) Add KEYWORDS + +2006-03-05 David Brown + * PRE_BUILD: removed no reason for doing those checks in this spell + +2006-02-08 Eric Sandall + * DEPENDS: Depends on smgl-fhs (for directory structure) + +2006-02-06 Eric Sandall + * DEPENDS: Depends on gnupg (for SOURCE verification) + +2005-11-29 Seth Woolley + * DETAILS: MD5 -> SHA512 + +2005-05-12 Andrew Stitt + * BUILD, INSTALL: Update to install into a chroot correctly, bug 8853. + +2005-01-06 Benoit PAPILLAULT + * Added 4 patches to resolved bugs in installwatch itself. + See http://bugs.sourcemage.org/show_bug.cgi?id=5497 + +2003-12-01 Eric Sandall + * BUILD,PRE_BUILD: Use INSTALL_ROOT + * DEPENDS: Added dependencies on tar and bzip2 + +2003-09-20 Eric Sandall + * HISTORY: Created + * ld_preload.patch,BUILD: Added patch from Benoit for the ISO (Bug #4384) + diff --git a/utils/installwatch/INSTALL b/utils/installwatch/INSTALL new file mode 100755 index 0000000..95188ab --- /dev/null +++ b/utils/installwatch/INSTALL @@ -0,0 +1 @@ +make BINDIR="${INSTALL_ROOT}/usr/bin" LIBDIR="${INSTALL_ROOT}/usr/${LIB}" install diff --git a/utils/installwatch/PRE_BUILD b/utils/installwatch/PRE_BUILD new file mode 100755 index 0000000..6a53fe5 --- /dev/null +++ b/utils/installwatch/PRE_BUILD @@ -0,0 +1,13 @@ +default_pre_build && +cd $SOURCE_DIRECTORY && +chmod a+w Makefile && +chmod a+w installwatch.c && +patch -p1 < "${SCRIPT_DIRECTORY}/installwatch-ld-preload.diff" && +patch -p1 < "${SCRIPT_DIRECTORY}/installwatch-errno.diff" && +patch -p1 < "${SCRIPT_DIRECTORY}/installwatch-buffer.diff" && +patch -p1 < "${SCRIPT_DIRECTORY}/installwatch-cflags.diff" && +patch -p1 < "${SCRIPT_DIRECTORY}/installwatch-syslog.diff" && +if [[ "$(uname)" == "GNU/kFreeBSD" ]] +then +patch -p0 < "${SCRIPT_DIRECTORY}/installwatch-glibc-bsd.diff" +fi diff --git a/utils/installwatch/installwatch-buffer.diff b/utils/installwatch/installwatch-buffer.diff new file mode 100644 index 0000000..c6c8093 --- /dev/null +++ b/utils/installwatch/installwatch-buffer.diff @@ -0,0 +1,33 @@ +diff -urN installwatch-0.6.3.ori/installwatch.c installwatch-0.6.3/installwatch.c +--- installwatch-0.6.3.ori/installwatch.c 2004-08-30 14:47:35.917768321 +0000 ++++ installwatch-0.6.3/installwatch.c 2004-08-30 14:51:30.568600728 +0000 +@@ -142,11 +142,17 @@ + va_start(ap, format); + count = vsnprintf(buffer, BUFSIZE, format, ap); + va_end(ap); ++ ++ buffer [BUFSIZE - 2] = '\n'; ++ buffer [BUFSIZE - 1] = 0; ++ + if(count == -1) { + /* The buffer was not big enough */ + strcpy(&(buffer[BUFSIZE - 5]), "...\n"); + count = BUFSIZE - 1; +- } ++ } else { ++ count = strlen(buffer); ++ } + if((logname = getenv("INSTALLWATCHFILE"))) { + logfd = true_open(logname, O_WRONLY | O_CREAT | O_APPEND, 0666); + if(logfd >= 0) { +@@ -179,8 +185,9 @@ + * to the current working directory if it was not + * an absolute path */ + getcwd(resolved_path, MAXPATHLEN - 2); ++ resolved_path[MAXPATHLEN - 2] = 0; + strcat(resolved_path, "/"); +- strncat(resolved_path, path, MAXPATHLEN - 1); ++ strncat(resolved_path, path, MAXPATHLEN - 1 - strlen(resolved_path)); + } + + errno = s_errno; diff --git a/utils/installwatch/installwatch-cflags.diff b/utils/installwatch/installwatch-cflags.diff new file mode 100644 index 0000000..0078dfa --- /dev/null +++ b/utils/installwatch/installwatch-cflags.diff @@ -0,0 +1,24 @@ +--- installwatch-0.6.3/Makefile.ori 2004-09-08 16:05:24.475554253 +0200 ++++ installwatch-0.6.3/Makefile 2004-09-08 16:06:55.238768317 +0200 +@@ -16,10 +16,10 @@ + all: installwatch.so + + installwatch.so: installwatch.o +- ld -shared -o installwatch.so installwatch.o -ldl -lc ++ $(CC) $(CFLAGS) $(LDFLAGS) -shared -nostdlib -o installwatch.so installwatch.o -ldl -lc + + installwatch.o: installwatch.c localdecls.h +- gcc -Wall -c -D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT -DVERSION=\"$(VERSION)\" installwatch.c ++ $(CC) $(CFLAGS) -c -D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT -DVERSION=\"$(VERSION)\" installwatch.c + + localdecls.h: + ./create-localdecls +@@ -33,7 +33,7 @@ + uninstall: + rm $(LIBDIR)/installwatch.so + rm $(BINDIR)/installwatch +- ++ + clean: + rm -f *~ *.bak *.o installwatch.so core localdecls.h libctest test-installwatch + diff --git a/utils/installwatch/installwatch-errno.diff b/utils/installwatch/installwatch-errno.diff new file mode 100644 index 0000000..f58ecda --- /dev/null +++ b/utils/installwatch/installwatch-errno.diff @@ -0,0 +1,55 @@ +diff -Naur installwatch-0.6.3/installwatch.c installwatch-0.6.3-new/installwatch.c +--- installwatch-0.6.3/installwatch.c 2001-12-23 00:37:06.000000000 +0100 ++++ installwatch-0.6.3-new/installwatch.c 2004-01-08 01:58:25.000000000 +0100 +@@ -134,7 +134,10 @@ + static void log(const char *format, ...) { + char buffer[BUFSIZE], *logname; + va_list ap; +- int count, logfd; ++ int count, logfd, s_errno; ++ ++ /* save errno */ ++ s_errno = errno; + + va_start(ap, format); + count = vsnprintf(buffer, BUFSIZE, format, ap); +@@ -156,9 +159,21 @@ + + } else + syslog(LOGLEVEL, buffer); ++ ++ /* restore errno */ ++ errno = s_errno; + } + + static void canonicalize(const char *path, char *resolved_path) { ++ ++ /* 2004/01/08 Benoit PAPILLAULT ++ Since this function can change errno, we save and restore it ++ */ ++ ++ int s_errno; ++ ++ s_errno = errno; ++ + if(!realpath(path, resolved_path) && (path[0] != '/')) { + /* The path could not be canonicalized, append it + * to the current working directory if it was not +@@ -167,6 +182,8 @@ + strcat(resolved_path, "/"); + strncat(resolved_path, path, MAXPATHLEN - 1); + } ++ ++ errno = s_errno; + } + + static void make_path (char *path) { +@@ -532,7 +549,7 @@ + + backup (canonic); + +- result = true_chown(path, owner, group); ++ result = true_lchown(path, owner, group); + log("%d\tlchown\t%s\t%d\t%d\t#%s\n", result, canonic, owner, group, error(result)); + return result; + } diff --git a/utils/installwatch/installwatch-glibc-bsd.diff b/utils/installwatch/installwatch-glibc-bsd.diff new file mode 100644 index 0000000..746a6f5 --- /dev/null +++ b/utils/installwatch/installwatch-glibc-bsd.diff @@ -0,0 +1,20 @@ +--- installwatch.c 2001-12-23 00:37:06.000000000 +0100 ++++ installwatch.c.orig 2006-04-18 15:52:37.000000000 +0200 +@@ -574,7 +574,7 @@ + + REFCOUNT; + va_start(ap, flags); +- mode = va_arg(ap, mode_t); ++ mode = (mode_t) va_arg(ap, int); + va_end(ap); + canonicalize(pathname, canonic); + +@@ -745,7 +745,7 @@ + #endif + + va_start(ap, flags); +- mode = va_arg(ap, mode_t); ++ mode = (mode_t) va_arg(ap, int); + va_end(ap); + canonicalize(pathname, canonic); + if(flags & (O_WRONLY | O_RDWR)) diff --git a/utils/installwatch/installwatch-ld-preload.diff b/utils/installwatch/installwatch-ld-preload.diff new file mode 100644 index 0000000..966b5b7 --- /dev/null +++ b/utils/installwatch/installwatch-ld-preload.diff @@ -0,0 +1,13 @@ +diff -Naur installwatch-0.6.3.ori/Makefile installwatch-0.6.3/Makefile +--- installwatch-0.6.3.ori/Makefile 2001-12-22 23:37:06.000000000 +0000 ++++ installwatch-0.6.3/Makefile 2003-09-20 20:31:52.000000000 +0000 +@@ -25,8 +25,8 @@ + ./create-localdecls + + install: all +- if [ -r $(LIBDIR)/installwatch.so ]; then rm $(LIBDIR)/installwatch.so; export LD_PRELOAD=""; cp installwatch.so $(LIBDIR); LD_PRELOAD=$(LIBDIR)/installwatch.so; else cp installwatch.so $(LIBDIR); fi +- ++ cp installwatch.so $(LIBDIR)/installwatch.so.new ++ mv $(LIBDIR)/installwatch.so.new $(LIBDIR)/installwatch.so + sed -e "s|#PREFIX#|$(PREFIX)|" < installwatch > $(BINDIR)/installwatch + chmod 755 $(BINDIR)/installwatch diff --git a/utils/installwatch/installwatch-syslog.diff b/utils/installwatch/installwatch-syslog.diff new file mode 100644 index 0000000..8364e45 --- /dev/null +++ b/utils/installwatch/installwatch-syslog.diff @@ -0,0 +1,12 @@ +diff -urN installwatch-0.6.3/installwatch.c installwatch-0.6.4/installwatch.c +--- installwatch-0.6.3/installwatch.c 2004-11-10 17:34:11.817461389 +0100 ++++ installwatch-0.6.4/installwatch.c 2004-11-10 17:00:42.614038577 +0100 +@@ -164,7 +164,7 @@ + syslog(LOGLEVEL, "Could not open `%s' to write `%s': %s\n", logname, buffer, strerror(errno)); + + } else +- syslog(LOGLEVEL, buffer); ++ syslog(LOGLEVEL, "%s", buffer); + + /* restore errno */ + errno = s_errno; -- 2.11.4.GIT