remaster/src/func/chroot_is_mounted
2018-05-11 00:06:48 +02:00

26 lignes
504 B
Bash
Fichiers exécutables

#!/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 $@
}