NAME

SYNOPSIS

DESCRIPTION

The Setup.sh bourne shell script searches for an installed mksh(1) and
invokes the MirPorts Framework set-up programme with it. If no suitable
mksh(1) version is found, the current version is fetched, built and in-
stalled for bootstrapping purposes. During installation, the environment
is set up, various programmes are installed, and several files are gen-
erated (see below). To use the MirPorts Framework after installation, ex-
ecute either of the following two commands, depending on your user shell:
$ . ${LOCALBASE}/db/SetEnv.sh
% source ${LOCALBASE}/db/SetEnv.csh
Description of the command line options is shown further below.

ENVIRONMENT

CC Set this to the C compiler used.
Default value: mgcc, gcc (probed), cc (last resort)
DISTDIR Path to store downloaded cpio-balls (and tarballs and
other distfiles).
Default value: ${PORTSDIR}/Distfiles
INFOPATH Prepended in SetEnv with ${LOCALBASE}/info.
LD_LIBRARY_PATH Prepended in SetEnv with ${LOCALBASE}/lib.
MANPATH Prepended in SetEnv with ${LOCALBASE}/man.
Default value:
${LOCALBASE}/man:/usr/local/man:/usr/share/man:/usr/X11R6/man
MKSH Alternative location of mksh(1) binary to use for in-
stallation, hard-code into make(1), and several other
places, including, but not limited to, packages. This
must be a single file which does not need to exist. If
it does not exist, the mksh(1) built is installed there.
The directory it is located in, however, must exist.
Default value: /bin/mksh
Suggested value: ${LOCALBASE}/bin/mksh
NROFF Full command line prefix of nroff(1) binary or
equivalent. If unset, MirOS nrcon (from AT&T UNIX nroff)
is used if found.
Default value: /usr/bin/env nroff -Tascii
Suggested value for operating systems with GNU groff:
/path/to/nroff -c -Tlatin1
Some operating systems with GNU groff can also use:
/path/to/nroff -c -Tutf8
OPENNT_ROOT If set, Interix operating system type is assumed.
OVERRIDE_MKSH Used only internally for bootstrapping on Interix.
PATH_WINDOWS Included in modified PATH variable in SetEnv scripts.
This is usually set by the Interix /etc/profile.
PERL5LIB Prepended in SetEnv with
${LOCALBASE}/libdata/perl5{,/site_perl}.
SFUDIR If set, Interix operating system type is assumed.
SHELL The user's default shell. Used as a candidate during
search for mksh(1). This can be the C Shell, too.
UPGRADE Set this to "no" to prevent an mksh(1) found but too old
from being overwritten. Unsupported, deprecated.
fetch If set, the command line prefix of the fetch programme
to use. Defaults to Weihenstephan's GNU wget on Interix,
any wget(1), ftp(1), or fetch(1) programme found in
$localbase/bin (see below), /usr/mpkg/bin,
/usr/local/bin, /bin, or /usr/bin else. This must in-
clude the argument to name the output, i.e. -O (for
wget), and -o otherwise.
localbase Setting this environment variable has almost the same
functionality as the -l option, however, it is being
used much earlier in the process, such as PATH manipula-
tion during mksh(1) build, and divining a fetch utility
(see above). This option is almost unsupported, and you
ought to use the -l option as well if you employ setting
this variable. If you set these two to different values,
you have lost.
xfbase This does for -X what localbase does for -l. The same
warnings apply.

PARAMETERS

