feat: add distro compatibility check for system restore process
This commit is contained in:
parent
11d375b38b
commit
67109343ef
3 changed files with 37 additions and 1 deletions
|
@ -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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue