Replace /bin/ed with /bin/sed.
authorTatsuo Ishii <ishii@postgresql.org>
Fri, 22 Dec 2017 06:20:13 +0000 (15:20 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Fri, 22 Dec 2017 06:20:13 +0000 (15:20 +0900)
This change requires less packages in order to install pgpool_setup,
because /bin/sed is included in most distribution's base packages,
while //bin/ed is not.

src/test/pgpool_setup

index d4e06e4c7ae9fab2263a01b0112961b7b194717d..a08dcdc7e729a6d09f5d472de12c87e7043bc8e6 100755 (executable)
@@ -153,12 +153,10 @@ EOF
 #-------------------------------------------
 # replace some variables in the script
 #-------------------------------------------
-/bin/ed $FAILOVER_SCRIPT <<EOF
-/__MYDIR__/s@__MYDIR__@$BASEDIR@
-/__PGBIN__/s@__PGBIN__@$PGBIN@
-w
-q
-EOF
+/bin/sed -i \
+        -e "/__MYDIR__/s@__MYDIR__@$BASEDIR@" \
+        -e "/__PGBIN__/s@__PGBIN__@$PGBIN@" \
+        $FAILOVER_SCRIPT
 
 chmod 755 $FAILOVER_SCRIPT
 }
@@ -220,14 +218,12 @@ EOF
 # replace some variables in the script
 #-------------------------------------------
 
-/bin/ed $FOLLOW_MASTER_SCRIPT <<EOF
-/__MYDIR__/s@__MYDIR__@$BASEDIR@
-/__PGBIN__/s@__PGBIN__@$PGBIN@
-/__PCPPASSFILE__/s@__PCPPASSFILE__@$PCP_PASS_FILE@
-/__PCPPORT__/s/__PCPPORT__/$PCP_PORT/
-w
-q
-EOF
+/bin/sed -i \
+        -e "/__MYDIR__/s@__MYDIR__@$BASEDIR@" \
+        -e "/__PGBIN__/s@__PGBIN__@$PGBIN@" \
+        -e "/__PCPPASSFILE__/s@__PCPPASSFILE__@$PCP_PASS_FILE@" \
+        -e "/__PCPPORT__/s/__PCPPORT__/$PCP_PORT/" \
+       $FOLLOW_MASTER_SCRIPT
 
 chmod 755 $FOLLOW_MASTER_SCRIPT
 }
@@ -259,14 +255,11 @@ EOF
 #-------------------------------------------
 # replace some variables in the script
 #-------------------------------------------
-/bin/ed $1/$PGPOOL_REMOTE_START_SCRIPT <<EOF
-/__PGBIN__/s@__PGBIN__@$PGBIN@
-w
-q
-EOF
+/bin/sed -i \
+       -e "/__PGBIN__/s@__PGBIN__@$PGBIN@" \
+       $1/$PGPOOL_REMOTE_START_SCRIPT
 
 chmod 755 $1/$PGPOOL_REMOTE_START_SCRIPT
-
 }
 
 #-------------------------------------------
@@ -357,16 +350,13 @@ EOF
 #-------------------------------------------
 # replace some variables in the script
 #-------------------------------------------
-/bin/ed $1/$SCRIPT <<EOF
-/__PGBIN__/s@__PGBIN__@$PGBIN@
-/__DATADIR_BASE__/s@__DATADIR_BASE__@$BASEDIR@
-/__PGSUPERUSER__/s/__PGSUPERUSER__/$WHOAMI/
-w
-q
-EOF
+/bin/sed -i \
+       -e "/__PGBIN__/s@__PGBIN__@$PGBIN@" \
+       -e "/__DATADIR_BASE__/s@__DATADIR_BASE__@$BASEDIR@" \
+       -e "/__PGSUPERUSER__/s/__PGSUPERUSER__/$WHOAMI/" \
+$1/$SCRIPT
 
 chmod 755 $1/$SCRIPT
-
 }
 
 #-------------------------------------------
@@ -412,17 +402,14 @@ EOF
 #-------------------------------------------
 # replace some variables in the script
 #-------------------------------------------
-/bin/ed $1/$SCRIPT <<EOF
-/__PGBIN__/s@__PGBIN__@$PGBIN@
-/__DATADIR_BASE__/s@__DATADIR_BASE__@$BASEDIR@
-/__PGSUPERUSER__/s/__PGSUPERUSER__/$WHOAMI/
-/__ARCHDIR__/s@__ARCHDIR__@$BASEDIR/archivedir@p
-w
-q
-EOF
+/bin/sed -i \
+       -e "/__PGBIN__/s@__PGBIN__@$PGBIN@" \
+       -e "/__DATADIR_BASE__/s@__DATADIR_BASE__@$BASEDIR@" \
+       -e "/__PGSUPERUSER__/s/__PGSUPERUSER__/$WHOAMI/" \
+       -e "/__ARCHDIR__/s@__ARCHDIR__@$BASEDIR/archivedir@" \
+       $1/$SCRIPT
 
 chmod 755 $1/$SCRIPT
-
 }
 
 #-------------------------------------------
@@ -458,17 +445,14 @@ EOF
 #-------------------------------------------
 # replace some variables in the script
 #-------------------------------------------
-/bin/ed $1/$SCRIPT <<EOF
-/__PGBIN__/s@__PGBIN__@$PGBIN@p
-/__DATADIR_BASE__/s@__DATADIR_BASE__@$BASEDIR@p
-/__PGSUPERUSER__/s/__PGSUPERUSER__/$WHOAMI/p
-/__ARCHDIR__/s@__ARCHDIR__@$BASEDIR/archivedir@p
-w
-q
-EOF
+/bin/sed -i \
+       -e "/__PGBIN__/s@__PGBIN__@$PGBIN@p" \
+       -e "/__DATADIR_BASE__/s@__DATADIR_BASE__@$BASEDIR@" \
+       -e "/__PGSUPERUSER__/s/__PGSUPERUSER__/$WHOAMI/" \
+       -e "/__ARCHDIR__/s@__ARCHDIR__@$BASEDIR/archivedir@" \
+       $1/$SCRIPT
 
 chmod 755 $1/$SCRIPT
-
 }
 
 #-------------------------------------------