File tree 1 file changed +36
-9
lines changed
1 file changed +36
-9
lines changed Original file line number Diff line number Diff line change 1
1
#! /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
4
33
5
34
# Clone the repository
6
35
git clone https://github.com/gavinwahl/postgres-json-schema/
7
36
8
- apk add libpq-dev
9
37
# Move into the directory
10
38
cd postgres-json-schema
11
39
12
40
# Build the extension
13
- make & make install
14
-
15
-
16
- apk add postgresql-client
41
+ make && make install
17
42
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'
19
45
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