| 
 | 1 | +#!/bin/bash  | 
 | 2 | + | 
 | 3 | +# Script to replace PostgreSQL with OrioleDB in specific lines only  | 
 | 4 | +# Usage: ./replace_postgresql.sh [postgres_src_directory]  | 
 | 5 | + | 
 | 6 | +PROG_NAME="$(basename $0)"  | 
 | 7 | +BIN_DIR="$(cd $(dirname $0) && pwd)"  | 
 | 8 | +SRC_DIR="$(cd ${BIN_DIR}/../src && pwd)"  | 
 | 9 | +POSTGRES_DIR="${SRC_DIR}/postgres"  | 
 | 10 | +PACKAGE_NAME="oriolepg-17.11"  | 
 | 11 | + | 
 | 12 | +echo "locate $SRC_DIR"  | 
 | 13 | + | 
 | 14 | + | 
 | 15 | +echo "extract $SRC_DIR/postgres.tar.gz"  | 
 | 16 | +cd ${SRC_DIR}  | 
 | 17 | +rm -rf postgres  | 
 | 18 | +tar -xf postgres.tar.gz  | 
 | 19 | +cd postgres  | 
 | 20 | +git checkout patches17_11  | 
 | 21 | + | 
 | 22 | + | 
 | 23 | +echo "Replacing PostgreSQL with OrioleDB in specific lines in $POSTGRES_DIR"  | 
 | 24 | + | 
 | 25 | +# Replace in configure - only in PG_VERSION_STR line  | 
 | 26 | +if [ -f "$POSTGRES_DIR/configure" ]; then  | 
 | 27 | +    sed -i '' '/PG_VERSION_STR/s/PostgreSQL/OrioleDB/g' "$POSTGRES_DIR/configure"  | 
 | 28 | +    echo "Updated configure (PG_VERSION_STR line)"  | 
 | 29 | +else  | 
 | 30 | +    echo "Warning: configure not found"  | 
 | 31 | +fi  | 
 | 32 | + | 
 | 33 | +# Replace in configure.ac - only in line containing "PostgreSQL $PG_VERSION on"  | 
 | 34 | +if [ -f "$POSTGRES_DIR/configure.ac" ]; then  | 
 | 35 | +    sed -i '' '/PostgreSQL \$PG_VERSION on/s/PostgreSQL/OrioleDB/g' "$POSTGRES_DIR/configure.ac"  | 
 | 36 | +    echo "Updated configure.ac (PostgreSQL \$PG_VERSION on line)"  | 
 | 37 | +else  | 
 | 38 | +    echo "Warning: configure.ac not found"  | 
 | 39 | +fi  | 
 | 40 | + | 
 | 41 | +# Replace in meson.build - only in lines containing "PostgreSQL @0@"  | 
 | 42 | +if [ -f "$POSTGRES_DIR/meson.build" ]; then  | 
 | 43 | +    sed -i '' '/PostgreSQL @0@ on/s/PostgreSQL/OrioleDB/g' "$POSTGRES_DIR/meson.build"  | 
 | 44 | +    echo "Updated meson.build (PostgreSQL @0@ lines)"  | 
 | 45 | +else  | 
 | 46 | +    echo "Warning: meson.build not found"  | 
 | 47 | +fi  | 
 | 48 | + | 
 | 49 | +echo "Replacement complete!"  | 
 | 50 | + | 
 | 51 | + | 
 | 52 | +echo "Check OrioleDB String!"  | 
 | 53 | +grep OrioleDB  ${POSTGRES_DIR}/configure  | 
 | 54 | +grep OrioleDB  ${POSTGRES_DIR}/configure.ac  | 
 | 55 | +grep OrioleDB  ${POSTGRES_DIR}/meson.build  | 
 | 56 | + | 
 | 57 | + | 
 | 58 | +echo package ${PACKAGE_NAME}  | 
 | 59 | +rm -rf ${POSTGRES_DIR}/.git  | 
 | 60 | +mv ${POSTGRES_DIR} ${SRC_DIR}/${PACKAGE_NAME}  | 
 | 61 | + | 
 | 62 | +cd ${SRC_DIR}  | 
 | 63 | +gtar -czf ${PACKAGE_NAME}.tar.gz ${PACKAGE_NAME}  | 
 | 64 | +rm -rf ${PACKAGE_NAME}  | 
0 commit comments