# --------------------------------------------------------------------
# $Source: /usr/local/7Rq/package/cur/main-2010.11.26/sbin/RCS/INSTALL._m4,v $
# $Date: 2012/01/30 00:22:06 $ GMT    $Revision: 1.14 $
# --------------------------------------------------------------------

Dependencies
============
The installer uses bash, and make.

Basic Installation
==================

The 'setup' script will untar all the script packages below the
the top level install directory specified by the -i switch.  It
also sets up symbolic links to scripts in a 'commands' directory
under the install directory, that you may add to your PATH.

Installation Names
==================

There is no suggested default install directory.  If you do not
pass '-i INSTALL_DIR' to 'setup', then the install is to a temp
dir below /tmp.

Example Work Steps for Install
==============================
You may cut and paste the suggested shell commandline snips
that follow, one line at a time.  None of the environmental
variables defined will be needed after the install is done.

Untar uqjau.tar.gz in any temp directory.
"cd" to the uqjau sub dir created.

  cd uqjau

Decide on install dir for uqjau tools, 
and set env var INSTALL_DIR accordingly:

  INSTALL_DIR=~/utils/local/uqjau
    # Adjust to the install pathname you want.  Perhaps below
    # /usr/local, if you want to share uqjau tools with others.
    # The dirname for INSTALL_DIR does not have to be 'uqjau'.

  mkdir -vp $INSTALL_DIR

  # More nuanced approach:
  install -o OWNERHERE -g GROUPHERE -m 775 -d $INSTALL_DIR; ls -ld $INSTALL_DIR

  # -------------------------------------------------------------------- 
  # Install uqjau tools
  # -------------------------------------------------------------------- 
  
  ./setup -i $INSTALL_DIR


-- All done. --

# ==================================================================== 
# uqjau tests, try these commands:
# ==================================================================== 

# Ensure $INSTALL_DIR/commands/cur is in your PATH for this shell session.

  PATH=$PATH:$INSTALL_DIR/commands/cur

# Define a couple of temporary env vars to make typing easier:
  _c=$INSTALL_DIR/scommands/cur   _p=$INSTALL_DIR/package/cur

# try:

  _ls -v | less  # synopsis of most scripts and bash functions

  _txt /etc/passwd  ## count UNIX and DOS lines separately

  find /etc -type f 2>/dev/null |$_c/ls_tsid_filter |sort -r -k1,1 |less
    # sort a dir tree by timestamp

  $_c/jobmon -L ~/toss_now -t -m 'date|tr' a-z A-Z
    # wrapper for logging "jobs" - either scripts or 1 line shell commands

  $_c/tsid.pl
    # A base36 timestamp.

  nap2 7:15am next thursday  # ^C this to kill sleep

# ==================================================================== 
# -- optional, but suggested --
# Configure uqjau tools ( As non root user. )
# ==================================================================== 

Some of the uqjau scripts need environmental variables:
_29eloc, _29team, _29lg to be set at script startup by reading
.../main/etc/dirdefs.  

  less $INSTALL_DIR/package/*/main/etc/dirdefs
    # Comments explain _29eloc, _29team, _29lg environmental variables.

If you install the scripts under your HOME dir, I suggest you do not
use the literal text: $HOME or ~ in 'dirdefs' config file pathnames,
since users other than you with a different value for $HOME (perhaps
'root') may be using the uqjau scripts you have installed.

In your current shell session run commands
like these, to set wanted values for _29eloc, _29team, 
and _29lg (hints, you may use or edit to your needs):

  eval _29eloc=\~$(id -un)/_utils/etc/local       
    # If you have root permissions you might use: _29eloc=/etc/local

  _29team=$_29eloc/team/myteam
    # Swap in better name than "myteam".  Settings worth sharing with others.
    #
    # If you have the iBASHrc aliases and functions setup then
    # you should already have env var '_t' defined, so use that pathname:
    #   _29team=$_t

  eval _29lg=\~$(id -un)/_utils/var/local/team/${_29team##*/}/log
    # above sets _29lg parent dirname equal to $(dirname $_29team)

In .../main/etc/dirdefs there is a suggested auto derived value for
_29lg, that you may enable by uncommenting.

--
Now setup 'dirdefs' config file:

  cd $INSTALL_DIR/package/cur/main/etc

  # Paste in the next 4 lines, to get hint for dirdefs edits:
  echo "
    _29eloc=$_29eloc
    _29team=$_29team
    _29lg=$_29lg"  ##

  true;${EDITOR:-vim} $INSTALL_DIR/package/cur/main/etc/dirdefs
    # use hint from above echo output to drive your edits 

Review your edits and adjust dirdefs file if needed:

  egrep '^ *_29' $INSTALL_DIR/package/*/main/etc/dirdefs

Create the corresponding directories:

  # If root permissions not required
      eval "$(egrep '^ *_29' $INSTALL_DIR/package/*/main/etc/dirdefs)" ##
      true;(set -xu;mkdir -vp $_29eloc $_29team $_29lg) ##

  # If root required, as user root:
      eval "$(egrep '^ *_29' $INSTALL_DIR/package/*/main/etc/dirdefs)" ##
      install_owner=FILLIN install_group=FILLIN
      newdirs="$_29eloc $_29team $_29lg"; echo newdirs: $newdirs
      true;(set -xu;install -d -m 775 -o $install_owner -g $install_group $newdirs && ls -ld $newdirs) ##

#-- Mop up/ update a dependent file:

  # as non root:

  cd $INSTALL_DIR/package/cur/main/etc && rm -f dirdefs.perl
  PATH="$INSTALL_DIR/commands/cur:$PATH" make dirdefs.perl
    # dirdefs.perl depends on the dirdefs you just edited

# ==================================================================== 
# - optional -
# Consider installing "iBASHrc" - a set of GPL'd scripts to customize your
# bash login shell w/aliases, functions, and env vars; many of
# these are "general", a few support uqjau tools.
# ==================================================================== 

  true;[[ -d ~/tmp ]] && cd ~/tmp || cd /tmp;wget http://trodman.com/pub/iBASHrc.tar.gz
    # follow it's INSTALL and README

