chroot-manager: fixing machinectl not killing/stopping machines properly
This commit is contained in:
parent
ca0980c416
commit
f4bb73c858
|
@ -22,7 +22,7 @@ X_PORT=10
|
||||||
|
|
||||||
|
|
||||||
function _prompt_chroot_env() {
|
function _prompt_chroot_env() {
|
||||||
target=`\ls -1 -d ./*/ | fzf --prompt "${1}"`
|
target=$(\ls -1 -d ./*/ | fzf --prompt "${1}")
|
||||||
target=`sed 's|\.\/||g' <<< ${target}`
|
target=`sed 's|\.\/||g' <<< ${target}`
|
||||||
chroot_env="${CHROOT_FOLDERS_PATH}/${target}"
|
chroot_env="${CHROOT_FOLDERS_PATH}/${target}"
|
||||||
echo "${chroot_env}"
|
echo "${chroot_env}"
|
||||||
|
@ -481,39 +481,21 @@ function load_chroot_sysd() {
|
||||||
function poweroff_chroot_sysd() {
|
function poweroff_chroot_sysd() {
|
||||||
cd "${CHROOT_FOLDERS_PATH}"
|
cd "${CHROOT_FOLDERS_PATH}"
|
||||||
|
|
||||||
chroot_env=$(_get_chroot_env " " "Poweroff SysD Chroot Venv:")
|
target=$(sudo machinectl list | awk '{print $1}' | head -n -2 | tail -n +2 | fzf --prompt "Stop:")
|
||||||
parentdir="$(dirname "${chroot_env}")"
|
|
||||||
target=$(basename "${chroot_env}")
|
|
||||||
target=`echo "${target}" | sed "s|/||g"`
|
|
||||||
|
|
||||||
if [[ -d "${chroot_env}" && "${parentdir}" == "${CHROOT_FOLDERS_PATH}" ]]; then
|
|
||||||
clear
|
clear
|
||||||
echo "Stopping: ${target}"
|
echo "Stopping: ${target}"
|
||||||
sudo machinectl poweroff "${target}"
|
sudo machinectl poweroff "${target}"
|
||||||
clear
|
echo -e "Powered off Chroot Env: ${target}"
|
||||||
echo -e "Powered off Chroot Env: ${target}\nPath: ${chroot_env}"
|
|
||||||
else
|
|
||||||
echo -e "Path: ${chroot_env}\nis not a child path of\nParent: ${CHROOT_FOLDERS_PATH}"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function kill_chroot_sysd() {
|
function kill_chroot_sysd() {
|
||||||
cd "${CHROOT_FOLDERS_PATH}"
|
cd "${CHROOT_FOLDERS_PATH}"
|
||||||
|
|
||||||
chroot_env=$(_get_chroot_env " " "Kill SysD Chroot Venv:")
|
target=$(sudo machinectl list | awk '{print $1}' | head -n -2 | tail -n +2 | fzf --prompt "Kill:")
|
||||||
parentdir="$(dirname "${chroot_env}")"
|
|
||||||
target=$(basename "${chroot_env}")
|
|
||||||
target=`echo "${target}" | sed "s|/||g"`
|
|
||||||
|
|
||||||
if [[ -d "${chroot_env}" && "${parentdir}" == "${CHROOT_FOLDERS_PATH}" ]]; then
|
|
||||||
clear
|
clear
|
||||||
echo "Killing: ${target}"
|
echo "Killing: ${target}"
|
||||||
sudo machinectl kill "${target}"
|
sudo machinectl kill "${target}"
|
||||||
clear
|
echo -e "Killed Chroot Env: ${target}"
|
||||||
echo -e "Killed Chroot Env: ${target}\nPath: ${chroot_env}"
|
|
||||||
else
|
|
||||||
echo -e "Path: ${chroot_env}\nis not a child path of\nParent: ${CHROOT_FOLDERS_PATH}"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _bind_mounts() {
|
function _bind_mounts() {
|
||||||
|
|
Loading…
Reference in New Issue