/usr/bin/linuxbrew is in linuxbrew-wrapper 20150804-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | #!/bin/sh
# Linuxbrew wrapper for Debian Package
#
# if detected linuxbrew instance at ${LINUXBREW_PREFIX}/.linuxbrew
# run command, using existing brew
# else
# install linuxbrew, then run command
# end
#
# This script should be able to work outside of the Debian package.
#
# Copyright: 2015 Lumin <cdluminate@gmail.com>
# License: BSD-2-Clause
set -e
# --- [ Check/Sync Environment ] ---
# here I use LINUXBREW_PREFIX as the major ENV,
# and HOMEBREW_PREFIX is for compatibility.
if [ -z ${LINUXBREW_PREFIX} ] && [ -z ${HOMEBREW_PREFIX}]; then
# when both ENV are not set, use default.
export LINUXBREW_PREFIX="${HOME}/.linuxbrew"
export HOMEBREW_PREFIX=${LINUXBREW_PREFIX}
elif [ -z ${HOMEBREW_PREFIX} ];then
# LINUXBREW_PREFIX is set.
export HOMEBREW_PREFIX=${LINUXBREW_PREFIX}
elif [ -z ${LINUXBREW_PREFIX} ];then
# HOMEBREW_PREFIX is set.
export LINUXBREW_PREFIX=${HOMEBREW_PREFIX}
else #[ ! -z ${LINUXBREW_PREFIX} ] && [ ! -z ${HOMEBREW_PREFIX}]
# both ENV are set (even if they are conflicting to each other),
# then we use LINUXBREW_PREFIX. And export nothing
true
fi
export BREW_EXEC="${LINUXBREW_PREFIX}/bin/brew" # real brew executable
export BREW_INSTALL="/usr/lib/linuxbrew-wrapper/install" # local linuxbrew install script
# upstream install script
export ORIGIN_INSTALL="https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install"
first_time_hint () {
printf "
========================================================================
You may want to update following environments after installed linuxbrew.
PATH, MANPATH, INFOPATH
(example: /usr/share/doc/linuxbrew-wrapper/examples/profile)
========================================================================
"
}
# root ?
if [ `whoami` = "root" ]; then
# well, the upstream install script will stop when detected root.
# However, not stopping users who created linuxbrew for root user.
printf "W: be careful as root.\n"
fi
# ruby ?
if [ ! -x $(which ruby) ]; then
printf "E: ruby interpreter not available, abort.\n"
false
fi
# If there is brew instance available, just run it.
if [ -x ${BREW_EXEC} ]; then
exec ${BREW_EXEC} $@
elif [ -d ${LINUXBREW_PREFIX} ]; then
printf "E: Linuxbrew directory detected, but it seems to be broken.\n"
printf " Try to remove '${LINUXBREW_PREFIX}' and try again.\n"
false
fi
# if it comes here, we first need to pull the linuxbrew with git.
if [ -r ${BREW_INSTALL} ]; then
first_time_hint # print hint at first
ruby ${BREW_INSTALL} # install first
exec ${BREW_EXEC} $@
else
printf "I: Trying to download linuxbrew install script ...\n"
first_time_hint # print hint at first
ruby -e "$(curl -fsSL ${ORIGIN_INSTALL})"
exec ${BREW_EXEC} $@
fi
|