Skip to content
Merged
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
67 changes: 33 additions & 34 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,40 @@ elif test -d /usr -a ! -w /usr; then
SUDO="sudo"
fi

_is_ci() {
[ -n "$CI" ] && [ $CI != 0 ]
}

_install_pre_reqs() {
if _is_ci; then
apt() {
# we should use apt-get not apt in CI
# weird shit ref: https://askubuntu.com/a/668859
export DEBIAN_FRONTEND=noninteractive
cmd=$1
shift
$SUDO apt-get $cmd -qq -o=Dpkg::Use-Pty=0 $@
}
else
echo "ensure you have the `pkgx` pre-requisites installed:" >&2
apt() {
case "$1" in
update)
echo >&2
;;
install)
echo " apt-get" "$@" >&2
;;
esac
}
yum() {
echo " yum" "$@" >&2
}
pacman() {
echo " pacman" "$@" >&2
}
fi

if test -f /etc/debian_version; then
apt update --yes

Expand Down Expand Up @@ -45,10 +78,6 @@ _install_pre_reqs() {
fi
}

_is_ci() {
[ -n "$CI" ] && [ $CI != 0 ]
}

_install_pkgx() {
if _is_ci; then
progress="--no-progress-meter"
Expand Down Expand Up @@ -123,36 +152,6 @@ elif [ $# -eq 0 ]; then
echo "$(pkgx --version) already installed" >&2
fi

if _is_ci; then
apt() {
# we should use apt-get not apt in CI
# weird shit ref: https://askubuntu.com/a/668859
export DEBIAN_FRONTEND=noninteractive
cmd=$1
shift
$SUDO apt-get $cmd -qq -o=Dpkg::Use-Pty=0 $@
}
else
apt() {
case "$1" in
update)
echo "ensure you have the `pkgx` pre-requisites installed:" >&2
echo >&2
;;
install)
echo " apt-get" "$@" >&2
;;
esac
}
yum() {
echo " yum" "$@" >&2
}
pacman() {
echo " pacman" "$@" >&2
}
unset SUDO
fi

_install_pre_reqs

if [ $# -gt 0 ]; then
Expand Down
Loading