mirror of
https://github.com/dchakro/brewlog.git
synced 2026-05-17 10:12:16 -07:00
brewlog is installed in the same place as homebrew
commit34f328de59Author: robocopAlpha <35454738+robocopAlpha@users.noreply.github.com> Date: Tue Aug 4 13:55:02 2020 +0300 Update install.sh Fix checking if the installation location is writable or not To ensure that "brewlog" is in the same path as "brew" commit6296379a55Author: robocopAlpha <35454738+robocopAlpha@users.noreply.github.com> Date: Tue Aug 4 13:50:33 2020 +0300 change order of checking shopt nocasematch commit6889284f6bAuthor: robocopAlpha <35454738+robocopAlpha@users.noreply.github.com> Date: Tue Aug 4 13:48:20 2020 +0300 Installs in the same place as homebrew commitf67e850575Author: robocopAlpha <35454738+robocopAlpha@users.noreply.github.com> Date: Tue Aug 4 13:37:25 2020 +0300 Trying to install to the same place as homebrew
This commit is contained in:
parent
92eb1a4e6d
commit
96456cef6e
1 changed files with 22 additions and 10 deletions
32
install.sh
32
install.sh
|
|
@ -1,26 +1,38 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
if [ -w /usr/local/bin ]; then
|
BREWLOCATION=$(command -v brew)
|
||||||
curl -sSL 'https://raw.githubusercontent.com/robocopAlpha/brewlog/master/brewlog.sh' > /usr/local/bin/brewlog
|
if [ "$?" -ne "0" ]; then
|
||||||
chmod +x /usr/local/bin/brewlog
|
echo "Homebrew/Linux brew installation not detected in your PATH."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
BREWLOCATION=$(dirname "$BREWLOCATION")
|
||||||
|
echo "Determined installation location: $BREWLOCATION/brewlog"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -w $BREWLOCATION ]; then
|
||||||
|
curl -sSL 'https://raw.githubusercontent.com/robocopAlpha/brewlog/master/brewlog.sh' > $BREWLOCATION/brewlog
|
||||||
|
chmod +x $BREWLOCATION/brewlog
|
||||||
|
printf "
|
||||||
|
brewlog has been installed as $(command -v brewlog).
|
||||||
|
You can start with brewlog --help %s\n"
|
||||||
else
|
else
|
||||||
curl -sSL 'https://raw.githubusercontent.com/robocopAlpha/brewlog/master/brewlog.sh' >| brewlog.sh
|
|
||||||
echo "user $(whoami) cannot write to /usr/local/bin."
|
|
||||||
read -r -p "use sudo (y/N): " choice
|
|
||||||
shopt -q nocasematch;
|
shopt -q nocasematch;
|
||||||
if [ "$?" -eq "1" ]; then
|
if [ "$?" -eq "1" ]; then
|
||||||
shopt -s nocasematch
|
shopt -s nocasematch
|
||||||
flag=1
|
flag=1
|
||||||
fi
|
fi
|
||||||
|
curl -sSL 'https://raw.githubusercontent.com/robocopAlpha/brewlog/master/brewlog.sh' >| brewlog.sh
|
||||||
|
echo "user $(whoami) cannot write to $BREWLOCATION"
|
||||||
|
read -r -p "use sudo (y/N): " choice
|
||||||
if [[ "$choice" =~ ^(yes|y)$ ]]
|
if [[ "$choice" =~ ^(yes|y)$ ]]
|
||||||
then
|
then
|
||||||
sudo mv brewlog.sh /usr/local/bin/brewlog
|
sudo mv brewlog.sh $BREWLOCATION/brewlog
|
||||||
sudo chmod +x /usr/local/bin/brewlog
|
sudo chmod +x $BREWLOCATION/brewlog
|
||||||
sudo -k
|
sudo -k
|
||||||
else
|
else
|
||||||
echo "cannot install /usr/local/bin/brewlog without sudo rights"
|
echo "cannot install $BREWLOCATION/brewlog without sudo rights"
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
if [ "$flag" -eq "1" ]; then
|
if [ "$flag" -eq "1" ]; then
|
||||||
shopt -s nocasematch
|
shopt -s nocasematch
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue