File tree Expand file tree Collapse file tree 1 file changed +36
-9
lines changed
Expand file tree Collapse file tree 1 file changed +36
-9
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
2- apk add --update make
3- apk add --update git
2+
3+ # Detect the operating system
4+ if [ -f /etc/os-release ]; then
5+ . /etc/os-release
6+ OS=$NAME
7+ else
8+ OS=$( uname -s)
9+ fi
10+
11+ # Function to install packages on Alpine
12+ install_alpine () {
13+ apk add --update $@
14+ }
15+
16+ # Function to install packages on Ubuntu
17+ install_ubuntu () {
18+ apt-get update
19+ apt-get install -y $@
20+ }
21+
22+ # Install packages based on the detected OS
23+ if [[ " $OS " == * " Alpine" * ]]; then
24+ echo " Detected Alpine Linux"
25+ install_alpine make git libpq-dev postgresql-client
26+ elif [[ " $OS " == * " Ubuntu" * ]]; then
27+ echo " Detected Ubuntu"
28+ install_ubuntu make git libpq-dev postgresql-client
29+ else
30+ echo " Unsupported operating system: $OS "
31+ exit 1
32+ fi
433
534# Clone the repository
635git clone https://github.com/gavinwahl/postgres-json-schema/
736
8- apk add libpq-dev
937# Move into the directory
1038cd postgres-json-schema
1139
1240# Build the extension
13- make & make install
14-
15-
16- apk add postgresql-client
41+ make && make install
1742
18- /bin/mkdir -p ' /usr/local/share/postgresql/extension'
43+ # Create the extension directory if it doesn't exist
44+ mkdir -p ' /usr/local/share/postgresql/extension'
1945
20- chmod 666 /usr/local/share/postgresql/extension/postgres-json-schema.control
46+ # Set appropriate permissions for the control file
47+ chmod 644 /usr/local/share/postgresql/extension/postgres-json-schema.control
You can’t perform that action at this time.
0 commit comments