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

Add support for non-default XDG user dir in an install script for the Linux #767

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
14 changes: 9 additions & 5 deletions install/linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/rbreaves/kinto/master/install/linux.sh)"

wget https://github.com/rbreaves/kinto/archive/refs/heads/master.zip -O ~/Downloads/kinto.zip || curl https://github.com/rbreaves/kinto/archive/refs/heads/master.zip -J -L -o ~/Downloads/kinto.zip
unzip ~/Downloads/kinto.zip -d ~/Downloads/
cd ~/Downloads/kinto-master/
# Find a download directory dynamically to support non-default XDG user dir.
# In case the `xdg-user-dir` is not installed, fallback to the hardcoded path
DOWNLOADS_DIR=$(xdg-user-dir DOWNLOAD || echo "${HOME}/Downloads")

wget https://github.com/rbreaves/kinto/archive/refs/heads/master.zip -O ${DOWNLOADS_DIR}/kinto.zip || curl https://github.com/rbreaves/kinto/archive/refs/heads/master.zip -J -L -o ${DOWNLOADS_DIR}/kinto.zip
unzip ${DOWNLOADS_DIR}/kinto.zip -d ${DOWNLOADS_DIR}/
cd ${DOWNLOADS_DIR}/kinto-master/

kintorelease=`wget -qO- https://api.github.com/repos/rbreaves/kinto/releases/latest | awk -F'tag_name": ' '{if ($2) print $2}' | tr -d \", || curl -s https://api.github.com/repos/rbreaves/kinto/releases/latest | awk -F'tag_name": ' '{if ($2) print $2}' | tr -d \",`
kintohash=`unzip -z ~/Downloads/kinto.zip | tail -n1`
kintohash=`unzip -z ${DOWNLOADS_DIR}/kinto.zip | tail -n1`
kintoshort=${kintohash::7}

echo "$kintorelease" "build" "$kintoshort" > ./dl_version
Expand All @@ -18,4 +22,4 @@ if [ $# -eq 0 ];then
elif [ $1 == "-r" ];then
echo "Uninstall Kinto..."
./setup.py -r
fi
fi