-D Enable debugging mode. This calls the Korn shell instal-
lation script with mksh -x. Also, temporary files are
not removed on exit.
-Esysconfdir Set the SYSCONFDIR variable to its argument.
Default: /etc-e This is the same as -E ${LOCALBASE}/etc.
-i Used internally for bootstrapping on Interix only.
-llocalbase Set the LOCALBASE variable to its argument.
Default: /usr/mpkg-N Semi-Upgrade Mode. Do not install any software (if the
system has already been set up correctly before), only
rewrite the configuration files. Use with care. Better
don't use (see CAVEATS below).
-T Use the locally checked out version of the package tools
for bootstrapping, instead of downloading a distfile and
using it. Note this might break things horridly and
hard-codes a specific version number. This is, however,
used by MirOS native MirPorts "make setup" command, so
that users of a fresh MirOS BSD + MirPorts installation
can install binary packages without having to download
anything. This does not prevent MirMake from being down-
loaded even on MirOS if it's not recent enough, and is
only intended for current snapshots.
-Uuser[:group] Use its arguments as BINOWN and BINGRP to determine de-
fault ownership of files being installed.
Default: root:bin
-u This is the same as calling -U with your current UID and
GID as parameters. This option is the default behaviour
on Interix, and necessary to use the MirPorts Framework
as non-root user (together with -e or similar).
Note that this may not be enough to work on Interix,
since domain users don't work, and spaces aren't allowed
in user or group names. You can try calling Setup.sh
with -U and the numeric uid and gid, separated by a
colon (':'), if you encounter chown or chgrp problems.
-Xxfbase Set the X11BASE to its argument.
Default: ${LOCALBASE}/X11 if found, /usr/X11R6 else.
mirror Set this to the MirOS Distribution Server mirror you'd
like to use for retrieving files installed during the
first-time set-up process.
If this starts with a "/", it is interpreted as an abso-
lute pathname of a directory containing the needed
cpio-balls, else, it is read as an HTTP (or FTP) URI and
used in conjunction with the ${fetch} programme.
Default: http://www.mirbsd.org/MirOS/dist/

FILES

/bin/mksh Default location of mksh(1) to use.
This file is overwritten if it's too old,
and the MKSH environment variable is not
set.
/etc/make.cfg System-wide make(1) configuration, usually
included if found.
/etc/mk.conf Legacy system-wide configuration, included
if found. Useful on OpenBSD.
${LOCALBASE}/db/SetEnv.csh Sourcing this csh(1) script sets up the
necessary environment for building and in-
stalling packages using the MirPorts
Framework, and running the installed
binaries.
Running Setup.sh overwrites this file.
${LOCALBASE}/db/SetEnv.make This make(1) script contains the same de-
finitions as the two shell SetEnv scripts,
to the extent duplicating them in the Mir-
Make variable space makes sense. Also,
some variables have different names here.
Running Setup.sh overwrites this file.
${LOCALBASE}/db/SetEnv.sh This Bourne Shell script is the equivalent
of SetEnv.csh for sh(1).
Running Setup.sh overwrites this file.
${LOCALBASE}/db/mmake.cfg Contains installation-wide (as opposed to
system-wide) configuration for building
MirPorts packages.
This script is generated by Setup.sh but
never overwritten.
${LOCALBASE}/db/pkg/ This directory contains the package data-
base.
${LOCALBASE}/db/shareddirs.db This file keeps a list of all directories
created using pkg_add(1) during package
installation, and their reference count.
${PORTSDIR}/Distfiles/ This directory will be used by Setup.sh as
well as the MirPorts Framework to store
all distfiles retrieved during installa-
tion and package builds, if not overridden
by DISTDIR.

INSTALLED SOFTWARE

During the first-time set-up process, Setup.sh installs various software
packages in your system. All of these (except mksh(1) in the standard
configuration) will be located under LOCALBASE.
You should not re-run Setup.sh to upgrade these pieces of software; in-
stead, use pkg_update(1).

MKSH

Port location: shells/mksh
The MirBSD Korn Shell is always installed if it's not found or too old.
Currently, at least R31 (2007/08/19) is required. A manual page is at-
tempted to be installed into /usr/share/man/cat1/ or /usr/share/man/man1/
but failure is not deemed important. For a properly installed mksh
honouring default COPTS, CFLAGS etc. use the port.

MIRMAKE

