Skip to content

Commit

Permalink
Fix install script for Docker envs
Browse files Browse the repository at this point in the history
  • Loading branch information
widgetii committed Mar 24, 2024
1 parent 3445060 commit 8de6b80
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ function detect_OS {
fi
}

function is_docker_container {
[ -e /.dockerenv ]
}

function check_connectivity {
case "$(curl -s --max-time 2 -I http://google.com | sed 's/^[^ ]* *\([0-9]\).*/\1/; 1q')" in
# HTTP connectivity is up"
Expand Down Expand Up @@ -325,7 +329,7 @@ function install_ccat {
function fix_term_for_root {
ROOTDIR="/root"
[[ "$OS" =~ Darwin ]] && ROOTDIR="/var/root"
sudo cp -rv $HOME/.terminfo $ROOTDIR
sudo cp -rv $HOME/.terminfo $ROOTDIR || true
}

if [[ "$USER" == "root" ]]; then
Expand All @@ -337,6 +341,12 @@ detect_OS
[[ ! -z "$SUDO_USER" ]] && USER=$SUDO_USER
echo "Detected OS: $OS, version: $VER, user: $USER"

if is_docker_container
then
echo "\$@" > /usr/local/bin/sudo
chmod +x /usr/local/bin/sudo
fi

[[ "$OS" == "Darwin" ]] || check_home_space

check_connectivity || {
Expand Down

0 comments on commit 8de6b80

Please sign in to comment.