Fixes and Enhancements:
* Enabled daily_checkpoint.sh operate on edge servers, to
keep /p4/N/offline_db current on those hosts for site-local
recovery w/o requiring a site-local replica (though having
a site-local replica can still be useful).
* Disabled live_checkpoint.sh for edge servers.
* More fully support topologies using edge severs, in both
geographically distributed and horizaontal scaling "wokspace
server" solutions.
* Fix broken EDGESERVER value definition.
* Modified name of SDP counter that gets set when a checkpoint is taken
to incorporate ServerID, so now the counter name will look like
lastSDPCheckpoint.master.1, or lastSDPCheckpoint.p4d_edge_sfo, rather
than just lastSDPCheckpoint.

There will be multiple such counters in a topology that uses edge
servers, and/or which takes checkpoints on replicas.

* Added comments for all functions.

For the master server, journalPrefix remains:
/p4/N/checkpoints/p4_N

The /p4/N/checkpoints is reserved for writing by the
master/commit server only.

Here, ShortServerID is just the ServerID with the 'p4d_' prefix
trimmed, since it is redundant in this context. See mkrep.sh,
which enshines a ServerID (server spec) naming standard, with
values like 'p4d_fr_bos' (forwarding replica in Boston) and
p4d_edge_blr (Edge server in Bangalore). So the journalPrefix
for the p4d_edge_bos replica would be:
/p4/N/checkpoints.edge_bos/p4_N.edge_bos

For "standby" (aka journalcopy) replicas, journalPrefix is set
to /p4/N/journals.rep. which is written to the $LOGS volume, due
to the nature of standby replicas using journalPrefix to write
active server logs to pre-rotated journals.

Some take-away to be updated in docs:
* The /p4/N/checkpoints folder must be reserved for checkpoints that
originate on the master. It should be safe to rsync this folder
(with --delete if desired) to any replica or edge server. This is
consistent with the current SDP.
* I want to change 'journals.rep' to 'checkpoints.<ShortServerID>'
for non-standby replicas, to ensure that checkpoints and journals
taken on those hosts are written to a volume where they are backed
up.
* In sites with multiple edge serves, some sharing achive files
('workspace servers'), multiple edge servers will share the same
SAN. So we one checkpoints dir per ServerID, and we want that
dir to be on the /hxdepots volume.

Note that the journalPrefix for replicas was a fixed /p4/N/journals.rep.
This was on the /hxlogs volume - a presumably fast-for-writes volume,
but typically NOT backed up and not very large. This change puts it
under /p4/N/checkpoints.* for edge servers and non-standby replicas,
but ensures other replica types and edge servers can generate
checkpoints to a location that is backed up and has plenty of storage
capacity. For standby replicas only (which cannot be filtered),
the journalPrefix remains /p4/N/journals.rep on the /hxlogs volume.

Merged two changes initiated on main down to:
Change @22826 by robert_cowham: Ignore some files on Mac.
Change @22950 by awkan/ttyler: Provide an override for difference
between proxy listening port and target port

Pull the configuration items out into mkdirs.cfg and source that file
in mkdirs.sh. Makes it a little cleaner, and less likely for someone
to mess up the mkdirs.sh script. Also preps for potential future
configure_sdp.sh script to ask questions and create the mkdirs.cfg file.

Changed CASEINSENSITIVE to CASE_SENSITIVE, to make it harder to
pick the wrong value by miscalculating the double-negative.

Changed the default to be case-sensitive, for several reasons:
* Case-sensitive is better for git interoperability. Most git repos
in the wild, especially those used in corporate environments, are
case sensitive.
* Case-sensitive is better for importing from most legacy SCM systems,
as it can handle a wider array of data sets.
* Case-sensitive is required for some data sets that have case-only
variants.
* The SDP now includes a case check trigger to help avoid the worst
perils of a case-sensitive server.
* While confusion is always possible if the client OS doesn't match
the case sensitivty setting of the server, the least harmful
permuatations of problems occur with the widest array of client
platforms when you have a case-senstive server.
* Case-insensitive is really only best suited to pure-Windows sites.

