mirror of
https://github.com/dchakro/brewlog.git
synced 2026-05-17 10:12:16 -07:00
Trying to install to the same place as homebrew
This commit is contained in:
parent
cc0096fd34
commit
f67e850575
1 changed files with 15 additions and 6 deletions
21
install.sh
21
install.sh
|
|
@ -1,10 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
BREWLOCATION=$(command -v brew)
|
||||||
|
echo "$BREWLOCATION/brewlog"
|
||||||
|
if [ "$?" -ne "0" ]; then
|
||||||
|
echo "Homebrew/Linux brew installation not detected in your PATH."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
BREWLOCATION= $(dirname "$BREWLOCATION")
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -w /usr/local/bin ]; then
|
if [ -w /usr/local/bin ]; then
|
||||||
curl -sSL 'https://raw.githubusercontent.com/robocopAlpha/brewlog/master/brewlog.sh' > /usr/local/bin/brewlog
|
curl -sSL 'https://raw.githubusercontent.com/robocopAlpha/brewlog/master/brewlog.sh' > $BREWLOCATION/brewlog
|
||||||
chmod +x /usr/local/bin/brewlog
|
chmod +x $BREWLOCATION/brewlog
|
||||||
else
|
else
|
||||||
curl -sSL 'https://raw.githubusercontent.com/robocopAlpha/brewlog/master/brewlog.sh' >| brewlog.sh
|
curl -sSL 'https://raw.githubusercontent.com/robocopAlpha/brewlog/master/brewlog.sh' >| brewlog.sh
|
||||||
echo "user $(whoami) cannot write to /usr/local/bin."
|
echo "user $(whoami) cannot write to $BREWLOCATION"
|
||||||
read -r -p "use sudo (y/N): " choice
|
read -r -p "use sudo (y/N): " choice
|
||||||
shopt -q nocasematch;
|
shopt -q nocasematch;
|
||||||
if [ "$?" -eq "1" ]; then
|
if [ "$?" -eq "1" ]; then
|
||||||
|
|
@ -13,11 +22,11 @@ else
|
||||||
fi
|
fi
|
||||||
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue