Browse Source

defined local $$__replace_fetch_url in Build()

git-svn-id: http://trac.vinelinux.org/repos/projects/vbootstrap/trunk@6713 ec354946-7b23-47d6-9f5a-488ba84defc7
munepi 10 years ago
parent
commit
8b791e4668
1 changed files with 16 additions and 12 deletions
  1. 16 12
      vbuilder.sh.in

+ 16 - 12
vbuilder.sh.in

@@ -618,42 +618,46 @@ Build(){
     # mount-chroot /tmp
     # mount-chroot /home
 
-    ##!! 4.2 has no apt-sourceslist-{plus,nonfree,proposed-updates} packages
+    local __replace_fetch_url="sed -i -e s|@@VBUILDER_VBOOTSTRAP_FETCH_URL@@|${VBOOTSTRAP_FETCH_URL}|g"
     case ${VERSION} in
 	4.2)
-	    sed -i -e "s|@@VBUILDER_VBOOTSTRAP_FETCH_URL@@|${VBOOTSTRAP_FETCH_URL}|g" ${BUILD_ROOT}/etc/apt/sources.list
-	    sed -i -e 's/main plus updates nonfree *$/$(echo ${CATEGORIES} | sed -e "s/,/ /"g) updates/g' ${BUILD_ROOT}/etc/apt/sources.list
+	    ##!! 4.2 has no apt-sourceslist-{plus,nonfree,proposed-updates} packages
+	    $__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list
+	    for i in main plus nonfree; do 
+		[ ! -z "$(echo ${CATEGORIES} | grep ${i})" ] && continue
+		sed -i -e "s, ${i},,g" ${BUILD_ROOT}/etc/apt/sources.list
+	    done
 	    $__chroot_sh 'apt-get -qq update && apt-get -qq -y dist-upgrade'
 	    # [ $with_category_security -eq 1 ] && \
 	    # 	echo 
 	    ;;
 	5.2|@@VBUILDER_STABLE_VERSION@@)
-	    sed -i -e "s|@@VBUILDER_VBOOTSTRAP_FETCH_URL@@|${VBOOTSTRAP_FETCH_URL}|g" ${BUILD_ROOT}/etc/apt/sources.list.d/main.list
+	    $__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list.d/main.list
 	    $__chroot_sh 'apt-get -qq update && apt-get -qq -y dist-upgrade'
 	    [ $with_category_plus -eq 1 ] && \
 		$__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-plus' && \
-		sed -i -e "s|@@VBUILDER_VBOOTSTRAP_FETCH_URL@@|${VBOOTSTRAP_FETCH_URL}|g" ${BUILD_ROOT}/etc/apt/sources.list.d/plus.list
+		$__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list.d/plus.list
 	    [ $with_category_nonfree -eq 1 ] && \
 		$__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-nonfree' && \
-		sed -i -e "s|@@VBUILDER_VBOOTSTRAP_FETCH_URL@@|${VBOOTSTRAP_FETCH_URL}|g" ${BUILD_ROOT}/etc/apt/sources.list.d/nonfree.list
+		$__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list.d/nonfree.list
 	    [ $with_category_proposed_updates -eq 1 ] && \
 		$__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-proposed-updates' && \
-		sed -i -e "s|@@VBUILDER_VBOOTSTRAP_FETCH_URL@@|${VBOOTSTRAP_FETCH_URL}|g" ${BUILD_ROOT}/etc/apt/sources.list.d/proposed-updates.list
+		$__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list.d/proposed-updates.list
 	    # [ $with_category_security -eq 1 ] && \
 	    # 	echo 
 	    ;;
 	VineSeed)
-	    sed -i -e "s|@@VBUILDER_VBOOTSTRAP_FETCH_URL@@|${VBOOTSTRAP_FETCH_URL}|g" ${BUILD_ROOT}/etc/apt/sources.list.d/main.list
+	    $__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list.d/main.list
 	    $__chroot_sh 'apt-get -qq update && apt-get -qq -y dist-upgrade'
 	    [ $with_category_plus -eq 1 ] && \
 		$__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-plus' && \
-		sed -i -e "s|@@VBUILDER_VBOOTSTRAP_FETCH_URL@@|${VBOOTSTRAP_FETCH_URL}|g" ${BUILD_ROOT}/etc/apt/sources.list.d/plus.list
+		$__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list.d/plus.list
 	    [ $with_category_nonfree -eq 1 ] && \
 		$__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-nonfree' && \
-		sed -i -e "s|@@VBUILDER_VBOOTSTRAP_FETCH_URL@@|${VBOOTSTRAP_FETCH_URL}|g" ${BUILD_ROOT}/etc/apt/sources.list.d/nonfree.list
+		$__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list.d/nonfree.list
 	    [ $with_category_test -eq 1 ] && \
 		$__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-test' && \
-		sed -i -e "s|@@VBUILDER_VBOOTSTRAP_FETCH_URL@@|${VBOOTSTRAP_FETCH_URL}|g" ${BUILD_ROOT}/etc/apt/sources.list.d/test.list
+		$__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list.d/test.list
 	    ;;
     esac
 
@@ -814,7 +818,7 @@ RPM_Build(){
     $__chroot_sh "cd ${BUILD_DIR}/SRPMS && apt-get -o APT::Install::Virtual=true -y build-dep $BASE_RPM_PKG"
     $__chroot_sh "cd ${BUILD_DIR}/SRPMS && su ${BUILD_USER} -c 'rpmbuild --rebuild $RPM_OPTS $BASE_RPM_PKG'"
 
-    BUILT_RPMS_LIST=$(find $BUILD_ROOT${BUILD_DIR}/RPMS -type f -regex '.*\.rpm' | sed -e s@${BUILD_ROOT}@@g -e 's|.*\/compat32-.*||g' -e 's|.*\/.*\.src\.rpm||g' -e 's/$/ \\/g')
+    BUILT_RPMS_LIST=$(find $BUILD_ROOT${BUILD_DIR}/RPMS -type f -regex '.*\.rpm' | sed -e s,${BUILD_ROOT},,g -e 's|.*\/compat32-.*||g' -e 's|.*\/.*\.src\.rpm||g' -e 's/$/ \\/g')
 
     [ $with_category_nonfree -eq 1 ] && \
 	[ ! -z "$(echo $BUILT_RPMS_LIST | grep -e 'self-build-' -e 'install-assist-')" ] && \