2014-10-01 09:24:29 +02:00
|
|
|
#! /bin/sh
|
|
|
|
set -e
|
2018-02-09 08:23:55 +01:00
|
|
|
SNAPSHOTS="/.snapshots"
|
2014-10-01 09:24:29 +02:00
|
|
|
if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] &&
|
2018-02-09 08:23:55 +01:00
|
|
|
[ "x${GRUB_FS}" = "xbtrfs" ] &&
|
|
|
|
[ -f "${SNAPSHOTS}/grub-snapshot.cfg" ]; then
|
|
|
|
SNAPSHOT_RID=`btrfs inspect-internal rootid ${SNAPSHOTS}`
|
|
|
|
ROOT_RID=`btrfs inspect-internal rootid /`
|
|
|
|
if [ -n "${SNAPSHOT_RID}" -a "${SNAPSHOT_RID}" != "${ROOT_RID}" ]; then
|
|
|
|
SNAPSHOT_SUBVOL=`btrfs inspect-internal subvolid-resolve ${SNAPSHOT_RID} /`
|
|
|
|
ROOT_SUBVOL=`btrfs inspect-internal subvolid-resolve ${ROOT_RID} /`
|
|
|
|
INODE=`stat -c '%i' ${SNAPSHOTS}`
|
|
|
|
if [ "x${INODE}" = "x256" -a "x${ROOT_SUBVOL}${SNAPSHOTS}" != "x${SNAPSHOT_SUBVOL}" ]; then
|
|
|
|
echo "btrfs-mount-subvol (\$root) ${SNAPSHOTS} ${SNAPSHOT_SUBVOL}"
|
|
|
|
fi
|
|
|
|
fi
|
2014-10-01 09:24:29 +02:00
|
|
|
cat <<EOF
|
2018-02-09 08:23:55 +01:00
|
|
|
if [ -f "${SNAPSHOTS}/grub-snapshot.cfg" ]; then
|
|
|
|
source "${SNAPSHOTS}/grub-snapshot.cfg"
|
2014-10-01 09:24:29 +02:00
|
|
|
fi
|
|
|
|
EOF
|
|
|
|
fi
|