13 lines
459 B
Bash
13 lines
459 B
Bash
#!/usr/bin/env bash
|
|
# 在要使用宿主机执行命令时引入该脚本
|
|
# 示例
|
|
# # shellcheck disable=SC1091
|
|
# if [[ -d "/host/proc/1/" ]]; then source /apps/gitrce/hook/nsenter.sh "$0"; fi
|
|
|
|
_script_path_this=$(realpath "$(ps -p $$ -o args= 2>/dev/null | awk '{print $2}')")
|
|
_latter="${_script_path_this#/apps/data}"
|
|
_absolute_path="${APPS_DATA}$_latter"
|
|
|
|
nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net /usr/bin/bash "$_absolute_path"
|
|
exit
|