-#!/bin/bash -e
+#!/bin/sh -e
#
# btrfs-mksnapshot-rootfs -- Make snapshots of root filesystems ("/")
-# Copyright (c)2014 Alexander Barton (alex@barton.de)
+# 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
# (at your option) any later version.
#
-NAME=`basename "$0"`
+NAME=$(basename "$0")
-function Usage()
+Usage()
{
echo "Usage: $NAME"; echo
exit 1
[ $# -eq 0 ] || Usage
-if [ -n "`fgrep ' / btrfs ' /etc/fstab 2>/dev/null`" ]; then
+if grep -Fq ' / btrfs ' /etc/fstab; then
if [ -x /usr/local/sbin/btrfs-mksnapshot ]; then
/usr/local/sbin/btrfs-mksnapshot -1 / || exit 1
else