diff -cr fileutils-4.1/doc/fileutils.info fileutils-4.1-shh/doc/fileutils.info *** fileutils-4.1/doc/fileutils.info Sun Apr 29 10:29:41 2001 --- fileutils-4.1-shh/doc/fileutils.info Sat Feb 2 23:45:24 2002 *************** *** 2105,2110 **** --- 2105,2150 ---- can be `none' (or `off'), `numbered' (or `t'), `existing' (or `nil'), or `never' (or `simple'). *Note Backup options::. + By setting the environment variable `INSTALL_LOG_FILE' to the name + of a file, `install' will log changes by appending lines to the end of + the given file. An identifier for the installation process may be given + in the environment variable `INSTALL_LOG_ID'. This identifier is + usefull if you want to separate files that come from different source + packages. + + Lines in the log file contains the following fields, separated by a + single space character: + + `date' + The date of the installation, in ISO date format. + + `time' + The time of the installation, in local time. + + `ID' + Identifier as given by the `INSTALL_LOG_ID' environment variable. + Defaults to "no-id" if the environment variable is unset. Note + that any occurences of space characters in the ID is replaced by + an underscore character. This simplifies automatic extraction of + fields from the log file. + + `mode' + The octal file permission mode of the file. + + `owner' + The owner of the installed file. + + `group' + The group of the file. + + `directory' + Indicates whether the file name refers to a directory or not. A 1 + in this field means the file is a directory. A 0 indicates a + regular file. + + `name' + The directory and name of the installed file. +  File: fileutils.info, Node: mv invocation, Next: rm invocation, Prev: install invocation, Up: Basic operations *************** *** 4122,4145 **** Node: cp invocation63596 Node: dd invocation71708 Node: install invocation74893 ! Node: mv invocation78410 ! Node: rm invocation81682 ! Node: shred invocation83756 ! Node: Special file types90267 ! Node: ln invocation91551 ! Node: mkdir invocation95807 ! Node: mkfifo invocation97295 ! Node: mknod invocation98191 ! Node: rmdir invocation99675 ! Node: Changing file attributes100827 ! Node: chown invocation101637 ! Node: chgrp invocation105665 ! Node: chmod invocation107590 ! Node: touch invocation109185 ! Node: Disk usage112196 ! Node: df invocation112809 ! Node: du invocation117911 ! Node: sync invocation121424 ! Node: Index122244  End Tag Table --- 4162,4185 ---- Node: cp invocation63596 Node: dd invocation71708 Node: install invocation74893 ! Node: mv invocation79671 ! Node: rm invocation82943 ! Node: shred invocation85017 ! Node: Special file types91528 ! Node: ln invocation92812 ! Node: mkdir invocation97068 ! Node: mkfifo invocation98556 ! Node: mknod invocation99452 ! Node: rmdir invocation100936 ! Node: Changing file attributes102088 ! Node: chown invocation102898 ! Node: chgrp invocation106926 ! Node: chmod invocation108851 ! Node: touch invocation110446 ! Node: Disk usage113457 ! Node: df invocation114070 ! Node: du invocation119172 ! Node: sync invocation122685 ! Node: Index123505  End Tag Table diff -cr fileutils-4.1/doc/fileutils.texi fileutils-4.1-shh/doc/fileutils.texi *** fileutils-4.1/doc/fileutils.texi Mon Apr 23 09:36:22 2001 --- fileutils-4.1-shh/doc/fileutils.texi Sat Feb 2 23:33:26 2002 *************** *** 1795,1801 **** --- 1795,1844 ---- @end table + By setting the environment variable @code{INSTALL_LOG_FILE} to the + name of a file, @code{install} will log changes by appending lines to + the end of the given file. An identifier for the installation process + may be given in the environment variable @code{INSTALL_LOG_ID}. This + identifier is usefull if you want to separate files that come from + different source packages. + Lines in the log file contains the following fields, separated by + a single space character: + + @table @samp + + @item date + The date of the installation, in ISO date format. + + @item time + The time of the installation, in local time. + + @item ID + Identifier as given by the @code{INSTALL_LOG_ID} environment + variable. Defaults to "no-id" if the environment variable is + unset. Note that any occurences of space characters in the ID is + replaced by an underscore character. This simplifies automatic + extraction of fields from the log file. + + @item mode + The octal file permission mode of the file. + + @item owner + The owner of the installed file. + + @item group + The group of the file. + + @item directory + Indicates whether the file name refers to a directory or not. A 1 in + this field means the file is a directory. A 0 indicates a regular + file. + + @item name + The directory and name of the installed file. + + @end table + @node mv invocation @section @code{mv}: Move (rename) files diff -cr fileutils-4.1/doc/stamp-vti fileutils-4.1-shh/doc/stamp-vti *** fileutils-4.1/doc/stamp-vti Sun Apr 29 10:29:41 2001 --- fileutils-4.1-shh/doc/stamp-vti Sat Feb 2 23:45:24 2002 *************** *** 1,4 **** ! @set UPDATED 23 April 2001 ! @set UPDATED-MONTH April 2001 @set EDITION 4.1 @set VERSION 4.1 --- 1,4 ---- ! @set UPDATED 2 February 2002 ! @set UPDATED-MONTH February 2002 @set EDITION 4.1 @set VERSION 4.1 diff -cr fileutils-4.1/doc/version.texi fileutils-4.1-shh/doc/version.texi *** fileutils-4.1/doc/version.texi Sun Apr 29 10:29:41 2001 --- fileutils-4.1-shh/doc/version.texi Sat Feb 2 23:45:24 2002 *************** *** 1,4 **** ! @set UPDATED 23 April 2001 ! @set UPDATED-MONTH April 2001 @set EDITION 4.1 @set VERSION 4.1 --- 1,4 ---- ! @set UPDATED 2 February 2002 ! @set UPDATED-MONTH February 2002 @set EDITION 4.1 @set VERSION 4.1 diff -cr fileutils-4.1/man/ginstall.1 fileutils-4.1-shh/man/ginstall.1 *** fileutils-4.1/man/ginstall.1 Sun Apr 29 10:29:45 2001 --- fileutils-4.1-shh/man/ginstall.1 Sun Feb 3 01:56:16 2002 *************** *** 1,5 **** .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.24. ! .TH INSTALL "1" "April 2001" "install (fileutils) 4.1" FSF .SH NAME install \- copy files and set attributes .SH SYNOPSIS --- 1,5 ---- .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.24. ! .TH INSTALL "1" "February 2002" "install (fileutils) 4.1" FSF .SH NAME install \- copy files and set attributes .SH SYNOPSIS diff -cr fileutils-4.1/po/fileutils.pot fileutils-4.1-shh/po/fileutils.pot *** fileutils-4.1/po/fileutils.pot Sun Apr 29 13:38:26 2001 --- fileutils-4.1-shh/po/fileutils.pot Sun Feb 3 01:56:16 2002 *************** *** 6,18 **** msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" ! "POT-Creation-Date: 2001-04-29 13:38+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" ! "Content-Transfer-Encoding: 8-bit\n" #: lib/argmatch.c:159 #, c-format --- 6,18 ---- msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" ! "POT-Creation-Date: 2002-02-03 01:56+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" ! "Content-Transfer-Encoding: 8bit\n" #: lib/argmatch.c:159 #, c-format *************** *** 235,241 **** msgstr "" #: src/chgrp.c:123 src/chmod.c:263 src/chown.c:97 src/cp.c:143 src/dd.c:288 ! #: src/df.c:742 src/dircolors.c:99 src/du.c:199 src/install.c:596 src/ln.c:335 #: src/ls.c:3248 src/mkdir.c:59 src/mkfifo.c:51 src/mknod.c:61 src/mv.c:325 #: src/rm.c:84 src/rmdir.c:142 src/shred.c:461 src/sync.c:40 src/touch.c:215 #, c-format --- 235,241 ---- msgstr "" #: src/chgrp.c:123 src/chmod.c:263 src/chown.c:97 src/cp.c:143 src/dd.c:288 ! #: src/df.c:742 src/dircolors.c:99 src/du.c:199 src/install.c:702 src/ln.c:335 #: src/ls.c:3248 src/mkdir.c:59 src/mkfifo.c:51 src/mknod.c:61 src/mv.c:325 #: src/rm.c:84 src/rmdir.c:142 src/shred.c:461 src/sync.c:40 src/touch.c:215 #, c-format *************** *** 270,276 **** msgstr "" #: src/chgrp.c:149 src/chmod.c:287 src/chown.c:135 src/cp.c:215 src/dd.c:327 ! #: src/df.c:769 src/dircolors.c:118 src/du.c:230 src/install.c:640 #: src/ln.c:379 src/ls.c:3335 src/mkdir.c:73 src/mkfifo.c:63 src/mknod.c:79 #: src/mv.c:362 src/rm.c:111 src/rmdir.c:160 src/shred.c:505 src/sync.c:51 #: src/touch.c:240 --- 270,276 ---- msgstr "" #: src/chgrp.c:149 src/chmod.c:287 src/chown.c:135 src/cp.c:215 src/dd.c:327 ! #: src/df.c:769 src/dircolors.c:118 src/du.c:230 src/install.c:746 #: src/ln.c:379 src/ls.c:3335 src/mkdir.c:73 src/mkfifo.c:63 src/mknod.c:79 #: src/mv.c:362 src/rm.c:111 src/rmdir.c:160 src/shred.c:505 src/sync.c:51 #: src/touch.c:240 *************** *** 279,285 **** "Report bugs to ." msgstr "" ! #: src/chgrp.c:207 src/chmod.c:375 src/chown.c:207 src/install.c:289 #: src/mkdir.c:121 src/mkfifo.c:108 src/mknod.c:136 src/rm.c:180 #: src/rmdir.c:204 msgid "too few arguments" --- 279,285 ---- "Report bugs to ." msgstr "" ! #: src/chgrp.c:207 src/chmod.c:375 src/chown.c:207 src/install.c:331 #: src/mkdir.c:121 src/mkfifo.c:108 src/mknod.c:136 src/rm.c:180 #: src/rmdir.c:204 msgid "too few arguments" *************** *** 721,727 **** "\n" msgstr "" ! #: src/cp.c:199 src/install.c:630 src/ln.c:369 src/mv.c:352 msgid "" "The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.\n" "The version control method may be selected via the --backup option or " --- 721,727 ---- "\n" msgstr "" ! #: src/cp.c:199 src/install.c:736 src/ln.c:369 src/mv.c:352 msgid "" "The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.\n" "The version control method may be selected via the --backup option or " *************** *** 779,785 **** msgid "when preserving paths, the destination must be a directory" msgstr "" ! #: src/cp.c:747 src/install.c:224 src/ln.c:423 src/mv.c:406 #, c-format msgid "" "warning: --version-control (-V) is obsolete; support for it\n" --- 779,785 ---- msgid "when preserving paths, the destination must be a directory" msgstr "" ! #: src/cp.c:747 src/install.c:254 src/ln.c:423 src/mv.c:406 #, c-format msgid "" "warning: --version-control (-V) is obsolete; support for it\n" *************** *** 800,806 **** "Use `--parents' for the old meaning, and `--no-dereference' for the new one." msgstr "" ! #: src/cp.c:870 src/install.c:280 src/ln.c:518 src/mv.c:480 msgid "backup type" msgstr "" --- 800,806 ---- "Use `--parents' for the old meaning, and `--no-dereference' for the new one." msgstr "" ! #: src/cp.c:870 src/install.c:322 src/ln.c:518 src/mv.c:480 msgid "backup type" msgstr "" *************** *** 1124,1186 **** msgid "warning: summarizing conflicts with --max-depth=%d" msgstr "" ! #: src/install.c:274 msgid "the strip option may not be used when installing a directory" msgstr "" ! #: src/install.c:297 src/mkdir.c:137 #, c-format msgid "invalid mode %s" msgstr "" ! #: src/install.c:312 src/install.c:374 #, c-format msgid "creating directory %s" msgstr "" ! #: src/install.c:337 #, c-format msgid "installing multiple files, but last argument, %s is not a directory" msgstr "" ! #: src/install.c:438 src/remove.c:676 #, c-format msgid "%s is a directory" msgstr "" ! #: src/install.c:498 #, c-format msgid "cannot obtain time stamps for %s" msgstr "" ! #: src/install.c:510 #, c-format msgid "cannot set time stamps for %s" msgstr "" ! #: src/install.c:531 msgid "cannot fork" msgstr "" ! #: src/install.c:535 msgid "cannot run strip" msgstr "" ! #: src/install.c:542 msgid "strip failed" msgstr "" ! #: src/install.c:563 #, c-format msgid "invalid user %s" msgstr "" ! #: src/install.c:581 #, c-format msgid "invalid group %s" msgstr "" ! #: src/install.c:600 #, c-format msgid "" "Usage: %s [OPTION]... SOURCE DEST (1st format)\n" --- 1124,1186 ---- msgid "warning: summarizing conflicts with --max-depth=%d" msgstr "" ! #: src/install.c:304 msgid "the strip option may not be used when installing a directory" msgstr "" ! #: src/install.c:339 src/mkdir.c:137 #, c-format msgid "invalid mode %s" msgstr "" ! #: src/install.c:356 src/install.c:479 #, c-format msgid "creating directory %s" msgstr "" ! #: src/install.c:385 #, c-format msgid "installing multiple files, but last argument, %s is not a directory" msgstr "" ! #: src/install.c:544 src/remove.c:676 #, c-format msgid "%s is a directory" msgstr "" ! #: src/install.c:604 #, c-format msgid "cannot obtain time stamps for %s" msgstr "" ! #: src/install.c:616 #, c-format msgid "cannot set time stamps for %s" msgstr "" ! #: src/install.c:637 msgid "cannot fork" msgstr "" ! #: src/install.c:641 msgid "cannot run strip" msgstr "" ! #: src/install.c:648 msgid "strip failed" msgstr "" ! #: src/install.c:669 #, c-format msgid "invalid user %s" msgstr "" ! #: src/install.c:687 #, c-format msgid "invalid group %s" msgstr "" ! #: src/install.c:706 #, c-format msgid "" "Usage: %s [OPTION]... SOURCE DEST (1st format)\n" *************** *** 1188,1194 **** " or: %s -d [OPTION]... DIRECTORY... (3rd format)\n" msgstr "" ! #: src/install.c:606 msgid "" "In the first two formats, copy SOURCE to DEST or multiple SOURCE(s) to\n" "the existing DIRECTORY, while setting permission modes and owner/group.\n" --- 1188,1194 ---- " or: %s -d [OPTION]... DIRECTORY... (3rd format)\n" msgstr "" ! #: src/install.c:712 msgid "" "In the first two formats, copy SOURCE to DEST or multiple SOURCE(s) to\n" "the existing DIRECTORY, while setting permission modes and owner/group.\n" diff -cr fileutils-4.1/src/install.c fileutils-4.1-shh/src/install.c *** fileutils-4.1/src/install.c Mon Dec 25 12:07:36 2000 --- fileutils-4.1-shh/src/install.c Sun Feb 3 01:55:56 2002 *************** *** 27,32 **** --- 27,33 ---- #include #include #include + #include #include "system.h" #include "backupfile.h" *************** *** 87,92 **** --- 88,97 ---- static int change_attributes PARAMS ((const char *path)); static int copy_file PARAMS ((const char *from, const char *to, const struct cp_options *x)); + /* SHH: logging */ + static void log_install PARAMS ((const char *to, int mode, + uid_t uid, gid_t gid, + int is_dir)); static int install_file_to_path PARAMS ((const char *from, const char *to, const struct cp_options *x)); static int install_file_in_dir PARAMS ((const char *from, const char *to_dir, *************** *** 124,129 **** --- 129,144 ---- /* If nonzero, install a directory instead of a regular file. */ static int dir_arg; + /* SHH: If non-NULL, the name of the file to which logging should be + * written. */ + static char *log_file; + + /* SHH: The current identification to include in loglines. No SPC allowed. */ + static char *log_id; + + /* SHH: Perform logging to a file? */ + static int log_enabled = 0; + static struct option const long_options[] = { {"backup", optional_argument, NULL, 'b'}, *************** *** 191,196 **** --- 206,213 ---- struct cp_options x; int n_files; char **file; + /* SHH: logging */ + char *log; program_name = argv[0]; setlocale (LC_ALL, ""); *************** *** 211,216 **** --- 228,246 ---- we'll actually use backup_suffix_string. */ backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX"); + /* SHH: log stuff */ + log = getenv ("INSTALL_LOG_FILE"); + if (log) { + log_file = log; + log_enabled = 1; + } + log = getenv ("INSTALL_LOG_ID"); + if (log) { + /* make a copy, since this one may be changed later. */ + log_id = xmalloc (strlen (log) + 1); + strcpy (log_id, log); + } + while ((optc = getopt_long (argc, argv, "bcsDdg:m:o:pvV:S:", long_options, NULL)) != -1) { *************** *** 273,278 **** --- 303,320 ---- error (1, 0, _("the strip option may not be used when installing a directory")); + /* SHH: Remove any spaces from the log_id to simplify interpretation + * of the log file. */ + if (log_id) { + char *s = log_id; + + while (*s) { + if (*s == ' ') + *s = '_'; + ++s; + } + } + if (backup_suffix_string) simple_backup_suffix = xstrdup (backup_suffix_string); *************** *** 307,315 **** int i; for (i = 0; i < n_files; i++) { ! errors |= make_path (file[i], mode, mode, owner_id, group_id, 0, (x.verbose ? _("creating directory %s") : NULL)); } } else --- 349,363 ---- int i; for (i = 0; i < n_files; i++) { ! int result; ! ! result = make_path (file[i], mode, mode, owner_id, group_id, 0, (x.verbose ? _("creating directory %s") : NULL)); + /* SHH: log it */ + if (result == 0) + log_install(file[i], mode, owner_id, group_id, 1); + errors |= result; } } else *************** *** 349,354 **** --- 397,459 ---- exit (errors); } + /* SHH: Write logging information to a log file, if specified on the + command line or in environment variables. */ + + static void + log_install (const char *to, int mode, + uid_t uid, gid_t gid, + int is_dir) + { + static FILE *f; /* Log file. Closed on program termination. */ + time_t t; + struct tm *tm; + struct passwd *pw; + char pws[20], *pwp; + struct group *gr; + char grs[20], *grp; + + if (!log_enabled) + return; + + if (!f && (f = fopen (log_file, "a")) == NULL) { + error (0, errno, "%s", log_file); + log_enabled = 0; + return; + } + + time (&t); + tm = localtime (&t); + /* Attempt mapping the user id to something more human. */ + if (uid == (uid_t) -1) + uid = geteuid(); + if ((pw = getpwuid (uid)) == NULL) { + sprintf (pws, "%u", (unsigned) uid); + pwp = pws; + } else + pwp = pw->pw_name; + + /* Ditto for the group id. */ + if (gid == (uid_t) -1) + gid = getegid(); + if ((gr = getgrgid (gid)) == NULL) { + sprintf (grs, "%u", (unsigned) gid); + grp = grs; + } else + grp = gr->gr_name; + + if (fprintf (f, + "%04d-%02d-%02d %02d:%02d:%02d %s %o %s %s %d %s\n", + tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec, + log_id ? log_id : "no-id", + mode, pwp, grp, + is_dir, to) < 0) { + error (0, errno, "%s", log_file); + log_enabled = 0; + } + } + /* Copy file FROM onto file TO, creating any missing parent directories of TO. Return 0 if successful, 1 if an error occurs */ *************** *** 392,397 **** --- 497,503 ---- { if (copy_file (from, to, x)) return 1; + log_install(to, mode, owner_id, group_id, 0); if (strip_files) strip (to); if (change_attributes (to)) Only in fileutils-4.1-shh/src: install.c.~1~