This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
##################################################### | |
# Simple BTRBK Wrapper for using with cron or systemd timers | |
# https://github.com/digint/btrbk/issues/520 | |
##################################################### | |
# shellcheck disable=SC1001 | |
LC_ALL=C | |
LANG=C | |
VERSION="0.1" | |
declare SCRIPT_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[[ "$(id -u)" -eq 0 ]] || (echo "Got root?" ; exit 5) | |
command -v btrfs > /dev/null || (echo "Command not found: btrfs" ; exit 4) | |
for folder in $* ; do | |
mount | awk '{print $3}' | grep "$(pwd)/${folder}" && echo "${folder} has a submount?" && exit 1 | |
btrfs sub list . | grep "${PWD##*/}/${folder}" && echo "${folder} has a subvolume?" && exit 2 | |
[ -e ${folder}.temp ] && echo "${folder}.temp already exists?" && exit 3 || true | |
mv ${folder} ${folder}.temp | |
btrfs sub create ${folder} |