mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
mktemp protects against attacks from other users. mktemp protects against concurrent writers. mktemp respects the $TMPDIR environment variable. Suggested-by: check-all-the-things
23 lines
520 B
Bash
Executable file
23 lines
520 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
make_install() {
|
|
if [ -n "$PREFIX" ]
|
|
then
|
|
PREFIX="$PREFIX" make install
|
|
else
|
|
sudo make install
|
|
fi
|
|
}
|
|
|
|
dir=$(mktemp -t -d git-extras-install.XXXXXXXXXX) \
|
|
&& cd "$dir" \
|
|
&& echo "Setting up 'git-extras'...." \
|
|
&& git clone https://github.com/tj/git-extras.git &> /dev/null \
|
|
&& cd git-extras \
|
|
&& git checkout \
|
|
$(git describe --tags $(git rev-list --tags --max-count=1)) \
|
|
&> /dev/null \
|
|
&& make_install \
|
|
&& rm -rf "$dir"
|
|
|