Browse Source

updated vbuilder.sh.in: defined Retry_vbootstrap-post

git-svn-id: http://trac.vinelinux.org/repos/projects/vbootstrap/trunk@464 ec354946-7b23-47d6-9f5a-488ba84defc7
munepi 14 years ago
parent
commit
d4f5b337a5
2 changed files with 27 additions and 10 deletions
  1. 2 1
      vbootstrap.spec
  2. 25 9
      vbuilder.sh.in

+ 2 - 1
vbootstrap.spec

@@ -59,10 +59,11 @@ make DESTDIR=$RPM_BUILD_ROOT install
 
 
 %changelog
-* Sun Feb 07 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.14-1
+* Sat Feb 13 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.14-1
 - updated vbuilder.sh.in
   - used __chroot_sh
   - improved some functions for mounting file systems
+  - defined Retry_vbootstrap-post()
 
 * Sat Feb 06 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.13-1
 - updated vbuilder.sh.in

+ 25 - 9
vbuilder.sh.in

@@ -287,12 +287,12 @@ apt-get-update(){
     case $1 in
 	--host)
 	    echo -n "apt-get update on host ... "
-	    apt-get update > /dev/null 2>&1
+	    apt-get -qq update > /dev/null 2>&1
 	    echo "done."
 	    ;;
 	--chroot)
 	    echo -n "apt-get update on chroot ... "
-	    $__chroot_sh 'apt-get update' > /dev/null 2>&1
+	    $__chroot_sh 'apt-get -qq update' > /dev/null 2>&1
 	    echo "done."
 	    ;;
 	*)
@@ -414,6 +414,19 @@ Clean(){
     echo "Cleanup a build farm for ${VERSION} done."
 }
 
+Retry_vbootstrap-post(){
+    local CHROOT_DIST_RELEASE=$(cat ${BUILD_ROOT}/etc/vine-release | cut -f3 -d" " | cut -f1 -d.)
+    local DIST_RELEASE=$(cat /etc/vine-release | cut -f3 -d" " | cut -f1 -d.)
+
+    if [ "${CHROOT_DIST_RELEASE}" != "${DIST_RELEASE}" ]; then
+	. /usr/share/vbootstrap/scripts/${VERSION}
+	$__chroot_sh "rm /var/lib/rpm/*"
+	$__chroot_sh "rpmdb --initdb"
+	$__chroot_sh "apt-get -qq update"
+	$__chroot_sh "apt-get -qq -y install ${BASE_PKGS}"
+    fi
+}
+
 Build(){
     setup-vbootstrap
 
@@ -430,26 +443,29 @@ Build(){
 	/usr/sbin/vbootstrap ${VERSION} ${BUILD_ROOT}
     fi
 
+    ## retry vbootstrap post in Build()
+    Retry_vbootstrap-post
+
     mount-chroot cache_dir
     mount-chroot vfs
     # mount-chroot /tmp
     # mount-chroot /home
 
-    $__chroot_sh 'apt-get update && apt-get -y dist-upgrade'
+    $__chroot_sh 'apt-get -qq update && apt-get -qq -y dist-upgrade'
 
     ##!! 4.2 has no apt-sourceslist-{plus,nonfree} packages
     if [ "$(echo ${VERSION} | sed s/_i386//)" != "4.2" ]; then
-	$__chroot_sh 'apt-get update && apt-get -y install apt-sourceslist-plus'
-	$__chroot_sh 'apt-get update && apt-get -y install apt-sourceslist-nonfree'
+	$__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-plus'
+	$__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-nonfree'
     fi
 
     if [ $with_dist_upgrade -eq 1 ]; then
-	$__chroot_sh 'apt-get update && apt-get -y dist-upgrade'
+	$__chroot_sh 'apt-get -qq update && apt-get -qq -y dist-upgrade'
     fi
-    $__chroot_sh 'apt-get -y install build-essential'
-    $__chroot_sh 'apt-get -y install self-build-setup'
+    $__chroot_sh 'apt-get -qq -y install build-essential'
+    $__chroot_sh 'apt-get -qq -y install self-build-setup'
 
-    $__chroot_sh 'apt-get -y install etcskel shadow-utils'
+    $__chroot_sh 'apt-get -qq -y install etcskel shadow-utils'
 
     $__chroot_sh 'cd /dev && /sbin/MAKEDEV console'
     $__chroot_sh 'cd /dev && /sbin/MAKEDEV null'