Reported by:

r2py@cs.cmu.edu

Date:

Thu May 18 16:17:38 PDT 1995

Description

The initdb script complains about "UID: read-only variable" This occurs in certain shell variants such as bash.

Fix

Apply this patch. It also includes an error message re-wording fix.

diff -c -r1.3 initdb.sh
*** 1.3	1995/05/02 01:33:29
--- initdb.sh	1995/05/18 23:09:50
***************
*** 68,74 ****
  if [ ! -f $TEMPLATE -o ! -f $GLOBAL ]
  then
      echo "$CMDNAME: error: database initialization files not found."
!     echo "$CMDNAME: either bmake install has not been run or you're trying to"
      echo "$CMDNAME: run this program on a machine that does not store the"
      echo "$CMDNAME: database (PGHOST doesn't work for this)."
      exit 1
--- 68,74 ----
  if [ ! -f $TEMPLATE -o ! -f $GLOBAL ]
  then
      echo "$CMDNAME: error: database initialization files not found."
!     echo "$CMDNAME: either gmake install has not been run or you're trying to"
      echo "$CMDNAME: run this program on a machine that does not store the"
      echo "$CMDNAME: database (PGHOST doesn't work for this)."
      exit 1
***************
*** 84,92 ****
  # Figure out who I am...
  #
  
! UID=`pg_id`
  
! if test $UID -eq 0
  then
      echo "$CMDNAME: do not install POSTGRES as root"
      exit 1
--- 84,92 ----
  # Figure out who I am...
  #
  
! PG_UID=`pg_id`
  
! if test $PG_UID -eq 0
  then
      echo "$CMDNAME: do not install POSTGRES as root"
      exit 1
***************
*** 144,150 ****
  #
  
  echo "open pg_database" > /tmp/create.$$
! echo "insert (template1 $UID template1)" >> /tmp/create.$$
  echo "show" >> /tmp/create.$$
  echo "close pg_database" >> /tmp/create.$$
  
--- 144,150 ----
  #
  
  echo "open pg_database" > /tmp/create.$$
! echo "insert (template1 $PG_UID template1)" >> /tmp/create.$$
  echo "show" >> /tmp/create.$$
  echo "close pg_database" >> /tmp/create.$$