This commit is contained in:
fro
2025-10-28 12:31:48 -05:00
parent 3ee48e5008
commit 25d2fabe4d

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# install postgrest / frode klevstul / oct 2025 # install or upgrade postgrest / frode klevstul / oct 2025
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -14,43 +14,41 @@ fi
# postgrest # postgrest
# --- # ---
# https://gist.github.com/steinwaywhw/a4cd19cda655b8249d908261a62687f8
#wget https://github.com/PostgREST/postgrest/releases/latest/download/postgrest-linux-amd64
#https://github.com/PostgREST/postgrest/releases/latest/download/postgrest-latest-linux-static-x86-64.tar.xz
#https://github.com/PostgREST/postgrest/releases/download/v14.0/postgrest-v14.0-linux-static-x86-64.tar.xz
#wget -qO- --max-redirect=10 https://github.com/PostgREST/postgrest/releases | grep -wo "https.*x86_64.deb\|https.*amd64.deb" | head -n 1 | xargs -I {} wget -O test.deb {}
cd /tmp cd /tmp
#curl -s https://api.github.com/repos/PostgREST/postgrest/releases/latest | sed 's/[()",{}]/ /g; s/ /\n/g' | grep "https.*releases/download*static*.*tar.xz" # fetch the latest release version
#curl -L -o dotenvx.tar.gz "https://github.com/dotenvx/dotenvx/releases/latest/download/dotenvx-$(uname -s)-$(uname -m).tar.gz"
#wget -qO- 'https://api.github.com/repos/<REPO>/releases/latest' | jq -r '.assets[] | select(.name | match("tar.(gz|xz)")) | .browser_download_url' | xargs wget -qO- | bsdtar -xf -
#wget -qO- 'https://api.github.com/repos/PostgREST/postgrest/releases/latest' | jq -r '.assets[] | select(.name | match("tar.(gz|xz)")) | .browser_download_url' | xargs wget -qO-
# src: https://gist.github.com/steinwaywhw/a4cd19cda655b8249d908261a62687f8?permalink_comment_id=5097031#gistcomment-5097031 # src: https://gist.github.com/steinwaywhw/a4cd19cda655b8249d908261a62687f8?permalink_comment_id=5097031#gistcomment-5097031
# Fetch the latest release version
latest_version=$(curl -s https://api.github.com/repos/PostgREST/postgrest/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")') latest_version=$(curl -s https://api.github.com/repos/PostgREST/postgrest/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')
# Remove the 'v' prefix from the version number # construct download url
#version=${latest_version#v}
# Construct the download URL
download_url="https://github.com/PostgREST/postgrest/releases/download/${latest_version}/postgrest-${latest_version}-linux-static-x86-64.tar.xz" download_url="https://github.com/PostgREST/postgrest/releases/download/${latest_version}/postgrest-${latest_version}-linux-static-x86-64.tar.xz"
# download the file
wget -O postgrest.tar.xz ${download_url} wget -O postgrest.tar.xz ${download_url}
# Download the tar.gz file # extract the executable
#curl -L -o "js-debug-dap-${version}.tar.gz" "$download_url" tar -xJf *.xz
# move executable to correct directory
mv postgrest /usr/local/bin
if ! [ -d "/etc/postgrest" ]
then
# make dir(s) if they do not exist
mkdir -p "/etc/postgrest"
fi
if ! [ -f "/etc/postgrest/config" ]
then
wget https://gt.op.fo/fro/srv-pub/raw/branch/trunk/cfg/pgr/config
cp config /etc/postgrest/
echo "please add proper login data to /etc/postgrest/config!"
fi