Also added a comment indicating you don't need the Review daemon if
you intend to handle review-style email notifications with Swarm.

Change the SDP so that root and offline_db can be on different volumes and still accomplish
a fast database recovery using recreate_db_checkpoint.sh and recreate_db_sync_replica.sh.
This is done by switching the links now rather than moving the db files.

Added CN=$DD and changed all $DD/p4/common entries to $CN/p4/common in
order to allow you to install an instance on a different depotdata
volume than the 1st instance. Before this change, doing that would
incorrectly create a common folder on the 2nd depotdata volume.

Also removed the lines that copy the binaries from an existing
/p4/common/bin folder back to the SDP. It is perfectly acceptable
to install another instance that is using a newer version than
the existing instance.

Per discussion: s/checkpoints.rep/journals.rep/g
This directory name changed, used in the journalPrefix configurable, is
intended to clarify that the should be targeted to for a FAST volume
for use with journalcopy, rather than the LARGE volume as would be
implied when using a directory with "checkpoints" in the name.

Improved edge & daisy chained replica support in instance_vars.template.
Changed so P4MASTER is set dynamically, based on how/whether the
P4TARGET of the current ServerID is set.

This also eliminates a possible discrepancey beteween P4MASTER
as defined in the p4_N.vars/mkdirs.sh and the master hostname as
defined in P4TARGET configurables. The value defined with
P4TARGET must also work with SSH keys. (As a best practice
P4TARGET should be a host alias so that it doesn't need to be
changed in case of failvoer of your P4TARGET server).

Changed so SHAREDDATA is set dynamically, based on how/whether the
lbr.replication of the current ServerID is set. If it is unset,
set to none, ondemand, or cache, then SHAREDDATA is set to TRUE,
otherwise FALSE.

Dynamic queries use 'p4d -cset' so they work regardless of
whether the p4d process is up or not.

Some internal refactoring was necessary to ensure all variables
are set before they are used.

This involved a minor tweak to mkdirs.sh to remove the
now-unnecessary 'sed' for SHAREDDATA when generating p4_N.vars
from the template. SHAREDDATA must still be configured in
mkdirs.sh because it can be run before a replica is fully
configured.

Goals:
* Simplfy SDP configuration for complex topologies by eliminating
configuration external to p4d where possible/practical.
* Reduce chances for discrepancies and errors as topologies
evolve over time.
* Allow the p4_1.vars file to identical on all hosts in the
topology, an HMS requirement.

Moved password and users into the config directory to allow for instance specific
users and passwords. Ran into a case where two different teams were sharing the same
server hardware and needed this type of differentiation. Surprised that we haven't hit
this sooner.

Also defaulted mkdirs to use the numeric ports since this is the most common
installation.

If creating a replica that shares depot files with master, don't do chown/chmod on the depot files as this can take a significant time when migrating existing Helix servers into the SDP; In addition, issue 'warning' message that chown/chmod could take some time to complete so user is aware of processing being carried out

Tweaks to mkdirs.sh:
* Replaced ADMINEMAIL with MAILTO and MAILFROM settings. This
allows MAILTO to be a distribution list or a comma-delimited
list of email addresses, while MAILFROM must always be exactly
one email address.
* Added quotes to allow handling of adresses like '#P4AdminTeam,"
where the '#' character designates a distribution list.

Enhanced p4_vars.template to support operating on an SDP-managed
host where no p4d process runs, such as a p4p (proxy) host, where
no /p4/n/root/server.id file exists. The $SERVERID value will
be empty (but defined) in this case.

Enhanced to better support operating with replicas that share
/depotdata with their master servers, by making P4TRUST and
P4TICKETS values contain $SERVERID.

