syncopt - keep per-machine /opt in sync with master copy


syncopt [options] [packages...]


syncopt is a command for keeping host local package installations synchronised with a master host. More detailed discussion of its use and the practices associated with it is at this web page:

The intent is that packages built from source (and to a limited extent other packages with relocatable installs) need only be installed once on a central host, and that ``client'' machines get a local copy or a symbolic link as the administrator sees fit.

The basic scheme is that packages get built and installed as /opt/package-version and then copied to a central spot such as /u/syncopt/arch/package-version, leaving a symlink from /opt to the central package. In this way things think they live in /opt and become local or remote by either symlinking from /opt to the central copy or by installing an exact copy of /u/syncopt/arch/thing-version in </opt>.

The purpose of syncopt is to maintain that arrangement in a convenient and automatic fashion.

It would normally be run automatically on client machines via cron, or batch dispatched on all clients by hand via ssh after a new package install.



Force installation. The default action is to change nothing, merely reciting the actions which would be performed.


Trace execution. Implies -f. Report actions as they are taken.


Default to installing all packages locally. This is almost never what you want at the command line and I may remove this option. At need a suitable

        * local

line can be placed in the /opt/.syncopt configuration file.


Pass the -L (aka --copy-links) option to rsync(1). This treats symlinks as regular files and should render local installs that include symlinks to other, nonlocal, syncopt packages robust against loss of the central server. For example, /opt/bin frequently has a bunch of symlinks like:

        xpdf -> /opt/xpdf/bin/xpdf

to make pakage executables easily available. Without -L, a local /opt/bin would not mean a local xpdf executable. There is some space bloat with use of this option.


No action. This is the default. Merely recite the actions which would be performed.

-R rsync-path

Path to the rsync(1) command. useful to run a particular rsync version or for bootstrapping.

-r remote

Use the host remote as the master repository host. Normally syncopt will expect direct access to the master copies or the packages via the normal filesystem namespace, usually in /usr/local/opt* which is typically NFS mounted. Sometimes this isn't feasible. The -r option causes syncopt to use ssh(1) to access a remote host to obtain packages.


Verbose. Produce more output during the run.


The defaults for syncopt may be tuned by editing the file /opt/.syncopt. This is a simple text file with one line directives in it. Directives are read in order, with the last matching directive having precedence.

Blank lines and lines commencing with an octothorpe ('#') are comments, and skipped.

Lines of the form:


are read once at the start of the script to set environment parameters. var may take the names PATH, RSYNC, RSYNCOPTS or SUBDIRS to set or override the environment variables $SYNCOPT_PATH, $SYNCOPT_RSYNC, $SYNCOPT_RSYNCOPTS or $SYNCOPT_SUBDIRS respectively.

Other lines are of the form:

        package mode


        package version mode

where package is the name of the package (eg ``perl'' or ``xine''), version is the optional package revision, and mode is one of local for a local copy of the package, remote for a symbolic link, and nosync to have syncopt leave this package alone.

If the version is supplied, syncopt uses that to specify the default package version for the unversioned symlink:

        /opt/package -> package-version



The architecture name for this machine. The default is the output of ``uname -s'', although on systems I administer I arrange this to be a string of the form vendor.cpu.os, for example redhat.x86.linux.


This is the installation directory. The default is /opt.


A space separated list of repositories to search for packages. A repository is either a directory name or a remote name like ``bighost:/path/to/syncopt''. A machine not on a fixed LAN might use the latter form. Packages found in earlier repositories in this path are chosen over packages found later in the path. The default is ``/u/syncopt''.


This may be set to a space separated list of subdirectories to search for packages. The default is ``$ARCH common'' i.e. to look for the architecture specific stuff and then the architecture independent stuff.


Preferred path to the rsync(1) command as though specified with the -R command line option. The default is ``rsync''.


Extra command line options to supply to rsync(1). This was implemented primarily to allow supply of the --copy-links option to make link safe local copies, robust against loss of a central server which might ordinarily have been supplying some non-local packages.


Ssh command to use, as for rsync, if a remote host is in use. The default is ``ssh''.


A typical machine with a small /opt area might say:

        perl local
        mozilla local
        fvwm local

and so forth to make particular packages normally used by the machine's owner locally installed to provide resilience against downtime on the master NFS server.

A modern machine with plenty of room might say:

        * local

so that all packages are installed locally, providing complete NFS independence from the master host.

A minimal service machine which normally has no NFS mounts at all but which wants some packages installed might say:

        * nosync
        perl local
        rsync local
        script local

to make local installs of useful packages only, and no installs at all of the rest. This machine must be maintained by passing the -r option to syncopt to use ssh(1) to access the master machine or by setting the SYNCOPT_REMOTE environment variable in the system environment.

The same style of configuration would be used for a mobile machine such as a laptop which would not have everything local but also would frequently not have NFS access either, and which would not want to try (eg if the NFS were automounted - you don't want stray symlinks firing it up off site).


ssh(1), rsync(1)


Cameron Simpson <> 1996