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" ] &&
|
2018-02-13 10:24:12 +01:00
|
|
|
[ -d "${SNAPSHOTS}" ]; then
|
2021-07-16 10:23:34 +02:00
|
|
|
machine=`uname -m`
|
|
|
|
case "x$machine" in
|
|
|
|
xs390 | xs390x) : ;;
|
|
|
|
*)
|
|
|
|
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
|
2018-02-09 08:23:55 +01:00
|
|
|
fi
|
2021-07-16 10:23:34 +02:00
|
|
|
;;
|
|
|
|
esac
|
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
|