Use absolute PATH for btrfs command

* Because command -v fail in some cases
This commit is contained in:
Victor LABORIE 2018-07-04 14:48:33 +02:00
parent 1b3b68ba16
commit 958eeb8776

11
bkctld
View file

@ -252,7 +252,7 @@ sub_init() {
rootdir_inode=$(stat --format=%i "${rootdir}")
jaildir_inode=$(stat --format=%i "${JAILDIR}")
if [ "${rootdir_inode}" -eq 256 ] || [ "${jaildir_inode}" -eq 256 ]; then
"${BTRFS}" subvolume create "${JAILDIR}/${jail}"
/sbin/btrfs subvolume create "${JAILDIR}/${jail}"
else
mkdir -p "${JAILDIR}/${jail}"
fi
@ -284,7 +284,7 @@ sub_remove() {
rm -f "${CONFDIR}/${jail}"
jail_inode=$(stat --format=%i "${JAILDIR}/${jail}")
if [ "${jail_inode}" -eq 256 ]; then
"${BTRFS}" subvolume delete "${JAILDIR}/${jail}" | debug
/sbin/btrfs subvolume delete "${JAILDIR}/${jail}" | debug
else
rm -rf "${JAILDIR}/${jail}" | debug
fi
@ -293,7 +293,7 @@ sub_remove() {
for inc in ${incs}; do
inc_inode=$(stat --format=%i "${INCDIR}/${jail}/${inc}")
if [ "${inc_inode}" -eq 256 ]; then
"${BTRFS}" subvolume delete "${INCDIR}/${jail}/${inc}" | debug
/sbin/btrfs subvolume delete "${INCDIR}/${jail}/${inc}" | debug
else
warning "You need to purge ${INCDIR}/${jail}/${inc} manually !"
fi
@ -417,7 +417,7 @@ sub_inc() {
start=$(date +"%H:%M:%S")
jail_inode=$(stat --format=%i "${JAILDIR}/${jail}")
if [ "$jail_inode" -eq 256 ]; then
"${BTRFS}" subvolume snapshot -r "${JAILDIR}/${jail}" "${inc}" | debug
/sbin/btrfs subvolume snapshot -r "${JAILDIR}/${jail}" "${inc}" | debug
else
cp -alx "${JAILDIR}/${jail}/" "${inc}" | debug
fi
@ -457,7 +457,7 @@ sub_rm() {
start=$(date +"%H:%M:%S")
inc_inode=$(stat --format=%i "${INCDIR}/${jail}/${j}")
if [ "${inc_inode}" -eq 256 ]; then
"${BTRFS}" subvolume delete "${INCDIR}/${jail}/${j}" | debug
/sbin/btrfs subvolume delete "${INCDIR}/${jail}/${j}" | debug
else
cd "${INCDIR}/${jail}"
rsync -a --delete "${empty}/" "${j}/"
@ -562,7 +562,6 @@ main() {
LOGLEVEL="${LOGLEVEL:-6}"
CRITICAL="${CRITICAL:-48}"
WARNING="${WARNING:-24}"
BTRFS=$(command -v btrfs)
DUC=$(command -v duc-nox||command -v duc)
mkdir -p "${CONFDIR}" "${JAILDIR}" "${INCDIR}" "${INDEX_DIR}"
subcommand="${1:-}"