feat: add distro compatibility check for system restore process

This commit is contained in:
kake26 2025-05-10 21:29:00 -05:00
parent 11d375b38b
commit 67109343ef
Signed by: kake26
GPG key ID: E0A989B571D1F99F
3 changed files with 37 additions and 1 deletions

View file

@ -38,4 +38,29 @@ if [ -f $pkgsum ] && [ -f $hostsum ]; then
else
echo "Checksum files not found"
fi
}
function check_distro() {
if [ -f ./distro_info ]; then
. ./distro_info
source_distro="$DISTRO_ID"
source_version="$DISTRO_VERSION"
else
cprint 1 "Warning: No distro info found in archive. Cannot verify compatibility."
return
fi
. /etc/os-release
target_distro="$ID"
target_version="$VERSION_ID"
if [ "$source_distro" != "$target_distro" ] || [ "$source_version" != "$target_version" ]; then
cprint 3 "Warning: This restore was created on $source_distro $source_version, but the target system is $target_distro $target_version."
cprint 3 "Restoration may fail if packages or configurations are incompatible."
cprint 3 "Press Enter to continue, or Ctrl+C to abort."
read
else
cprint 2 "Distro match: $source_distro $source_version. Proceeding with restoration."
fi
}