remaster/src/func/chroot_is_mounted

26 lines
504 B
Bash
Executable File

#!/bin/bash
#remaster lib
[ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; }
#chroot_is_mounted [chroot_dir]
#(Boolean)-> true | false
function chroot_is_mounted() {
#$1 = chroot directory
#get state of _remaster from lxc
STATE=`lxc-ls _remaster_ -f -F STATE | tail -n 1 | sed 's/ //g'`
if [ "#$STATE#" == "#STOPPED#" ] ; then
#nothing running
echo "false"
else
#container is running
echo "true"
fi
}
#this func is standalone executable
[ -n "$1" ] && {
chroot_is_mounted $@
}