%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/lxd/current/commands/
Upload File :
Create Path :
Current File : //snap/lxd/current/commands/lxc

#!/bin/sh
set -eu

# Re-exec outside of apparmor confinement
if [ -d /sys/kernel/security/apparmor ] && [ "$(cat /proc/self/attr/current)" != "unconfined" ]; then
    exec aa-exec -p unconfined -- "$0" "$@"
fi

# Check if native and snap installed
pid=$(ss -nlpx src "/var/lib/lxd/unix.socket" 2>/dev/null | grep "/var/lib/lxd/unix.socket" | sed -e "s/.*pid=//" -e "s/,.*//g")
if [ "${pid}" -gt 0 ] 2>/dev/null; then
    echo "Error: Both native and snap packages are installed on this system"
    echo "       Run \"lxd.migrate\" to complete your migration to the snap package"
    exit 1
fi

# Migrate data if needed
if [ -n "${HOME:-}" ] && [ ! -d "${HOME}/.config/lxc" ]; then
    mkdir -p "${HOME}/.config"
    if [ -n "${USER:-}" ] && [ -d "/home/${USER}/.config/lxc" ]; then
        cp -r "/home/${USER}/.config/lxc" "${HOME}/.config/lxc" || true
    elif [ "${USER:-}" = "root" ] && [ -d "/root/.config/lxc" ]; then
        cp -r "/root/.config/lxc" "${HOME}/.config/lxc" || true
    fi
fi

# Set the environment
export LXD_DIR=${LXD_DIR:-"${SNAP_COMMON}/lxd/"}

if [ "${EDITOR:-}" != "nano" ]; then
    export EDITOR=vim.tiny
    export VIMINIT="source ${SNAP}/etc/vimrc"
fi
export VISUAL=${EDITOR:-}

# Reset all locales as it isn't available in the snap (#29)
LANG=C.UTF-8
export LC_ALL=C.UTF-8

LXC="lxc"
if [ -x "${SNAP_COMMON}/lxc.debug" ]; then
    LXC="${SNAP_COMMON}/lxc.debug"
fi

# Run lxc itself
exec "${LXC}" "$@"

Zerion Mini Shell 1.0