This commit is contained in:
fro
2025-10-28 12:47:26 -05:00
parent 61c1c39222
commit fbfe090d2c

View File

@@ -20,20 +20,27 @@ cd /tmp
# 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
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(.*)(?=")')
# construct download url # ask for user input
download_url="https://github.com/PostgREST/postgrest/releases/download/${latest_version}/postgrest-${latest_version}-linux-static-x86-64.tar.xz" echo 'install postgrest {$latest_version}? [y/n]'
read -n1 user_input
# download the file if [[ ${user_input} == "y" ]]; then
wget -O postgrest.tar.xz ${download_url}
# extract the executable # construct download url
tar -xJf *.xz download_url="https://github.com/PostgREST/postgrest/releases/download/${latest_version}/postgrest-${latest_version}-linux-static-x86-64.tar.xz"
# move executable to correct directory # download the file
mv postgrest /usr/local/bin wget -O postgrest.tar.xz ${download_url}
# extract the executable
tar -xJf *.xz
# move executable to correct directory
mv postgrest /usr/local/bin
fi
# create /etc/postgrest
if ! [ -d "/etc/postgrest" ] if ! [ -d "/etc/postgrest" ]
then then
@@ -42,6 +49,7 @@ then
fi fi
# add config
if ! [ -f "/etc/postgrest/config" ] if ! [ -f "/etc/postgrest/config" ]
then then
@@ -49,8 +57,8 @@ then
cp config /etc/postgrest/ cp config /etc/postgrest/
echo "*************************************************************" echo "*********************************************************************"
echo "* please add proper login data to '/etc/postgrest/config' ! *" echo "* please, populate '/etc/postgrest/config' with proper login data ! *"
echo "*************************************************************" echo "*********************************************************************"
fi fi