#!/bin/sh -e # # btrfs-mksnapshot-rootfs -- Make snapshots of root filesystems ("/") # Copyright (c)2014-2020 Alexander Barton (alex@barton.de) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # NAME=$(basename "$0") Usage() { echo "Usage: $NAME"; echo exit 1 } [ $# -eq 0 ] || Usage if [ "$(findmnt -fnr -o fstype /)" = "btrfs" ]; then if [ -x /usr/local/sbin/btrfs-mksnapshot ]; then /usr/local/sbin/btrfs-mksnapshot -1 / || exit 1 else echo "\"/usr/local/sbin/btrfs-mksnapshot\" not executable, snapshot creation skipped." fi else echo "Root filesystem is not of type \"btrfs\", snapshot creation skipped." fi exit 0