1
0
mirror of https://github.com/Zygo/bees.git synced 2025-05-17 21:35:45 +02:00

Add option to make mnt path shorter in logs

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
This commit is contained in:
Timofey Titovets 2016-11-28 08:23:50 +03:00
parent bf4e31ae71
commit 606d48acc1
2 changed files with 11 additions and 1 deletions

View File

@ -4,6 +4,7 @@
## Helpful functions ## Helpful functions
INFO(){ echo "INFO:" "$@"; } INFO(){ echo "INFO:" "$@"; }
ERRO(){ echo "ERROR:" "$@"; exit 1; } ERRO(){ echo "ERROR:" "$@"; exit 1; }
YN(){ [[ "$1" =~ (1|Y|y) ]]; }
## Global vars ## Global vars
export BEESHOME BEESSTATUS export BEESHOME BEESSTATUS
@ -48,6 +49,7 @@ MNT_DIR="${MNT_DIR:-$WORK_DIR/mnt/$UUID}"
BEESHOME="${BEESHOME:-$MNT_DIR/.beeshome}" BEESHOME="${BEESHOME:-$MNT_DIR/.beeshome}"
BEESSTATUS="${BEESSTATUS:-$WORK_DIR/$UUID.status}" BEESSTATUS="${BEESSTATUS:-$WORK_DIR/$UUID.status}"
DB_SIZE="${DB_SIZE:-$((64*AL16M))}" DB_SIZE="${DB_SIZE:-$((64*AL16M))}"
LOG_SHORT_PATH="${LOG_SHORT_PATH:-N}"
INFO "Check: BTRFS UUID exists" INFO "Check: BTRFS UUID exists"
if [ ! -d "/sys/fs/btrfs/$UUID" ]; then if [ ! -d "/sys/fs/btrfs/$UUID" ]; then
@ -95,5 +97,10 @@ fi
chmod 700 "$DB_PATH" chmod 700 "$DB_PATH"
} }
bees $MNT_DIR if YN "$LOG_SHORT_PATH"; then
cd "$MNT_DIR" || exit 1
bees .
else
bees "$MNT_DIR"
fi
exit 0 exit 0

View File

@ -12,6 +12,9 @@ UUID=5d3c0ad5-bedf-463d-8235-b4d4f6f99476
# BEESHOME="$MNT_DIR/.beeshome" # BEESHOME="$MNT_DIR/.beeshome"
# BEESSTATUS="$WORK_DIR/$UUID.status" # BEESSTATUS="$WORK_DIR/$UUID.status"
## Make path shorter in logs
# LOG_SHORT_PATH=N
## Bees DB size ## Bees DB size
# Hash Table Sizing # Hash Table Sizing
# sHash table entries are 16 bytes each # sHash table entries are 16 bytes each