]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
simplaret: now --install can check if version and arch matches the jail ones
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Tue, 23 Jan 2007 20:44:21 +0000 (20:44 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Tue, 23 Jan 2007 20:44:21 +0000 (20:44 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@122 04377dda-e619-0410-9926-eae83683ac58

src/simplaret

index 8e2a53befb922ae6a45818061dc0427e19988b37..42f1bfff767266b5a34b211f41b95d8beebd0bc2 100755 (executable)
@@ -683,12 +683,27 @@ function simplaret_checksum {
 function simplaret_install {
 
   # download and install a package
+  # usage: simplaret_install <package-name> [--skip-checks]
 
-  local package root
+  local package root jail_arch jail_version
 
   root="/$ROOT"
   mkdir -p $root/var/log/setup/tmp
 
+  if [ "$2" != "--skip-checks" ]; then
+    jail_arch="`default_arch $root`"
+    jail_version="`default_version $root`"
+    if [ "$ARCH" != "$jail_arch" ]; then
+      echo "$BASENAME: requested repository arch ($ARCH) doesn't match jail arch ($jail_arch)"
+      echo "$BASENAME: please use \"$BASENAME --get $1 --skip-checks\" to ignore this warning and install anyway"
+      return
+    elif [ "$VERSION" != "$jail_version" ]; then
+      echo "$BASENAME: requested repository version ($VERSION) doesn't match jail version ($jail_version)"
+      echo "$BASENAME: please use \"$BASENAME --get $1 --skip-checks\" to ignore this warning and install anyway"
+      return 1
+    fi
+  fi
+
   package="`simplaret_get $1 --silent`"
 
   if [ "$?" == "0" ] && [ ! -z "$package" ]; then