Detect lxc containers

This commit is contained in:
Sonny 2018-09-30 13:50:45 +02:00
parent fda37efc28
commit ddae640f77
2 changed files with 10 additions and 6 deletions

View file

@ -4,15 +4,19 @@ export SYSTEMD_EDITOR="/usr/bin/vim"
export PAGER=less
export BROWSER=/usr/bin/firefox
CONTAINER_OR_VM=false
SSH_ENV="$HOME/.ssh/environment"
VM=false
if [ "$(grep hypervisor /proc/cpuinfo)" ]; then
VM=true
if [ -z "$(which systemd-detect-virt)" ] || [ "$(systemd-detect-virt)" != "none" ]; then
CONTAINER_OR_VM=true
fi
export VM
export CONTAINER_OR_VM
if [ ! -f $SSH_ENV ]; then
mkdir $HOME/.ssh && touch $HOME/.ssh/environment
fi
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
chmod 600 "${SSH_ENV}"