Port location: devel/mirmake
The MirOS version of make(1) is installed if the system make(1) is no
MirMake or too old. If a recent version of MirMake is already found on
the system or in ${LOCALBASE}/bin, no action is taken, or a wrapper is
put into ${LOCALBASE}/bin/mmake so that a user can install <bsd.port.mk>
himself.

NROFF

Port location: none yet
If no /usr/bin/nroff or ${LOCALBASE}/bin/nroff is found (usually the case
only on Interix), the MirOS version of AT&T UNIX nroff(1) is installed.
Note that this check is currently only tested on Interix, and that, since
MirMake is a dependency to build nroff, bootstrapping can fail on non-
Interix systems without either nroff, ditroff or GNU groff installed.

MTREE

Port location: none yet
If mtree(8) is not being found at /usr/sbin/mtree or within
${LOCALBASE}/bin, this programme is installed.

CPIO

Port location: archivers/mircpio
On Darwin (Mac OSX), Interix and MidnightBSD, paxmirabilis aka MirCpio is
installed because the native archivers lack functionality. This programme
and all following are actually already installed using a MirPort during
set up time, too.

PATCH

Port location: essentials/patch
Interix does not come with patch(1). MidnightBSD's is broken.

CKSUM

Port location: essentials/cksum
This port is needed on Darwin, Interix and MidnightBSD, and optional on
OpenBSD, to verify file checksums.

GNU TEXINFO

Port location: essentials/texinfo
This is being pulled in as a build dependency of m4 and wget on Interix.

GNU M4

Port location: lang/m4
GNU m4(1) is installed early on Interix and MidnightBSD because autoconf
depends on it.

GNU WGET

Port location: net/wget
On Interix, there is no really suitable fetch utility, so this beast is
being built. It pulls in metaauto, autoconf-new (2.60 and up) and
help2man.

DIAGNOSTICS

Most error messages are displayed on stderr, some on stdout. Error mes-
sages from external utilities are usually retained.
The bourne shell script Setup.sh usually aborts in error cases, but
leaves a temporary directory, whose name is printed to stderr directly
after startup. You must delete it manually.
The korn shell script called later cleans up (unless -D is given) the
temporary directory created by Setup.sh in cases of errors and should
abort on all errors and corner cases.

AUTHORS

Setup.sh was written by Thorsten Glaser <tg@mirbsd.de>. The MirPorts
Framework is maintained by <miros-discuss@MirBSD.org>. The package tools
have been taken over from FreeBSD and OpenBSD and are now maintained by
Benny Siegert <bsiegert@mirbsd.org>.

CAVEATS

Be careful with passing environment variables to Setup.sh (even if they
are automatically set).
Running Setup.sh more than once overwrites some files and doesn't touch
some others. You must check them manually in any case. For upgrading, you
should use package tools upgrades whenever possible - this is only a
bootstrapping tool.
For many tools, upgrade them using packages even after bootstrapping, be-
cause ports/packages honour ${CC}, ${CFLAGS} and stuff like that. Also,
on Interix, mksh and MirMake are usually built without any manual pages
being installed during bootstrapping.
When installing the MirPorts Framework without sudo, i.e. using the -u or
-U options to Setup.sh, some applications may misbehave or introduce po-
tential security risks by using set-uid or set-gid bits on executables,
handling them only properly if suid-root or sgid-wheel though. If possi-
ble, avoid installing MirPorts as regular user.

BUGS

Probably many. Report them to <miros-discuss@mirbsd.org>. There are so
many possible scenarios and corner cases, as well as incompatibilities,
so that some breakage might always occur.
On Interix, mtree(8) does not come with the base system. It is being used
by Setup.sh before it's built, though.
On non-Interix systems without nroff, ditroff or GNU groff, the detection
whether to build nroff and re-build MirMake afterwards is not done, and
stuff might break.
When giving -ul but omitting -e, the SYSCONFDIR is still /etc, although
that is not writable.
MirPorts Framework May 29, 2014 5