Skip to content

Instantly share code, notes, and snippets.

View msmafra's full-sized avatar

Marcelo dos Santos Mafra msmafra

  • Brazil
  • 14:31 (UTC -03:00)
View GitHub Profile
#!/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}
@msmafra
msmafra / btrbk-o
Last active March 9, 2023 19:33
btrbk simple wrapper
#!/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