source: projects/vbootstrap/trunk/vbuilder.sh.in @ 687

Revision 687, 16.4 KB checked in by munepi, 14 years ago (diff)

Usage()を更新。Actionsを修正しました。

RevLine 
[118]1#!/bin/bash
2# -*- coding: utf-8-unix -*-
3
[304]4Usage_C(){
[118]5    cat<<EOF
[687]6Usage:  $(basename $0) {--version [version]} {--arch [arch]} {--dist-upgrade} {--target [target]} {--with-compat32} {clean|build|build-rpm [src.rpm]|install-rpm [arch.rpm|package]|remove-rpm [package]}
[411]7
8Options:
[118]9        --version:              set [version] (default: ${DEFAULT_VERSION})
10        --arch:                 set [arch] (default: $(uname -i))
[412]11        --dist-upgrade:         make VineSeed bootstrap via ${STABLE_VERSION}
[485]12        --unionfs               cover a bootstrap with unionfs
[406]13        --target:               build rpms with [target]
14        --with-compat32:        build rpms with compat32 on boostrap
[411]15
16Actions:
[687]17        clean:                  clean the boostrap of [version]
18        build:                  build a boostrap of [version]
19        build-rpm:              build [src.rpm] on a boostrap
20        install-rpm:            install [arch.rpm|package] on a boostrap
21        remove-rpm:             remove [package] on a boostrap
[118]22
23For example,
[304]24* make a clean/plain build environment on the current archtecture:
[118]25$(basename $0) --clean --build
[470]26* build rpms from the specified source rpm:
[118]27$(basename $0) --build-rpm [src.rpm]
[304]28* make a plain build environment for Vine Linux 4.2:
[118]29$(basename $0) --version 4.2 --clean --build
[304]30* make a i386 chroot on x86_64:
[118]31$(basename $0) --arch i386 --clean --build
[406]32* build a kernel package with target i686
33$(basename $0) --target i686 --build-rpm [kernel src.rpm]
34* build a compat32 package:
[349]35$(basename $0) --arch i386 --with-compat32 --build-rpm [src.rpm]
[323]36$(/usr/sbin/vbootstrap | sed -e s/^Usage:.*// -e s/^E:.*//)
[118]37EOF
38}
39
[304]40Usage_ja(){
41    Usage_C
42}
43
[323]44Msg_MissingParameter_C(){
[412]45    para=$1
46    cat<<EOF
[470]47E: Missing some parameters after ${para}
[304]48EOF
49}
50
[323]51Msg_MissingParameter_ja(){
[412]52    para=$1
53    cat<<EOF
[416]54E: ${para} 以後のいくつかのパラメータに間違いがあります
[412]55EOF
[323]56}
57
58Msg_NoSupportVARCH_C(){
59    cat<<EOF
[470]60E: arch ${VARCH} is NOT supported on $(uname -i)
[323]61EOF
62}
63
[304]64Msg_NoSupportVARCH_ja(){
[412]65    cat<<EOF
66E: ${VARCH} アーキテクチャは $(uname -i) 上で非サポートです
67EOF
[304]68}
69
[323]70Msg_NoSupportVERSION_C(){
71    cat<<EOF
[470]72E: ${VERSION} is NOT supported
[323]73EOF
74}
[304]75
[323]76Msg_NoSupportVERSION_ja(){
[412]77    cat<<EOF
78E: バージョン ${VERSION} は非サポートです
79EOF
[323]80}
81
[411]82Msg_NoSupportDistUpgradeVERSION_C(){
83    cat<<EOF
84E: version ${VERSION} does not support --dist-upgrade option
85EOF
86}
87
88Msg_NoSupportDistUpgradeVERSION_ja(){
[412]89    cat<<EOF
[470]90E: バージョン ${VERSION} では --dist-upgrade オプションはサポートされていません
[412]91EOF
[411]92}
93
[406]94Msg_NoSupportTARGET_C(){
95    cat<<EOF
[470]96E: rpm build target ${TARGET} is NOT supported
[406]97EOF
98}
99
100Msg_NoSupportTARGET_ja(){
[412]101    cat<<EOF
[470]102E: rpm ビルドターゲット ${TARGET} はサポートされていません
[412]103EOF
[406]104}
105
[412]106Msg_NotPackageName_C(){
107    cat<<EOF
[470]108E: $RPM_PKG is not a package name
[412]109EOF
110}
111
112Msg_NotPackageName_ja(){
113    cat<<EOF
114E: $RPM_PKG はパッケージ名でありません
115EOF
116}
117
118Msg_NotSourceRPM_C(){
119    cat<<EOF
[470]120E: $RPM_PKG is not a source RPM package
[412]121EOF
122}
123
124Msg_NotSourceRPM_ja(){
125    cat<<EOF
126E: $RPM_PKG はソース RPM パッケージでありません
127EOF
128}
129
[323]130##############################################################################
131
[416]132check-parameter(){
133    if [ -z "$*" ]; then
134        Usage_$LOCALE
135        return 1
136    fi
137
138    while [ ! -z "$*" ]; do
139        case $1 in
[516]140            --help)
141                Usage_$LOCALE
[517]142                return 1
[516]143                ;;
[679]144            --version|--arch|--target|--build-rpm|build-rpm|--install-rpm|install-rpm|--remove-rpm|remove-rpm)
[416]145                shift
146                check-next-parameter $1 || return 1
147                ;;
[679]148            --dist-upgrade|--unionfs|--with-compat32|--build|build|--clean|clean)
[416]149                ;;
150            *)
151                Msg_MissingParameter_$LOCALE $1
152                return 1
153                ;;
154        esac
155        shift
156    done
157    return 0
158}
159
[412]160check-next-parameter(){
161    arg=$1
[416]162    if [ -z "${arg}" ]; then
163        Msg_MissingParameter_$LOCALE ${arg}
164        return 1
165    fi
166
[412]167    if [ $(echo ${arg} | grep '^-') ]; then
168        Msg_MissingParameter_$LOCALE ${arg}
169        return 1
170    fi
171    return 0
172}
173
[323]174setup-vbuilder(){
175    ## load default settings
[330]176    if [ -r /etc/vbootstrap/vbuilder.conf ]; then
[323]177        . /etc/vbootstrap/vbuilder.conf
178    fi
[330]179    [ -z "${VBOOTSTRAP_DIR}" ] && \
180        VBOOTSTRAP_DIR=@@VBUILDER_VBOOTSTRAP_DIR@@
181    [ -z "${DEFAULT_VERSION}" ] && \
182        DEFAULT_VERSION=@@VBUILDER_DEFAULT_VERSION@@
[370]183    [ -z "${BUILT_RPMS_DIR}" ] && \
184        BUILT_RPMS_DIR=@@VBUILDER_BUILT_RPMS_DIR@@
[323]185    [ -d $VBOOTSTRAP_DIR ] || mkdir -p $VBOOTSTRAP_DIR
186    VERSION=$DEFAULT_VERSION
187
[411]188    ## current stable relase version
189    STABLE_VERSION=@@VBUILDER_STABLE_VERSION@@
190
[323]191    ## set locale
192    case $LANG in
193        ja*)  LOCALE=ja ;;
194        *)    LOCALE=C ;;
195    esac
[411]196
197    ## set boolian
198    with_setup_vbootstrap=0
[485]199    with_unionfs=0
[411]200    with_dist_upgrade=0
[323]201}
202
[118]203setup-vbootstrap(){
[411]204    if [ ${with_setup_vbootstrap} -eq 0 ]; then
205        with_setup_vbootstrap=1
[118]206
[304]207        ## check a chroot archtecture
[323]208        if [ ! -z ${VARCH} ]; then
[304]209            case "${VARCH}" in
[517]210                i386|i686|x86_64)
[314]211                    [ "$(uname -i)" = "ppc" ] && \
[323]212                        Msg_NoSupportVARCH_$LOCALE
213                    [ $? -eq 0 ] && exit 1
[304]214                    ;;
215                ppc)
[469]216                    [ "$(uname -i)" = "i386" -o "$(uname -i)" = "i686" -o "$(uname -i)" = "x86_64" ] && \
[323]217                        Msg_NoSupportVARCH_$LOCALE
218                    [ $? -eq 0 ] && exit 1
[304]219                    ;;
220            esac
[323]221        fi
222
[118]223        [ -z ${VARCH} ] && VARCH=$(uname -i)
[304]224
[423]225        ##!! 4.2 is NO support on VARCH=x86_64
226        if [ "${VERSION}" = "4.2" -a "${VARCH}" = "x86_64" ]; then
[323]227            Msg_NoSupportVERSION_${LOCALE}
228            exit 1
229        fi
230
[423]231        ## support i386 chroot on x86_64 below:
[118]232        [ "${VARCH}" != "$(uname -i)" ] && VERSION=${VERSION}_${VARCH}
[323]233
234        ## check support ${VERSION}
235        if [ -z "$(/usr/sbin/vbootstrap | sed -e s/^Usage:.*// -e s/^E:.*// | grep -m 1 ${VERSION})" ]; then
236            Msg_NoSupportVERSION_$LOCALE
237            exit 1
238        fi
239
[411]240        ## check ${VERSION} equals VineSeed*, when with_dist_upgrade=1
241        if [ $with_dist_upgrade -eq 1 ]; then
242            if [ "$(echo ${VERSION} | sed -e "s/\(VineSeed\).*/\1/")" != "VineSeed" ]; then
243                Msg_NoSupportDistUpgradeVERSION_$LOCALE
244                exit 1
245            fi
246        fi
247
[406]248        ## check build target option ${TARGET}
[407]249        if [ ! -z "${TARGET}" ]; then
250            RPM_TARGET_LIST="$(cat /usr/lib/rpm/rpmrc | grep arch_canon: | sed -e "s/arch_canon:[[:blank:]]*\(.*\):.*/\1/")"
251            if [ -z "$(echo $RPM_TARGET_LIST | grep $TARGET)" ]; then
252                Msg_NoSupportTARGET_$LOCALE
253                exit 1
254            fi
[406]255        fi
256
[135]257    fi
[323]258
[471]259    MAJOR_VERSION=$(echo ${VERSION} | sed -e "s/_i[0-9]86//")
260
[135]261    BUILD_ROOT=${VBOOTSTRAP_DIR}/${VERSION}
[296]262    BUILD_USER=vbuilder
263    BUILD_DIR=/home/${BUILD_USER}/rpm
[452]264    ARCHIVES_DIR=${BUILD_ROOT}/var/cache/apt/archives
265    CACHE_DIR=${VBOOTSTRAP_DIR}/cache/${VERSION}/apt/archives
[485]266    UNIONFS_DIR=${VBOOTSTRAP_DIR}/unionfs/${VERSION}
[135]267
[453]268    __chroot_sh="/usr/sbin/chroot ${BUILD_ROOT} /bin/sh -c"
269
[135]270    mkdir -p $VBOOTSTRAP_DIR
[118]271}
272
[412]273setup-vbootstrap-rpm(){
274    setup-vbootstrap
275
276    ## check ${BUILD_ROOT}
277    [ -d ${BUILD_ROOT} ] || Build
278
279    DIST_RELEASE=$(cat ${BUILD_ROOT}/etc/vine-release | cut -f3 -d" " | cut -f1 -d.)
280
281    if [ -f $RPM_PKG ]; then
282        BASE_RPM_PKG=$(basename $RPM_PKG)
283        cp -f $RPM_PKG $BUILD_ROOT${BUILD_DIR}
284    else
285        BASE_RPM_PKG=$RPM_PKG   
286    fi
287}
288
[413]289## recover apt-get data on host/chroot
290apt-get-update(){
291    case $1 in
292        --host)
293            echo -n "apt-get update on host ... "
[464]294            apt-get -qq update > /dev/null 2>&1
[413]295            echo "done."
296            ;;
297        --chroot)
298            echo -n "apt-get update on chroot ... "
[464]299            $__chroot_sh 'apt-get -qq update' > /dev/null 2>&1
[413]300            echo "done."
301            ;;
302        *)
303            echo apt-get-update: unknown option $1
304            exit 1
305            ;;
306    esac
307}
308
[454]309## mount-chroot {|--umount} [file system|name]
310## support file systems: /home /tmp /sys /proc /dev/shm /dev/pts /dev
311## support name: vfs chache_dir
312## NOTE: /tmp needs for applications which use X
313##       vfs is virtual file systems
314##       cache_dir is ${CACHE_DIR} to ${ARCHIVES_DIR}
315mount-chroot(){
[412]316    if [ "$1" = "--umount" ]; then
[454]317        mount-chroot-umount $2 || return 1
[412]318    else
[454]319        mount-chroot-mount $1 || return 1
[412]320    fi
[454]321    return 0
[412]322}
323
[454]324## mount-chroot-umount [file system|name]
325mount-chroot-umount(){
326    local fs=$1
327    case $fs in
328        /home|/tmp|/sys|/proc|/dev/shm|/dev/pts|/dev)
329            [ -d ${BUILD_ROOT}${fs} ] || return 1
330            [ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] || \
331                umount ${BUILD_ROOT}${fs}
332            return 0
333            ;;
334        vfs)
335            # for dir in /sys /proc /dev/shm /dev/pts /dev; do
336            #   mount-chroot-umount ${dir} || return 1
337            # done
338            [ -d ${BUILD_ROOT}/proc ] || return 1
339            [ -z "$(mount | grep ${BUILD_ROOT}/proc)" ] || \
340                umount ${BUILD_ROOT}/proc
341            return 0
342            ;;
343        cache_dir)
344            [ -d ${ARCHIVES_DIR} ] || return 1
345            [ -z "$(mount | grep ${ARCHIVES_DIR})" ] || \
346                umount ${ARCHIVES_DIR}
347            return 0
348            ;;
[485]349        unionfs_dir)
350            [ -d ${BUILD_ROOT} ] || return 1
351            [ -z "$(mount | grep ${BUILD_ROOT} | grep unionfs)" ] || \
352                umount ${BUILD_ROOT}
353            if [ ! -z "$(mount | grep ${BUILD_ROOT} | grep unionfs)" ]; then
354                echo "Retry lazy unmount ... "
355                umount -l ${BUILD_ROOT}
356                echo "done."
357            fi
358            return 0
359            ;;
[454]360        *)
361            echo mount-chroot-umount: unknown file system $fs
362            exit 1
363            ;;
364    esac
[412]365}
366
[454]367## mount-chroot-mount [file system|name]
368mount-chroot-mount(){
369    local fs=$1
370    local mnt_opts=""
[412]371
[454]372    case $fs in
373        /home)
374            mnt_opts="-o rbind"
375            ;;
376        *)
377            mnt_opts="--bind"
378            ;;
379    esac
380
381    case $fs in
382        /home|/tmp|/sys|/proc|/dev/shm|/dev/pts|/dev)
383            [ -d ${BUILD_ROOT}${fs} ] || mkdir -p ${BUILD_ROOT}${fs}
384            [ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] && \
385                mount ${mnt_opts} ${fs} ${BUILD_ROOT}${fs}
386            return 0
387            ;;
388        vfs)
389            # for dir in /dev /dev/pts /dev/shm /proc /sys; do
390            #   mount-chroot-mount ${dir} || return 1
391            # done
392            mount-chroot-mount /proc || return 1
393            return 0
394            ;;
395        cache_dir)
396            [ -d ${CACHE_DIR} ] || mkdir -p ${CACHE_DIR}
397            [ -d ${ARCHIVES_DIR} ] || mkdir -p ${ARCHIVES_DIR}
398            [ -z "$(mount | grep ${ARCHIVES_DIR})" ] && \
399                mount ${mnt_opts} ${CACHE_DIR} ${ARCHIVES_DIR}
400            [ -d ${ARCHIVES_DIR}/partial ] || mkdir -p ${ARCHIVES_DIR}/partial
401            return 0
402            ;;
[485]403        unionfs_dir)
404            if [ $with_unionfs -eq 1 ]; then
405                [ -d ${UNIONFS_DIR} ] || mkdir -p ${UNIONFS_DIR}
406                [ -z "$(mount | grep ${BUILD_ROOT})" ] && \
407                    mount -t unionfs -o dirs=${UNIONFS_DIR}=rw:${BUILD_ROOT}=ro unionfs ${BUILD_ROOT}
408                unionctl ${BUILD_ROOT} --list
409            fi
410            return 0
411            ;;
[455]412        *)
413            echo mount-chroot-mount: unknown file system $fs
414            exit 1
415            ;;
[454]416    esac
417   
[452]418}
[412]419
[452]420
[118]421##############################################################################
422
423Clean(){
424    setup-vbootstrap
425
[454]426    # mount-chroot --umount /home
427    # mount-chroot --umount /tmp
428    mount-chroot --umount vfs
429    mount-chroot --umount cache_dir
[485]430    mount-chroot --umount unionfs_dir
[413]431    apt-get-update --host
[406]432
[485]433    if [ $with_unionfs -eq 1 ]; then
434        if [ -d ${UNIONFS_DIR} ]; then
435            echo -n "Cleaning build root \"${UNIONFS_DIR}\" via unionfs ... "
436            rm -rf ${UNIONFS_DIR}
437            echo "done."
438        fi
439    else
440        if [ -d ${BUILD_ROOT} ]; then
441            echo -n "Cleaning build root \"${BUILD_ROOT}\" ... "
442            rm -rf ${BUILD_ROOT}
443            echo "done."
444        fi
[323]445    fi
[412]446
447    echo "Cleanup a build farm for ${VERSION} done."
[118]448}
449
450Build(){
451    setup-vbootstrap
452
[411]453    if [ $with_dist_upgrade -eq 1 ]; then
454        ## make bootstrap of ${STABLE_VERSION}
455        /usr/sbin/vbootstrap \
456            $(echo ${VERSION} | sed -e "s/VineSeed/${STABLE_VERSION}/") \
457            ${BUILD_ROOT}
[118]458
[411]459        ## aim apt-line to VineSeed
460        sed -i "s/apt ${STABLE_VERSION}/apt VineSeed/g" \
461            ${BUILD_ROOT}/etc/apt/sources.list.d/main.list
462    else
463        /usr/sbin/vbootstrap ${VERSION} ${BUILD_ROOT}
464    fi
465
[454]466    mount-chroot cache_dir
467    mount-chroot vfs
468    # mount-chroot /tmp
469    # mount-chroot /home
[118]470
[464]471    $__chroot_sh 'apt-get -qq update && apt-get -qq -y dist-upgrade'
[411]472
[423]473    ##!! 4.2 has no apt-sourceslist-{plus,nonfree} packages
[471]474    if [ "${MAJOR_VERSION}" != "4.2" ]; then
[464]475        $__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-plus'
476        $__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-nonfree'
[423]477    fi
478
[411]479    if [ $with_dist_upgrade -eq 1 ]; then
[464]480        $__chroot_sh 'apt-get -qq update && apt-get -qq -y dist-upgrade'
[411]481    fi
[464]482    $__chroot_sh 'apt-get -qq -y install build-essential'
483    $__chroot_sh 'apt-get -qq -y install self-build-setup'
[411]484
[464]485    $__chroot_sh 'apt-get -qq -y install etcskel shadow-utils'
[118]486
[453]487    $__chroot_sh 'cd /dev && /sbin/MAKEDEV console'
488    $__chroot_sh 'cd /dev && /sbin/MAKEDEV null'
489    $__chroot_sh 'cd /dev && /sbin/MAKEDEV zero'
[406]490
[453]491    $__chroot_sh '/usr/sbin/pwconv'
492    $__chroot_sh "/usr/sbin/useradd ${BUILD_USER}"
[323]493
[452]494    ##!! for rpm-4.8.0 or higher
495    ##!! (See http://trac.vinelinux.org/wiki/Vine6/AboutUpdateToolchain)
496    if [ "$(echo ${VERSION} | sed -e "s/\(VineSeed\).*/\1/")" = "VineSeed" ]; then
[453]497        $__chroot_sh "sed -i -e 's/^%_topdir/#%_topdir/' /home/${BUILD_USER}/.rpmmacros"
[452]498    fi
499
[454]500    # mount-chroot --umount /home
501    # mount-chroot --umount /tmp
502    mount-chroot --umount vfs
503    mount-chroot --umount cache_dir
[413]504    apt-get-update --host
[412]505
[323]506    echo "Making a build farm for ${VERSION} done."
[118]507}
508
509RPM_Remove(){
510    setup-vbootstrap-rpm
[485]511    mount-chroot unionfs_dir
[454]512    mount-chroot cache_dir
513    mount-chroot vfs
[628]514    apt-get-update --chroot
[118]515
516    if [ -f $RPM_PKG ]; then
[412]517        Msg_NotPackageName_$LOCALE
[118]518        exit 1
519    fi
[453]520    $__chroot_sh "apt-get -y remove $BASE_RPM_PKG"
[412]521
[454]522    mount-chroot --umount vfs
523    mount-chroot --umount cache_dir
[485]524    mount-chroot --umount unionfs_dir
[413]525    apt-get-update --host
[118]526}
527
528RPM_Install(){
529    setup-vbootstrap-rpm
[485]530    mount-chroot unionfs_dir
[454]531    mount-chroot cache_dir
532    mount-chroot vfs
[413]533    apt-get-update --chroot
[118]534
[453]535    $__chroot_sh "cd ${BUILD_DIR} && apt-get -y install $BASE_RPM_PKG"
[412]536
[454]537    mount-chroot --umount vfs
538    mount-chroot --umount cache_dir
[485]539    mount-chroot --umount unionfs_dir
[413]540    apt-get-update --host
[118]541}
542
543RPM_Build(){
544    setup-vbootstrap-rpm
[485]545    mount-chroot unionfs_dir
[454]546    mount-chroot cache_dir
547    mount-chroot vfs
[628]548    apt-get-update --chroot
[118]549
550    if [ ! -f $RPM_PKG ]; then
[412]551        Msg_NotSourceRPM_$LOCALE
[118]552        exit 1
553    fi
[370]554   
555    RPM_PKG_USER=$(stat -c %U $RPM_PKG)
[371]556    RPM_PKG_GROUP=$(stat -c %G $RPM_PKG)
[520]557    [ ! -z "${SUDO_UID}" ] && RPM_PKG_USER=${SUDO_UID}
558    [ ! -z "${SUDO_GID}" ] && RPM_PKG_GROUP=${SUDO_GID}
[371]559    local __install="install -p -v -o ${RPM_PKG_USER} -g ${RPM_PKG_GROUP}"
[469]560    RPM_PKG_ARCH_LIST="RPMS/i386 RPMS/i686 RPMS/x86_64 RPMS/ppc RPMS/noarch SRPMS"
[408]561    [ -z "${TARGET}" ] || \
562        RPM_PKG_ARCH_LIST="RPMS/${TARGET} ${RPM_PKG_ARCH_LIST}"
[370]563
564    ## make src.rpm for $VERSION
[453]565    $__chroot_sh "cd ${BUILD_DIR} && su ${BUILD_USER} -c 'rpm -ivh $BASE_RPM_PKG'"
566    $__chroot_sh "cd ${BUILD_DIR} && su ${BUILD_USER} -c 'rpmbuild -bs --nodeps --clean --rmsource --rmspec ${BUILD_DIR}/SPECS/*.spec'"
[370]567
[396]568
569    ## change ${DIST_RELEASE}
570    BASE_RPM_PKG=$(echo $BASE_RPM_PKG | sed -e "s/vl\([0-9]*\)\./vl${DIST_RELEASE}\./")
571
572    ## rebuild $BASE_RPM_PKG on ${DIST_RELEASE}
[453]573    $__chroot_sh "cd ${BUILD_DIR}/SRPMS && apt-get -y build-dep $BASE_RPM_PKG"
574    $__chroot_sh "cd ${BUILD_DIR}/SRPMS && su ${BUILD_USER} -c 'rpmbuild --rebuild $RPM_OPTS $BASE_RPM_PKG'"
575    $__chroot_sh "cd ${BUILD_DIR} && apt-get -y install $(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')"
[396]576
[370]577    ## copy built rpms to ${HOME}/rpm/ for each archtectures
578    echo "Copying built rpms to ${HOME}/rpm/ for each archtectures ... "
579    for i in $RPM_PKG_ARCH_LIST; do \
580        if [ -d $BUILD_ROOT${BUILD_DIR}/${i} ]; then
[516]581            if [ ! -d ${BUILT_RPMS_DIR}/${MAJOR_VERSION}/${i} ]; then
[471]582                $__install -d ${BUILT_RPMS_DIR}/${MAJOR_VERSION}/${i}/
[516]583                chown -R ${RPM_PKG_USER}:${RPM_PKG_GROUP} ${BUILT_RPMS_DIR}
584            fi
[370]585            find $BUILD_ROOT${BUILD_DIR}/${i} -type f -regex '.*\.rpm' \
[471]586                -exec $__install -m0644 {} ${BUILT_RPMS_DIR}/${MAJOR_VERSION}/${i}/ \;
[370]587        fi
588    done
[412]589
[454]590    mount-chroot --umount vfs
591    mount-chroot --umount cache_dir
[485]592    mount-chroot --umount unionfs_dir
[413]593    apt-get-update --host
[412]594
[370]595    echo "done."
[118]596}
597
598
[304]599##############################################################################
600
[323]601setup-vbuilder
[304]602
[416]603check-parameter $* || exit 1
604
[118]605while [ $# -gt 0 ]; do
[411]606    tmpARG=$1
607    case $tmpARG in
[679]608        --version|--arch|--target|--build-rpm|build-rpm|--install-rpm|install-rpm|--remove-rpm|remove-rpm)
[406]609            shift
610            ;;
[679]611        --dist-upgrade|--unionfs|--with-compat32|--build|build|--clean|clean)
[406]612            ;;
613        *)
[416]614            echo unknown option $1
[406]615            exit 1
616            ;;
617    esac
618
[411]619    case $tmpARG in
[406]620        --version)
[118]621            VERSION=$1
622            ;;
623        --arch)
624            VARCH=$1
625            ;;
[411]626        --dist-upgrade)
627            with_dist_upgrade=1
628            ;;
[485]629        --unionfs)
630            with_unionfs=1
631            ;;
[406]632        --target)
633            TARGET=$1
634            RPM_OPTS="${RPM_OPTS} --target $TARGET"
635            ;;
[118]636        --with-compat32)
[406]637            RPM_OPTS="${RPM_OPTS} --with compat32"
[118]638            ;;
[679]639        --build-rpm|build-rpm)
[118]640            RPM_PKG=$1
[406]641            RPM_Build || exit 1
[118]642            ;;
[679]643        --install-rpm|install-rpm)
[118]644            RPM_PKG=$1
[406]645            RPM_Install || exit 1
[118]646            ;;
[679]647        --remove-rpm|remove-rpm)
[118]648            RPM_PKG=$1
[406]649            RPM_Remove || exit 1
[118]650            ;;
[679]651        --build|build)
[118]652            Build
653            ;;
[679]654        --clean|clean)
[118]655            Clean
656            ;;
657    esac
658    shift
659done
660
661exit
Note: See TracBrowser for help on using the repository browser.