Moved SHAREDDATA from p4_vars to instance_vars, since it is not
inherently a global setting. In sophisticated enterprise
environments, it can vary on a per-replica basis. Adjusted
mkdirs.sh accordingly.

Removed hard-coded /p4 path for server.id file location. This fixes "-test" mode so server.id file is written to the correct location. Without this it is written to /p4 where there could be an installation with the same instance ID. In that case the server.id file could get overwritten with different data. If there is not an existing instance an error message would be displayed. Now neither of these should occur :-)
Also fixed some typos.

Normalized P4INSTANCE to SDP_INSTANCE to get Unix/Windows
implementations in sync.

Reasons:
1. Things that interact with SDP in both Unix and Windows
environments shoudn't have to account for this obscure
SDP difference between Unix and Windows. (I came across
this doing CBD work).

2. The Windows and Unix scripts have different variable
names for defining the same concept, the SDP instance.
Unix uses P4INSTANCE, while Windows uses SDP_INSTANCE.

3. This instance tag, a data set identifier, is an SDP concept.
I prefer the SDP_INSTANCE name over P4INSTANCE, so I prpose
to normalize to SDP_INSTANCE.

4. The P4INSTANCE name makes it look like a setting that might be
recognized by the p4d itself, which it is not. (There are other
such things such as P4SERVER that could perhaps be renamed as
a separate task; but I'm not sure we want to totally disallow
the P4 prefix for variable names. It looks too right to be wrong
in same cases, like P4BIN and P4DBIN. That's a discussion for
another day, outside the scope of this task).

Meanwhile:
* Fixed a bug in the Windows 2013.3 upgrade script that
was referencing undefined P4INSTANCE, as the Windows
environment defined only SDP_INSTANCE.

* Had P4INSTANCE been removed completely, this change would
likely cause trouble for users doing updates for existing
SDP installations. So, though it involves slight technical debt,
I opted to keep a redundant definition of P4INSTANCE
in p4_vars.template, with comments indicating SDP_INSTANCE should be
used in favor of P4INSTANCE, with a warning that P4INSTANCE
may go away in a future release. This should avoid unnecessary
upgrade pain.

* In mkdirs.sh, the varialbe name was INSTANCE rather than
SDP_INSTANCE. I changed that as well. That required manual
change rather than sub/replace to avoid corrupting other similar
varialbe names (e.g. MASTERINSTANCE).

This is a trivial change technically (a substitute/replace, plus
tweaks in p4_vars.template), but impacts many files.

Modified P4BROKERPORTNUM to just be the port number and added P4BROKERPORT to instance_vars
to be consistent with P4PORT. Also makes it easier to modify p4review.py to use P4BROKERPORT
rather than P4PORT for the subject line when needed.

Had to move the cfg directory to the metadata volume and link it under the instance
directory to provide the proper separation in a shared volume environment. The
instance specific vars cannot be in a shared directory since they need to be different
on each node using the shared volume.

Since the files moved back to the instance directory, I changed the names back to:
instance_vars
p4review.cfg
to keep things simple.

Also moved p4_vars.template to SDP/Server/Unix/p4/common/cfg so that it doesn't get
copied to the /p4/common/bin folder. Plus, it makes more sense for it to be in that
directory in the SDP structure.

Initial work to simplify p4_vars and remove cluster stuff.
Testing of named instances surfaced some bugs that are in prod sdp,
now fixed in dev.

Added three triggers from RCJ SDP

Moved p4review.cfg into the new /p4/common/cfg to go along with the
instance_vars files. mkdirs.sh now generates an instance_p4review.cfg
as well.

Removed incremental p4verify to clean up a bit. It didn't support replicas
and was really never used.

All port settings now live in <instance>_vars file. You set what you want
the ports to be in mkdirs.sh. There is no more fancy logic to try to guess
what the port should be. You set it, and that is what it is.

Remaining to do is to updated scripts to not need p4master_run. Saved
that work for later since this is tested and works.