Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ update(cmds) — Sprite KS.390

Media Vault

Software Library

Restoration Projects

Artifacts Sought

UPDATE  —  User Commands

NAME

update − A copy program that recursively updates directory trees

SYNOPSIS

update [options] src1 ... srcN targetDir
update [options] src target

OPTIONS

−b directoryBefore updating a target, save a backup copy of the file in directory. 

−B daysOnly save the target as a backup copy if no backup exists or if the target is days days old. 

−fForce:  always update targets regardless of last-modified times. 

−g groupChange the group of any updated files to group.  Targets that aren’t updated do not have their groups changed. 

−helpPrint a summary of the command-line options and exit without updating any targets. 

−lIf a source file is a symbolic link then update normally creates an identical symbolic link at the destination.  If the −l switch is specified, then update copies the file referenced by the source link, rather than the link itself. 

−LCreates symbolic links to non-directory source files, rather than copying them.  Directories are copied in the normal manner. This flag is useful for creating shadow trees of source directories. If either the source or the destination start with ’/’ the link will be absolute, otherwise it’s relative. 

−m modeWhen updating a target, set its protection bits to mode.  Targets that aren’t updated do not have their protection changed.  Mode must be specified in octal. 

−nBe nice about problems with file types not matching (i.e. don’t return an error). 

−MWhen updating a target, do it by moving the source instead of by copying.  This may be useful when disk space is tight. 

−o ownerPerform all updates as user owner, so that newly-created targets will be owned by owner.  Any targets that are not updated will not have their owner changed. 

−OThis option preserves ownership on newly created files.  Only root or wheel group members can use this option. 

−p pruneExprPrune subtress whose name matches the given regular expression. 

−qQuiet.  Don’t print anything except for error messages.  Update normally prints a message for each file copied. 

−sStrip.  Source files are all expected to be executable binaries.  When copying, strip all of the symbol and relocation information from the updated target. 

−tInstead of setting the last-accessed and last-modified times of each target to match those of its source, leave them alone, so that they are set to the current time. 

−vVerify.  Don’t actually modify any files, but print information about which files would have been modified. 
 

INTRODUCTION

The update command is used to replace out-of-date copies of files with more recent versions.  It operates on one or more source files.  For each source, update locates a corresponding target;  if the target doesn’t exist, or if the last-modified time of the source is later than the last-modified time of the target, or if the −f option is specified, then update makes a copy of the source at the target.  The target’s last-modified time and permissions will be set identical to those of the source. 

In the simplest case, two file names are given, both of which are regular files.  In this case the first file name is the source and the second is the target.  If the last file name refers to a directory, then all the other file names (of which there may be more than one) are sources.  Each source file will be updated to the corresponding file within the target directory.  For example, in the command update /a/b c d foo the target for /a/b will be foo/b, the target for c will be /foo/c, and the target for d will be foo/d. 

If any of the source files is a directory, then its entire subtree will be updated to the corresponding target, maintaining the subtree structure of the source.  In the special case where only two file names are given and both are directories, then the source is updated to the target directory rather than within it.  Thus, in the command update a b where a and b are both directories and a contains one subdirectory c which in turn contains one file d, the target corresponding to a/c/d will be b/c/d.  Update will create the directory b/c if it doesn’t already exist. 

Update will also copy symbolic links.  Normally it creates matching symbolic links at the targets, but it will copy the files pointed to by the links if the −l switch is given. 

If the target for a source already exists but has a type different from the source (e.g. the target is a directory and the source is a regular file), then update will not modify the target.  If the target’s last-modified time is more recent than the source’s, then again update will not modify the target. 
 

USER AND GROUP CHANGES

There are several restrictions on usage of the −O, −o and −g switches.  You may specify −O only if you are root or in the wheel group.  You may specify −g group as long as you are a member of group.  You may specify −o owner if either

[1]You are owner (which isn’t very interesting). 

[2]Owner is root, and you are a member of the wheel group. 

[3]There is a group with the same name as owner and you are a member of that group. 
 

SET-USER_ID

If you haven’t specified the −m switch, then update attempts to preserve set-user-id bits.  It also attempts to preserve set-user-id bits when making backup copies, even if the −m switch was given.  However, set-user-id bits are not preserved unless the owner of the target file is the same as the owner of the source file (this condition is always true if the −O switch is given). 
 

BACKUP FILES

If the −b switch is specified, then update attempts to ensure that a backup copy of the target is saved, if the target already exists.  If a backup already exists, then the backup is overwritten only if the target is relatively old (a parameter that defaults to files two weeks old and may be overridden by the -B switch, specifying the requisite age in days).  If the -B switch specifies an age of 0, then the most recent target will always be backed up.  Normally, the default of 14 (two weeks) is used to guarantee that an unstable file does not overwrite a stable backup. 
 

PRUNING SUB-TREES

The −p option can be used to prune unwanted sub-trees from the source files. The argument is a regular expression that is matched against all source files before updating them.  If the expression matches then the source is not updated.  The expression is matched against only the tail of the source path name, so using an expression of "foo/bar" will not do what you think it will. If the argument contains any magic characters such as "∗" then you better put it inside of quotes otherwise csh will glob it first.  Multiple −p options can be specified and will be compared against the source files one at a time. 

KEYWORDS

copy, up-to-date
 

SEE ALSO

cp, mv, tar

Sprite version 1.0  —  December 17, 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026