| Server IP : 54.233.248.239 / Your IP : 172.28.1.13 Web Server : Apache System : Linux ip-172-28-29-189 6.5.0-1014-aws #14~22.04.1-Ubuntu SMP Thu Feb 15 15:27:06 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.2.34-43+ubuntu22.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /snap/lxd/24061/bin/ |
Upload File : |
#!/bin/sh
run_cmd() {
CMD="$1"
shift
unset LD_LIBRARY_PATH
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
export HOME="${SNAP_REAL_HOME}"
export USER="${USERNAME}"
[ -z "${XDG_DATA_HOME:-}" ] && export XDG_DATA_HOME="${HOME}/.local/share/"
[ -z "${XDG_CONFIG_HOME:-}" ] && export XDG_CONFIG_HOME="${HOME}/.config/"
[ -z "${XDG_STATE_HOME:-}" ] && export XDG_STATE_HOME="${HOME}/.local/state/"
# shellcheck disable=SC2145
exec unshare --kill-child -U -m -p -r -f -R "/var/lib/snapd/hostfs/" "/bin/sh" -c "mount -t proc proc /proc 2>/dev/null || true; exec \"${CMD}\" \"$@\""
}
find_and_spawn() {
for path in / /usr/ /usr/local/; do
if [ -e "/var/lib/snapd/hostfs/${path}bin/${1}" ] || [ -L "/var/lib/snapd/hostfs/${path}bin/${1}" ]; then
run_cmd "$@"
fi
done
}
EDIT_CMD="${1}"
EDIT_PATH="${2}"
if [ -z "${EDIT_PATH}" ] || [ "$#" -ge "3" ]; then
EDIT_CMD=""
for arg in "${@}"; do
EDIT_PATH="${arg}"
done
fi
# Try running the editor through the host.
if [ -n "${EDIT_CMD}" ]; then
exec 9< /tmp/
EDIT_PATH_HOST="$(echo "${EDIT_PATH}" | sed "s#/tmp/#/proc/self/fd/9/#g")"
find_and_spawn "${EDIT_CMD}" "${EDIT_PATH_HOST}"
fi
# Default to built-in nano.
if [ -z "${EDIT_CMD}" ]; then
EDIT_CMD="nano"
fi
# Setup for VIM.
if [ "$EDIT_CMD" != "nano" ]; then
if [ -e "${SNAP_USER_COMMON}/.vimrc" ]; then
export VIMINIT="source ${SNAP_USER_COMMON}/.vimrc"
else
export VIMINIT="source ${SNAP}/etc/vimrc"
fi
EDIT_CMD="vim.tiny"
fi
# Run the editor.
exec "${EDIT_CMD}" "${EDIT_PATH}"