summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Vondra2017-08-21 12:13:01 +0000
committerTomas Vondra2017-08-21 12:54:32 +0000
commit99341c120d30eb7cc44eefa809d89d5127d36cd5 (patch)
treeca84ab41d5d4adad4f56ffb0ec1c0550ab7262db
parent4384f863c632c0b4bd3e680af6a02b086578a2a5 (diff)
Use sed instead of ex in make_signature script
The make_signature script was using ex, which is part of vi editor and seems to be less portable than sed, particularly when considering BSD systems (e.g. FreeBSD). It lacks some of the GNU/Linux improvements, causing failures of the script. We also do not check existence of the command in configure, so it may be missing entirely. Switching to sed fixes both those issues - it seems more portable, and we already check it's availability in configure. Patch contributed by John Schneider <[email protected]>, additional comments and input by Jov <[email protected]>.
-rwxr-xr-xcontrib/pgxc_ctl/make_signature43
1 files changed, 4 insertions, 39 deletions
diff --git a/contrib/pgxc_ctl/make_signature b/contrib/pgxc_ctl/make_signature
index 09990714a9..d395794bba 100755
--- a/contrib/pgxc_ctl/make_signature
+++ b/contrib/pgxc_ctl/make_signature
@@ -52,15 +52,7 @@ EOF
-cp pgxc_ctl_bash_2 pgxc_ctl_bash.c.wk
-ex pgxc_ctl_bash.c.wk <<EOF
-%s/"/\\\"/ge
-w
-%s/^\(.*\)$/"\1",/e
-%s/^"#ifdef XCP",$/#ifdef XCP/e
-%s/^"#endif",$/#endif/e
-wq
-EOF
+sed -e 's/"/\\\"/g; s/^/"/; s/$/",/; s/^"#ifdef XCP",/#ifdef XCP/; s/^"#endif",/#endif/' pgxc_ctl_bash_2 > pgxc_ctl_bash.c.wk
cat > pgxc_ctl_bash.c <<EOF
/*
@@ -108,16 +100,7 @@ EOF
rm pgxc_ctl_bash.c.wk
-cp pgxc_ctl_conf_part_full pgxc_ctl_conf_part.wk
-
-ex pgxc_ctl_conf_part.wk <<EOF
-%s/"/\\\"/ge
-w
-%s/^\(.*\)$/"\1",/e
-%s/^"#ifdef XCP",$/#ifdef XCP/e
-%s/^"#endif",$/#endif/e
-wq
-EOF
+sed -e 's/"/\\\"/g; s/^/"/; s/$/",/; s/^"#ifdef XCP",/#ifdef XCP/; s/^"#endif",/#endif/' pgxc_ctl_conf_part_full > pgxc_ctl_conf_part.wk
cat >> pgxc_ctl_bash.c <<EOF
/*
@@ -139,16 +122,7 @@ EOF
rm pgxc_ctl_conf_part.wk
-cp pgxc_ctl_conf_part_minimal pgxc_ctl_conf_part.wk
-
-ex pgxc_ctl_conf_part.wk <<EOF
-%s/"/\\\"/ge
-w
-%s/^\(.*\)$/"\1",/e
-%s/^"#ifdef XCP",$/#ifdef XCP/e
-%s/^"#endif",$/#endif/e
-wq
-EOF
+sed -e 's/"/\\\"/g; s/^/"/; s/$/",/; s/^"#ifdef XCP",/#ifdef XCP/; s/^"#endif",/#endif/' pgxc_ctl_conf_part_minimal > pgxc_ctl_conf_part.wk
cat >> pgxc_ctl_bash.c <<EOF
/*
@@ -170,16 +144,7 @@ EOF
rm pgxc_ctl_conf_part.wk
-cp pgxc_ctl_conf_part_empty pgxc_ctl_conf_empty.wk
-
-ex pgxc_ctl_conf_empty.wk <<EOF
-%s/"/\\\"/ge
-w
-%s/^\(.*\)$/"\1",/e
-%s/^"#ifdef XCP",$/#ifdef XCP/e
-%s/^"#endif",$/#endif/e
-wq
-EOF
+sed -e 's/"/\\\"/g; s/^/"/; s/$/",/; s/^"#ifdef XCP",/#ifdef XCP/; s/^"#endif",/#endif/' pgxc_ctl_conf_part_empty > pgxc_ctl_conf_empty.wk
cat >> pgxc_ctl_bash.c <<EOF
/*