Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update install_postgres_json_schema_extension.sh #33

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 36 additions & 9 deletions install_postgres_json_schema_extension.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,47 @@
#!/bin/bash
apk add --update make
apk add --update git

# Detect the operating system
if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$NAME
else
OS=$(uname -s)
fi

# Function to install packages on Alpine
install_alpine() {
apk add --update $@
}

# Function to install packages on Ubuntu
install_ubuntu() {
apt-get update
apt-get install -y $@
}

# Install packages based on the detected OS
if [[ "$OS" == *"Alpine"* ]]; then
echo "Detected Alpine Linux"
install_alpine make git libpq-dev postgresql-client
elif [[ "$OS" == *"Ubuntu"* ]]; then
echo "Detected Ubuntu"
install_ubuntu make git libpq-dev postgresql-client
else
echo "Unsupported operating system: $OS"
exit 1
fi

# Clone the repository
git clone https://github.com/gavinwahl/postgres-json-schema/

apk add libpq-dev
# Move into the directory
cd postgres-json-schema

# Build the extension
make & make install


apk add postgresql-client
make && make install

/bin/mkdir -p '/usr/local/share/postgresql/extension'
# Create the extension directory if it doesn't exist
mkdir -p '/usr/local/share/postgresql/extension'

chmod 666 /usr/local/share/postgresql/extension/postgres-json-schema.control
# Set appropriate permissions for the control file
chmod 644 /usr/local/share/postgresql/extension/postgres-json-schema.control
Loading