[lxc-devel] [PATCH] lxc-oracle: use db_load from container

Dwight Engen dwight.engen at oracle.com
Wed Apr 9 19:20:30 UTC 2014


This makes it so that the host doesn't need to have an old, compat
version of db43_load installed by using the db_load from the just
installed container. Some newer distributions do not even have an old
enough compat-db4 package available.

Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
---
 templates/lxc-oracle.in | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/templates/lxc-oracle.in b/templates/lxc-oracle.in
index d1718af..3d245eb 100644
--- a/templates/lxc-oracle.in
+++ b/templates/lxc-oracle.in
@@ -556,15 +556,13 @@ container_rootfs_create()
     if [ $container_release_major -lt "6" ]; then
         if [ $host_distribution = "Ubuntu" -o $host_distribution = "Debian" ]; then
             db_dump_cmd="db5.1_dump"
-            db_load_cmd="db4.3_load"
         fi
         if [ $host_distribution = "OracleServer" -o \
              $host_distribution = "Fedora" ]; then
             db_dump_cmd="db_dump"
-            db_load_cmd="db43_load"
         fi
 
-        cmds="$cmds $db_dump_cmd $db_load_cmd file"
+        cmds="$cmds $db_dump_cmd file"
     fi
     for cmd in $cmds; do
         which $cmd >/dev/null 2>&1
@@ -661,6 +659,9 @@ container_rootfs_create()
         rpm --root $container_rootfs --initdb
         yum_args="--installroot $container_rootfs --disablerepo=* --enablerepo=$repo -y --nogpgcheck"
         min_pkgs="yum initscripts passwd rsyslog vim-minimal openssh-server openssh-clients dhclient chkconfig rootfiles policycoreutils oraclelinux-release"
+        if [ $container_release_major -lt "6" ]; then
+            min_pkgs="$min_pkgs db4-utils"
+        fi
 
         # we unshare the mount namespace because yum installing the ol4
         # packages causes $rootfs/proc to be mounted on
@@ -722,7 +723,7 @@ container_rootfs_create()
             echo "Fixing (downgrading) rpm database from version $db_version"
             rm -f $container_rootfs/var/lib/rpm/__db*
             for db in $container_rootfs/var/lib/rpm/* ; do
-                $db_dump_cmd $db |$db_load_cmd $db.new
+                $db_dump_cmd $db |chroot $container_rootfs db_load /var/lib/rpm/`basename $db`.new
                 mv $db.new $db
             done
         fi
-- 
1.8.5.3



More information about the lxc-devel mailing list