remaster/src/func/chroot_is_mounted

26 lines
504 B
Plaintext
Raw Normal View History

#!/bin/bash
#remaster lib
2018-05-07 00:56:46 +00:00
[ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; }
#chroot_is_mounted [chroot_dir]
#(Boolean)-> true | false
function chroot_is_mounted() {
#$1 = chroot directory
2018-05-10 13:12:06 +00:00
#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"
2018-05-10 13:12:06 +00:00
else
#container is running
echo "true"
fi
}
2018-05-10 15:13:19 +00:00
2018-05-10 22:04:02 +00:00
#this func is standalone executable
2018-05-10 15:13:19 +00:00
[ -n "$1" ] && {
2018-05-10 22:04:02 +00:00
chroot_is_mounted $@
2018-05-10 15:13:19 +00:00
}