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

Revision 11148, 30.6 KB checked in by iwamoto, 7 years ago (diff)

vbootstrap: add support overlayfs

RevLine 
[118]1#!/bin/bash
2# -*- coding: utf-8-unix -*-
3
[2522]4TEXTDOMAIN=vbootstrap
5TEXTDOMAINDIR=/usr/share/locale
6
[2516]7Usage(){
[118]8    cat<<EOF
[3675]9$(basename $0) @@VBUILDER_VERSION@@ $(echo $([ -z "@@VBUILDER_REVISION@@" ] || echo "(r@@VBUILDER_REVISION@@)"))
[5510]10Usage:  $(basename $0) {--profile [profile]} {--version [version]} {--arch [arch]} {--category [categories]} {--fetch-url [fetch_url]} {--dist-upgrade} {--target [target]} {--no-build-essential} {--with-compat32} {--rpmbuild-define [macro_expr]} {--rpmbuild-with [bcond_with]} {--rpmbuild-without [bcond_with]} {--sign} {--no-install} {--debug} {--help} {--bootstrap-dir [directory]} {--unionfs-dir [directory]} {--cache-dir [directory]} {--built-rpms-dir [directory]} {clean|build|build-rpm [src.rpm]|install-rpm [arch.rpm|package]|remove-rpm [package]}
[4076]11EOF
[411]12
[4076]13    echo $"
[411]14Options:
[5364]15        --profile:              set a profile
[5450]16        --version:              set [version] (default: ${VERSION})
[2718]17        --arch:                 set [arch] (default: ${UARCH})
[791]18        --category:             set [categories] (default: ${CATEGORIES})
[5364]19        --fetch-url:            set [fetch_url] to fetch packages (default: ${VBOOTSTRAP_FETCH_URL})
[412]20        --dist-upgrade:         make VineSeed bootstrap via ${STABLE_VERSION}
[791]21        --unionfs:              cover a bootstrap with unionfs
[406]22        --target:               build rpms with [target]
[5508]23        --no-build-essential:   do not install build-essential
[3850]24        --with-compat32:        build rpms with compat32 on bootstrap
[2531]25        --rpmbuild-define:      give a option --define [macro_expr] to rpmbuild
[1476]26        --rpmbuild-with:        give a option --with [bcond_with] to rpmbuild
[2531]27        --rpmbuild-without:     give a option --without [bcond_with] to rpmbuild
[1240]28        --sign:                 sign built rpms
[1267]29        --no-install:           build only a source rpm - do NOT install a built rpm
[2718]30        --login:                login in chroot as root user
[709]31        --bootstrap-dir:        set a bootstrap directory (default: ${VBOOTSTRAP_DIR})
[2711]32        --unionfs-dir:          set a directory to store unionfs images of vbootstrap (default: ${UNIONFS_DIR})
[725]33        --cache-dir:            set a directory to cache rpms (default: ${CACHE_DIR})
[709]34        --built-rpms-dir:       set a directory to store built rpms in chroot (default: ${BUILT_RPMS_DIR})
[2718]35        --debug:                enable debug mode
36        --help:                 show this help
[4076]37"
[411]38
[4076]39    echo $"
[411]40Actions:
[3850]41        clean:                  clean the bootstrap of [version]
42        build:                  build a bootstrap of [version]
[5367]43        build-rpm:              build [src.rpm] on a bootstrap
[3850]44        install-rpm:            install [arch.rpm|package] on a bootstrap
45        remove-rpm:             remove [package] on a bootstrap
[4076]46"
[118]47
[4076]48    echo $"
[3968]49Examples:
[304]50* make a clean/plain build environment on the current archtecture:
[802]51$(basename $0) clean build
[470]52* build rpms from the specified source rpm:
[802]53$(basename $0) build-rpm [src.rpm]
[6703]54* make a plain build environment for Vine Linux 6:
55$(basename $0) --version 6 clean build
[304]56* make a i386 chroot on x86_64:
[802]57$(basename $0) --arch i386 clean build
58* build a kernel package with target i686:
59$(basename $0) --target i686 build-rpm [kernel src.rpm]
[406]60* build a compat32 package:
[802]61$(basename $0) --arch i386 --with-compat32 build-rpm [src.rpm]
[4076]62"
63    /usr/sbin/vbootstrap | sed -e s/^Usage:.*// -e s/^E:.*//
[5364]64## TODO: output supported profiles and their names/comments
[118]65}
66
[323]67##############################################################################
68
[5364]69initialize-variables(){
70    ## set boolian variables
71    with_profile=0
72    with_setup_vbootstrap=0
73    with_dist_upgrade=0
74    with_unionfs=0
75    with_sign=0
76    with_no_install=0
77    with_login=0
78    with_debug=0
79    with_actions=0
80    with_ix86_on_x86_64=0
81    with_category_main=0
82    with_category_plus=0
83    with_category_nonfree=0
84    with_category_test=0
85    with_category_proposed_updates=0
86    with_category_security=0
[5508]87    with_build_essential=1
[5364]88
89    return 0
90}
91
[416]92check-parameter(){
[2516]93    [ -z "$*" ] && Usage && return 1
[416]94
95    while [ ! -z "$*" ]; do
96        case $1 in
[725]97            --help|help)
[5367]98                setup-vbuilder ||:
[2516]99                Usage
[517]100                return 1
[516]101                ;;
[5364]102            --profile)
103                shift
104                with_profile=1
105                PROFILE=$1
106                check-next-parameter $1 || return 1
107                ;;
108            --version|--arch|--category|--fetch-url|--target|--rpmbuild-define|--rpmbuild-with|--rpmbuild-without|--bootstrap-dir|--unionfs-dir|--cache-dir|--built-rpms-dir)
[725]109                [ $with_actions -eq 1 ] && \
[2516]110                    echo $"E: You can give no more options after actions" && \
111                    return 1
[416]112                shift
113                check-next-parameter $1 || return 1
114                ;;
[5508]115            --dist-upgrade|--unionfs|--with-compat32|--sign|--no-install|--login|--no-build-essential|--debug)
[725]116                [ $with_actions -eq 1 ] && \
[2516]117                    echo $"E: You can give no more options after actions" && \
118                    return 1
[416]119                ;;
[725]120            --build-rpm|build-rpm|--install-rpm|install-rpm|--remove-rpm|remove-rpm)
121                with_actions=1
122                shift
123                check-next-parameter $1 || return 1
124                ;;
[3675]125            --build|build|--clean|clean)
[725]126                with_actions=1
127                ;;
[416]128            *)
[2516]129                echo $"E: Missing some parameters after $1"
[416]130                return 1
131                ;;
132        esac
133        shift
134    done
[725]135
[2516]136    [ $with_actions -eq 0 ] && \
137        echo $"E: You must give at least one action" && return 1
[725]138
[416]139    return 0
140}
141
[412]142check-next-parameter(){
[2516]143    [ -z "$1" ] && echo $"E: Missing some parameters after $1" && return 1
[416]144
[2516]145    [ $(echo $1 | grep '^-') ] && \
146        echo $"E: Missing some parameters after $1" && return 1
[725]147
[412]148    return 0
149}
150
[5364]151## NOTE: setup-vbuilder() loads
152##  - system wide configurations (from /etc/vbootstrap/vbuilder.conf)
153##  - given profile (from /etc/vbootstrap/profile.d/*.conf)
154##  - given command-line parameters
155## where given command-line parameters override the settings given profile,
156## and the settings given profile override system wide settings.
157## If you use a profile of vbuilder, you may not override the settings
158## given profile.
[323]159setup-vbuilder(){
[3343]160    ## check $SUDO_USER and $USERHELPER_UID
161    RPM_SIGN_USER=$SUDO_USER
162    if [ -z "${RPM_SIGN_USER}" ]; then
[3967]163        [ -z "${USERHELPER_UID}" ] && \
164            echo $"W: \$SUDO_USER and \$USERHELPER_UID are empty" && \
165            return 1
166           
[3352]167        RPM_SIGN_USER=$(getent passwd $USERHELPER_UID | cut -d":" -f1)
[3343]168    fi
169    ## get $RPM_SIGN_USER's home directory
170    HOME=$(getent passwd $RPM_SIGN_USER |  cut -d":" -f6)
171
[323]172    ## load default settings
[725]173    VBUILDER_CONF=/etc/vbootstrap/vbuilder.conf
174    if [ -r $VBUILDER_CONF ]; then
175        . $VBUILDER_CONF
[1240]176        [ $? -eq 1 ] && return 1
[323]177    fi
[791]178    [ -z "${CATEGORIES}" ] && \
179        CATEGORIES=@@VBUILDER_CATEGORIES@@
[5364]180    [ -z "${VBOOTSTRAP_FETCH_URL}" ] && \
181        VBOOTSTRAP_FETCH_URL=@@VBUILDER_VBOOTSTRAP_FETCH_URL@@
[330]182    [ -z "${VBOOTSTRAP_DIR}" ] && \
183        VBOOTSTRAP_DIR=@@VBUILDER_VBOOTSTRAP_DIR@@
[2711]184    [ -z "${UNIONFS_DIR}" ] && \
185        UNIONFS_DIR=@@VBUILDER_UNIONFS_DIR@@
[725]186    [ -z "${CACHE_DIR}" ] && \
187        CACHE_DIR=@@VBUILDER_CACHE_DIR@@
[370]188    [ -z "${BUILT_RPMS_DIR}" ] && \
189        BUILT_RPMS_DIR=@@VBUILDER_BUILT_RPMS_DIR@@
[709]190
[5368]191    ## set default version for vbootstrap
192    VERSION=@@VBUILDER_DEFAULT_VERSION@@
193
[5364]194    ## load profile
195    if [ ${with_profile} -eq 1 ]; then
196        [ ! -r /etc/vbootstrap/profile.d/${PROFILE}.conf ] && \
197            echo $"E: No such profile found: ${PROFILE}" && return 1
198
199        . /etc/vbootstrap/profile.d/${PROFILE}.conf
200        [ $? -eq 1 ] && return 1
201    fi
202
[709]203    ## set current stable relase version
[411]204    STABLE_VERSION=@@VBUILDER_STABLE_VERSION@@
205
[3676]206    ## set default chroot archtecture
207    UARCH=$(uname -i)
208    case "${UARCH}" in
209        arm*)
210            UARCH="arm"
211            ;;
212    esac
213
[1240]214    return 0
[323]215}
216
[118]217setup-vbootstrap(){
[411]218    if [ ${with_setup_vbootstrap} -eq 0 ]; then
219        with_setup_vbootstrap=1
[118]220
[2718]221        ## check debug mode
222        [ ${with_debug} -eq 1 ] && \
[3675]223            cat $VBUILDER_CONF && \
[2718]224            set && set -x
225
[725]226        ## check some directories
227        ## Note: create $BUILT_RPMS_DIR in RPM_Build()
[709]228        [ -d $VBOOTSTRAP_DIR ] || mkdir -p $VBOOTSTRAP_DIR
[725]229        [ -d $CACHE_DIR ] || mkdir -p $CACHE_DIR
[709]230
[3676]231        ## check chroot version
232        case ${VERSION} in
[10958]233            4.2|5.2|6|6.5|VineSeed)
[2718]234                ;;
[6665]235            6.?)
236                VERSION="6"
237                ;;
[3676]238            *)
239                echo $"E: ${VERSION} is NOT supported"
240                return 1
241                ;;
[2718]242        esac
243
244        case "${VARCH}" in
245            arm*)
246                VARCH="arm"
247                ;;
248        esac
249
[304]250        ## check a chroot archtecture
[725]251        if [ -z ${VARCH} ]; then
[2718]252            VARCH=${UARCH}
[725]253        else
[304]254            case "${VARCH}" in
[3676]255                i386|x86_64)
256                    [ "${UARCH}" = "ppc" -o "${UARCH}" = "arm" ] && \
257                        echo $"E: arch ${VARCH} is NOT supported on ${UARCH}" && return 1
[304]258                    ;;
259                ppc)
[3676]260                    [ "${UARCH}" = "i386" -o "${UARCH}" = "x86_64" -o "${UARCH}" = "arm" ] && \
261                        echo $"E: arch ${VARCH} is NOT supported on ${UARCH}" && return 1
[304]262                    ;;
[2718]263                arm)
[3676]264                    [ "${UARCH}" = "i386" -o "${UARCH}" = "x86_64" -o "${UARCH}" = "ppc" ] && \
[2718]265                        echo $"E: arch ${VARCH} is NOT supported on ${UARCH}" && return 1
266                    ;;
[304]267            esac
[323]268        fi
269
[3676]270        ##!! 4.2 is NO support on VARCH=x86_64 or VARCH=arch
271        if [ "${VERSION}" = "4.2" ]; then
272            if [ "${VARCH}" = "x86_64" -o "${VARCH}" = "arm" ]; then
273                echo $"E: ${VERSION}_${VARCH} is NOT supported"
274                return 1
275            fi
[323]276        fi
277
[5364]278        ## set base profile <version>_<arch>
279        BASE_PROFILE=${VERSION}_${VARCH}
[2718]280
[5364]281        ## check support ${BASE_PROFILE}
282        if [ -z "$(/usr/sbin/vbootstrap | sed -e s/^Usage:.*// -e s/^E:.*// | grep -m 1 ${BASE_PROFILE})" ]; then
283            echo $"E: ${BASE_PROFILE} is NOT supported"
[2516]284            return 1
[323]285        fi
286
[411]287        ## check ${VERSION} equals VineSeed*, when with_dist_upgrade=1
288        if [ $with_dist_upgrade -eq 1 ]; then
[3676]289            if [ "${VERSION}" != "VineSeed" ]; then
[2516]290                echo $"E: version ${VERSION} does not support --dist-upgrade option"
291                return 1
[411]292            fi
293        fi
294
[3676]295        ## support i386 chroot on x86_64 below:
296        [ "${UARCH}" = "x86_64" -a "${VARCH}" = "i386" ] && \
297            with_ix86_on_x86_64=1
[791]298
299        ## check apt categories
[800]300        ## "main" category is unconditionally permited
[791]301        with_category_main=1
302        for cat in $(echo ${CATEGORIES} | sed -e "s/,/ /"g); do
303            case $cat in
304                main)
305                    with_category_main=1
306                    ;;
307                plus)
308                    with_category_plus=1
309                    ;;
310                nonfree)
311                    with_category_nonfree=1
312                    ;;
[800]313                test)
314                    ## "test" category only exists in VineSeed
[3676]315                    [ "${VERSION}" = "VineSeed" ] || \
[2516]316                        echo $"E: No such category exists: $cat" && return 1
[800]317                    with_category_test=1
318                    ;;
[791]319                proposed-updates)
[800]320                    ##!! "proposed-updates" category does not exist in 4.2
[3676]321                    [ "${VERSION}" = "4.2" ] && \
[2516]322                        echo $"E: No such category exists: $cat" && return 1
[791]323
324                    with_category_proposed_updates=1
325                    ;;
[800]326                security)
327                    ## "security" category does not exist in VineSeed
[3676]328                    [ "${VERSION}" = "VineSeed" ] && \
[2516]329                        echo $"E: No such category exists: $cat" && return 1
[800]330                    with_category_security=1
331                    ;;
[791]332                *)
[2516]333                    echo $"E: No such category exists: $cat" && return 1
[791]334                    ;;
335            esac
336        done
337
[406]338        ## check build target option ${TARGET}
[407]339        if [ ! -z "${TARGET}" ]; then
340            RPM_TARGET_LIST="$(cat /usr/lib/rpm/rpmrc | grep arch_canon: | sed -e "s/arch_canon:[[:blank:]]*\(.*\):.*/\1/")"
[3742]341            RPM_TARGET_LIST="${RPM_TARGET_LIST} noarch"
342            if [ -z "$(echo ${RPM_TARGET_LIST} | grep ${TARGET})" ]; then
[2516]343                echo $"E: rpm build target ${TARGET} is NOT supported"
344                return 1
[407]345            fi
[406]346        fi
347
[1240]348        ## set ${RPM_PKG_ARCH_LIST}
[5364]349        RPM_PKG_ARCH_LIST=" \
350            RPMS/i386 RPMS/i486 RPMS/i586 RPMS/i686 RPMS/x86_64 RPMS/ppc \
351            RPMS/noarch \
352            RPMS/armv3l RPMS/armv4l RPMS/armv4tl \
353            RPMS/armv5tejl RPMS/armv5tel RPMS/armv6l RPMS/armv7l \
354            SRPMS"
[1240]355        [ -z "${TARGET}" ] || \
356            RPM_PKG_ARCH_LIST="RPMS/${TARGET} ${RPM_PKG_ARCH_LIST}"
357
[135]358    fi
[323]359
[1240]360    ## set global variables
[296]361    BUILD_USER=vbuilder
362    BUILD_DIR=/home/${BUILD_USER}/rpm
[5364]363    if [ ${with_profile} -eq 1 ]; then
364        BUILD_ROOT=${VBOOTSTRAP_DIR}/${PROFILE}
365        UNIONFS_ROOT=${UNIONFS_DIR}/${PROFILE}
366    else
367        BUILD_ROOT=${VBOOTSTRAP_DIR}/${BASE_PROFILE}
368        UNIONFS_ROOT=${UNIONFS_DIR}/${BASE_PROFILE}
369    fi
[452]370    ARCHIVES_DIR=${BUILD_ROOT}/var/cache/apt/archives
[5364]371    EXTERNAL_ARCHIVES_DIR=${CACHE_DIR}/${BASE_PROFILE}/apt/archives
[11148]372    UNIONFS_WORK=${UNIONFS_DIR}/unionfs_work
[135]373
[2468]374    __chroot_sh="/usr/sbin/chroot ${BUILD_ROOT} /bin/sh -c -l"
[453]375
[135]376    mkdir -p $VBOOTSTRAP_DIR
[1240]377
378    return 0
[118]379}
380
[412]381setup-vbootstrap-rpm(){
[1240]382    setup-vbootstrap || return 1
[412]383
384    ## check ${BUILD_ROOT}
385    [ -d ${BUILD_ROOT} ] || Build
[2324]386    ## setarch ix86 if ix86 chroot on x86_64 host
387    [ $with_ix86_on_x86_64 -eq 1 ] && \
[2468]388        __chroot_sh="/usr/sbin/chroot ${BUILD_ROOT} setarch ${VARCH} /bin/sh -c -l"
[412]389
390    DIST_RELEASE=$(cat ${BUILD_ROOT}/etc/vine-release | cut -f3 -d" " | cut -f1 -d.)
391
392    if [ -f $RPM_PKG ]; then
393        BASE_RPM_PKG=$(basename $RPM_PKG)
394        cp -f $RPM_PKG $BUILD_ROOT${BUILD_DIR}
395    else
396        BASE_RPM_PKG=$RPM_PKG   
397    fi
[1240]398
399    return 0
[412]400}
401
[413]402## recover apt-get data on host/chroot
403apt-get-update(){
404    case $1 in
405        --host)
[2522]406            echo -n $"apt-get update on host ... "
[464]407            apt-get -qq update > /dev/null 2>&1
[2522]408            echo $"done."
[413]409            ;;
410        --chroot)
[2522]411            echo -n $"apt-get update on chroot ... "
[464]412            $__chroot_sh 'apt-get -qq update' > /dev/null 2>&1
[2522]413            echo $"done."
[413]414            ;;
415        *)
416            echo apt-get-update: unknown option $1
417            exit 1
418            ;;
419    esac
420}
421
[454]422## mount-chroot {|--umount} [file system|name]
423## support file systems: /home /tmp /sys /proc /dev/shm /dev/pts /dev
[2654]424## support names: vfs archives_dir
[454]425## NOTE: /tmp needs for applications which use X
426##       vfs is virtual file systems
[851]427##       archives_dir uses to mount ${EXTERNAL_ARCHIVES_DIR} to ${ARCHIVES_DIR}
428##       unionfs_dir covers ${BUILD_ROOT} with unionfs
[454]429mount-chroot(){
[412]430    if [ "$1" = "--umount" ]; then
[454]431        mount-chroot-umount $2 || return 1
[412]432    else
[454]433        mount-chroot-mount $1 || return 1
[412]434    fi
[454]435    return 0
[412]436}
437
[454]438## mount-chroot-umount [file system|name]
439mount-chroot-umount(){
440    local fs=$1
441    case $fs in
442        /home|/tmp|/sys|/proc|/dev/shm|/dev/pts|/dev)
443            [ -d ${BUILD_ROOT}${fs} ] || return 1
444            [ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] || \
445                umount ${BUILD_ROOT}${fs}
[2654]446            if [ ! -z "$(mount | grep ${BUILD_ROOT}${fs})" ]; then
447                echo $"Retry lazy unmount ${BUILD_ROOT}${fs} ... "
448                umount -l ${BUILD_ROOT}${fs}
449                echo $"done."
450            fi
[454]451            ;;
452        vfs)
[2718]453            for dir in /sys /proc /dev/shm /dev/pts /dev; do
454                mount-chroot-umount ${dir} || return 1
455            done
[454]456            ;;
[725]457        archives_dir)
[454]458            [ -d ${ARCHIVES_DIR} ] || return 1
459            [ -z "$(mount | grep ${ARCHIVES_DIR})" ] || \
460                umount ${ARCHIVES_DIR}
461            ;;
[485]462        unionfs_dir)
463            [ -d ${BUILD_ROOT} ] || return 1
[11148]464            [ -z "$(mount | grep ${BUILD_ROOT} | egrep '(unionfs|aufs|overlay)')" ] || \
[485]465                umount ${BUILD_ROOT}
[11148]466            if [ ! -z "$(mount | grep ${BUILD_ROOT} | egrep '(unionfs|aufs|overlay)')" ]; then
[2654]467                echo $"Retry lazy unmount ${BUILD_ROOT} ... "
[485]468                umount -l ${BUILD_ROOT}
[2522]469                echo $"done."
[485]470            fi
471            ;;
[454]472        *)
473            echo mount-chroot-umount: unknown file system $fs
474            exit 1
475            ;;
476    esac
[1240]477    return 0
[412]478}
479
[454]480## mount-chroot-mount [file system|name]
481mount-chroot-mount(){
482    local fs=$1
[412]483
[454]484    case $fs in
485        /home)
[2718]486            [ -d ${BUILD_ROOT}${fs} ] || mkdir -p ${BUILD_ROOT}${fs}
487            [ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] && \
488                mount -o _netdev,rbind ${fs} ${BUILD_ROOT}${fs}
[454]489            ;;
[2718]490        /tmp|/dev)
491            [ -d ${BUILD_ROOT}${fs} ] || mkdir -p ${BUILD_ROOT}${fs}
492            [ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] && \
493                mount --bind -o _netdev ${fs} ${BUILD_ROOT}${fs}
[454]494            ;;
[2718]495        /sys)
[454]496            [ -d ${BUILD_ROOT}${fs} ] || mkdir -p ${BUILD_ROOT}${fs}
497            [ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] && \
[2718]498                mount -o _netdev -t sysfs vbuildersysfs ${BUILD_ROOT}${fs}
[454]499            ;;
[2718]500        /proc)
501            [ -d ${BUILD_ROOT}${fs} ] || mkdir -p ${BUILD_ROOT}${fs}
502            [ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] && \
503                mount -o _netdev -t proc vbuilderproc ${BUILD_ROOT}${fs}
504            ;;
505        /dev/shm)
506            [ -d ${BUILD_ROOT}${fs} ] || mkdir -p ${BUILD_ROOT}${fs}
507            [ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] && \
508                mount -o _netdev -t tmpfs vbuildertmpfs ${BUILD_ROOT}${fs}
509            ;;
510        /dev/pts)
511            [ -d ${BUILD_ROOT}${fs} ] || mkdir -p ${BUILD_ROOT}${fs}
512            [ -z "$(mount | grep ${BUILD_ROOT}${fs})" ] && \
513                mount -o gid=5,mode=620,_netdev -t devpts vbuilderdevpts ${BUILD_ROOT}${fs}
514            ;;
[454]515        vfs)
[2718]516            for dir in /dev /dev/pts /dev/shm /proc /sys; do
517                mount-chroot-mount ${dir} || return 1
518            done
[454]519            ;;
[725]520        archives_dir)
521            [ -d ${EXTERNAL_ARCHIVES_DIR} ] || mkdir -p ${EXTERNAL_ARCHIVES_DIR}
[454]522            [ -d ${ARCHIVES_DIR} ] || mkdir -p ${ARCHIVES_DIR}
523            [ -z "$(mount | grep ${ARCHIVES_DIR})" ] && \
[2718]524                mount --bind -o _netdev ${EXTERNAL_ARCHIVES_DIR} ${ARCHIVES_DIR}
[454]525            [ -d ${ARCHIVES_DIR}/partial ] || mkdir -p ${ARCHIVES_DIR}/partial
526            ;;
[485]527        unionfs_dir)
528            if [ $with_unionfs -eq 1 ]; then
[2711]529                [ -d ${UNIONFS_ROOT} ] || mkdir -p ${UNIONFS_ROOT}
[11148]530                if [ -d ${UNIONFS_WORK} ]; then
531                    #workdir needs emply
532                    rm -rf ${UNIONFS_WORK}; mkdir -p ${UNIONFS_WORK}
533                else
534                    mkdir -p ${UNIONFS_WORK}
535                fi
536                /sbin/modprobe overlay >& /dev/null ||:
[6376]537                /sbin/modprobe aufs >& /dev/null ||:
[11148]538                #overlayfs
539                if ( grep -q overlay /proc/filesystems ) ; then
[5504]540                    [ -z "$(mount | grep ${UNIONFS_ROOT})" ] && \
[11148]541                        mount -t overlay overlay -o lowerdir=${BUILD_ROOT},upperdir=${UNIONFS_ROOT},workdir=${UNIONFS_WORK} ${BUILD_ROOT}
542                #aufs
543                elif ( grep -q aufs /proc/filesystems ) ; then
544                    [ -z "$(mount | grep ${UNIONFS_ROOT})" ] && \
[5504]545                        mount -t aufs -o br=${UNIONFS_ROOT}=rw:${BUILD_ROOT}=ro aufs ${BUILD_ROOT}
546                else
[11148]547                #unionfs
[5504]548                    [ -z "$(mount | grep ${UNIONFS_ROOT})" ] && \
549                        mount -t unionfs -o dirs=${UNIONFS_ROOT}=rw:${BUILD_ROOT}=ro unionfs ${BUILD_ROOT}
550                    unionctl ${BUILD_ROOT} --list
551                fi
[485]552            fi
553            ;;
[455]554        *)
555            echo mount-chroot-mount: unknown file system $fs
556            exit 1
557            ;;
[454]558    esac
[1240]559    return 0
[452]560}
[412]561
[5364]562## TODO: support spec-validator
563## spec-validator [spec file]
564spec-validator(){
565    echo
566    return 0
567}
[791]568
[5364]569
[118]570##############################################################################
571
572Clean(){
[1240]573    setup-vbootstrap || return 1
[118]574
[454]575    # mount-chroot --umount /home
[2718]576    mount-chroot --umount /tmp
577    mount-chroot --umount /dev/shm
578    mount-chroot --umount /dev/pts
[3021]579    mount-chroot --umount /proc
[725]580    mount-chroot --umount archives_dir
[485]581    mount-chroot --umount unionfs_dir
[413]582    apt-get-update --host
[406]583
[2770]584    ## We remark that we first remove /, and secondly remove /.
[2769]585    ## If we directly remove /, we obtained some non-empty directories:
586    ##   /dev/.udev/rules.d.
[485]587    if [ $with_unionfs -eq 1 ]; then
[2711]588        if [ -d ${UNIONFS_ROOT} ]; then
589            echo -n $"Cleaning build root ${UNIONFS_ROOT} via unionfs ... "
[2770]590            rm -rf ${UNIONFS_ROOT} 2>/dev/null
[2711]591            rm -rf ${UNIONFS_ROOT}
[2522]592            echo $"done."
[485]593        fi
594    else
595        if [ -d ${BUILD_ROOT} ]; then
[2522]596            echo -n $"Cleaning build root ${BUILD_ROOT} ... "
[2770]597            rm -rf ${BUILD_ROOT} 2>/dev/null
[485]598            rm -rf ${BUILD_ROOT}
[2522]599            echo $"done."
[485]600        fi
[323]601    fi
[412]602
[5364]603    echo $"Cleanup a build farm for ${BUILD_ROOT} done."
[1240]604    return 0
[118]605}
606
607Build(){
[1240]608    setup-vbootstrap || return 1
[118]609
[411]610    if [ $with_dist_upgrade -eq 1 ]; then
611        ## make bootstrap of ${STABLE_VERSION}
612        /usr/sbin/vbootstrap \
[5364]613            $(echo ${BASE_PROFILE} | sed -e "s/VineSeed/${STABLE_VERSION}/") \
[5442]614            ${VBOOTSTRAP_FETCH_URL} ${BUILD_ROOT} 2>&1 | \
615            egrep -v -e '^W: Duplicate sources.list entry' \
616                     -e '^W: .*apt-get update'
[118]617
[411]618        ## aim apt-line to VineSeed
619        sed -i "s/apt ${STABLE_VERSION}/apt VineSeed/g" \
620            ${BUILD_ROOT}/etc/apt/sources.list.d/main.list
621    else
[5442]622        /usr/sbin/vbootstrap \
623            ${BASE_PROFILE} ${VBOOTSTRAP_FETCH_URL} ${BUILD_ROOT} 2>&1 | \
624            egrep -v -e '^W: Duplicate sources.list entry' \
625                     -e '^W: .*apt-get update'
[411]626    fi
627
[2718]628    mount-chroot /proc
[725]629    mount-chroot archives_dir
[2718]630    mount-chroot /dev/pts
631    mount-chroot /dev/shm
[454]632    # mount-chroot /tmp
633    # mount-chroot /home
[118]634
[6713]635    local __replace_fetch_url="sed -i -e s|@@VBUILDER_VBOOTSTRAP_FETCH_URL@@|${VBOOTSTRAP_FETCH_URL}|g"
[3676]636    case ${VERSION} in
[791]637        4.2)
[6713]638            ##!! 4.2 has no apt-sourceslist-{plus,nonfree,proposed-updates} packages
639            $__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list
640            for i in main plus nonfree; do
641                [ ! -z "$(echo ${CATEGORIES} | grep ${i})" ] && continue
642                sed -i -e "s, ${i},,g" ${BUILD_ROOT}/etc/apt/sources.list
643            done
[5364]644            $__chroot_sh 'apt-get -qq update && apt-get -qq -y dist-upgrade'
[800]645            # [ $with_category_security -eq 1 ] && \
646            #   echo
[791]647            ;;
[10958]648        5.2|6|@@VBUILDER_STABLE_VERSION@@)
[6713]649            $__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list.d/main.list
[5364]650            $__chroot_sh 'apt-get -qq update && apt-get -qq -y dist-upgrade'
[791]651            [ $with_category_plus -eq 1 ] && \
[5364]652                $__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-plus' && \
[6713]653                $__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list.d/plus.list
[791]654            [ $with_category_nonfree -eq 1 ] && \
[5364]655                $__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-nonfree' && \
[6713]656                $__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list.d/nonfree.list
[791]657            [ $with_category_proposed_updates -eq 1 ] && \
[5364]658                $__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-proposed-updates' && \
[6713]659                $__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list.d/proposed-updates.list
[800]660            # [ $with_category_security -eq 1 ] && \
661            #   echo
[791]662            ;;
663        VineSeed)
[6713]664            $__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list.d/main.list
[5364]665            $__chroot_sh 'apt-get -qq update && apt-get -qq -y dist-upgrade'
[791]666            [ $with_category_plus -eq 1 ] && \
[5364]667                $__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-plus' && \
[6713]668                $__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list.d/plus.list
[791]669            [ $with_category_nonfree -eq 1 ] && \
[5364]670                $__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-nonfree' && \
[6713]671                $__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list.d/nonfree.list
[800]672            [ $with_category_test -eq 1 ] && \
[5364]673                $__chroot_sh 'apt-get -qq update && apt-get -qq -y install apt-sourceslist-test' && \
[6713]674                $__replace_fetch_url ${BUILD_ROOT}/etc/apt/sources.list.d/test.list
[791]675            ;;
676    esac
[423]677
[791]678    [ $with_dist_upgrade -eq 1 ] && \
[464]679        $__chroot_sh 'apt-get -qq update && apt-get -qq -y dist-upgrade'
[791]680
[5508]681    [ $with_build_essential -eq 1 ] && \
682        $__chroot_sh 'apt-get -qq -y install build-essential'
683
[6665]684    $__chroot_sh 'apt-get -qq -y install etcskel shadow-utils MAKEDEV'
[118]685
[2662]686    $__chroot_sh 'cd /dev && /sbin/MAKEDEV console'
[2718]687    $__chroot_sh 'cd /dev && /sbin/MAKEDEV ptmx'
[2662]688    $__chroot_sh 'cd /dev && /sbin/MAKEDEV null'
689    $__chroot_sh 'cd /dev && /sbin/MAKEDEV zero'
690    $__chroot_sh 'cd /dev && /sbin/MAKEDEV random'
691    $__chroot_sh 'cd /dev && /sbin/MAKEDEV urandom'
[2718]692    $__chroot_sh 'cd /dev && mkdir -p shm && chmod 777 shm'
693    $__chroot_sh 'cd /dev && mkdir -p pts && chmod 755 pts'
[406]694
[453]695    $__chroot_sh '/usr/sbin/pwconv'
696    $__chroot_sh "/usr/sbin/useradd ${BUILD_USER}"
[323]697
[452]698    ##!! for rpm-4.8.0 or higher
699    ##!! (See http://trac.vinelinux.org/wiki/Vine6/AboutUpdateToolchain)
[3676]700    if [ "${VERSION}" = "VineSeed" ]; then
[453]701        $__chroot_sh "sed -i -e 's/^%_topdir/#%_topdir/' /home/${BUILD_USER}/.rpmmacros"
[452]702    fi
703
[5364]704    ## set local repositories (profile only)
705    if [ ${with_profile} -eq 1 ]; then
706        if [ ! -z "${LOCAL_REPOS}" ]; then
707            cat >${BUILD_ROOT}/etc/apt/sources.list.d/local.list<<EOF
708${LOCAL_REPOS}
709EOF
[5510]710        $__chroot_sh "apt-get update"
[5364]711        fi
712
713        ## additional base packages
714        [ ! -z "${ADD_BASE_PKGS}" ] && \
715            $__chroot_sh "apt-get -y install ${ADD_BASE_PKGS}" 
716    fi
717
[454]718    # mount-chroot --umount /home
719    # mount-chroot --umount /tmp
[2718]720    mount-chroot --umount /dev/shm
721    mount-chroot --umount /dev/pts
[725]722    mount-chroot --umount archives_dir
[2718]723    mount-chroot --umount /proc
[413]724    apt-get-update --host
[412]725
[5364]726    echo $"Making a build farm for ${BUILD_ROOT} done."
[1240]727    return 0
[118]728}
729
730RPM_Remove(){
[1240]731    setup-vbootstrap-rpm || return 1
[485]732    mount-chroot unionfs_dir
[725]733    mount-chroot archives_dir
[3021]734    mount-chroot /proc
[2718]735    mount-chroot /dev/pts
736    mount-chroot /dev/shm
[6010]737    # apt-get-update --chroot
[118]738
[2516]739    [ -f $RPM_PKG ] && \
740        echo $"E: $RPM_PKG is not a package name" && return 1
[453]741    $__chroot_sh "apt-get -y remove $BASE_RPM_PKG"
[412]742
[2718]743    mount-chroot --umount /dev/shm
744    mount-chroot --umount /dev/pts
[3021]745    mount-chroot --umount /proc
[725]746    mount-chroot --umount archives_dir
[485]747    mount-chroot --umount unionfs_dir
[6010]748    # apt-get-update --host
[1240]749
750    return 0
[118]751}
752
753RPM_Install(){
[1240]754    setup-vbootstrap-rpm || return 1
[485]755    mount-chroot unionfs_dir
[725]756    mount-chroot archives_dir
[3021]757    mount-chroot /proc
[2718]758    mount-chroot /dev/pts
759    mount-chroot /dev/shm
[413]760    apt-get-update --chroot
[118]761
[4622]762    [ $with_category_nonfree -eq 1 ] && \
763        [ ! -z "$(echo $BASE_RPM_PKG | grep -e 'self-build-' -e 'install-assist-')" ] && \
764        $__chroot_sh 'rpm -q --quiet self-build-setup || apt-get -qq -y install self-build-setup'
765
[453]766    $__chroot_sh "cd ${BUILD_DIR} && apt-get -y install $BASE_RPM_PKG"
[412]767
[2718]768    mount-chroot --umount /dev/shm
769    mount-chroot --umount /dev/pts
[3021]770    mount-chroot --umount /proc
[725]771    mount-chroot --umount archives_dir
[485]772    mount-chroot --umount unionfs_dir
[413]773    apt-get-update --host
[1240]774
775    return 0
[118]776}
777
778RPM_Build(){
[5364]779    [ ! -f ${RPM_PKG} ] && \
780        echo $"E: No such file found: ${RPM_PKG}" && return 1
781
782    ## check the extension of given $RPM_PKG
783    local RPM_PKG_EXT=${RPM_PKG##*.}
784    case ${RPM_PKG_EXT} in
785        spec)
786            ## In this case,
787            ## the file ${RPM_PKG} is a spec file!
788            # spec-validator ${RPM_PKG} || return 1
789            # return 1
790
791            ## We assign the variable ${RPM_PKG}
792            ## the src.rpm generated by the spec file ${RPM_PKG}.
793            RPM_PKG=$(rpm -E "%{_srcrpmdir}")/$(rpm -q --qf "%{name}-%{version}-%{release}\n" --specfile ${RPM_PKG} | head -n 1).src.rpm
794            ;;
795        rpm)
796            RPM_PKG_EXT=$(echo ${RPM_PKG} | sed -e "s|.*\.\(src\.rpm\)$|\1|")
797            [ "${RPM_PKG_EXT}" != "src.rpm" ] && \
798                echo $"E: $RPM_PKG is NOT a source RPM package" && return 1
799            ;;
800        *)
801            echo $"The action build-rpm cannot work such extension: ${RPM_PKG_EXT}"
802            return 1
803            ;;
804    esac
805
[1240]806    setup-vbootstrap-rpm || return 1
[485]807    mount-chroot unionfs_dir
[725]808    mount-chroot archives_dir
[3021]809    mount-chroot /proc
[2718]810    mount-chroot /dev/pts
811    mount-chroot /dev/shm
[628]812    apt-get-update --chroot
[5364]813   
814    [ ! -f ${RPM_PKG} ] && \
815        echo $"E: No such file found: ${RPM_PKG}" && return 1
[118]816
[370]817    RPM_PKG_USER=$(stat -c %U $RPM_PKG)
[371]818    RPM_PKG_GROUP=$(stat -c %G $RPM_PKG)
[520]819    [ ! -z "${SUDO_UID}" ] && RPM_PKG_USER=${SUDO_UID}
820    [ ! -z "${SUDO_GID}" ] && RPM_PKG_GROUP=${SUDO_GID}
[371]821    local __install="install -p -v -o ${RPM_PKG_USER} -g ${RPM_PKG_GROUP}"
[370]822
823    ## make src.rpm for $VERSION
[453]824    $__chroot_sh "cd ${BUILD_DIR} && su ${BUILD_USER} -c 'rpm -ivh $BASE_RPM_PKG'"
[1524]825    $__chroot_sh "cd ${BUILD_DIR} && su ${BUILD_USER} -c 'rpmbuild -bs --nodeps --clean --rmsource --rmspec $RPM_OPTS ${BUILD_DIR}/SPECS/*.spec'"
[370]826
[396]827
828    ## change ${DIST_RELEASE}
[4003]829    BASE_RPM_PKG=$(echo $BASE_RPM_PKG | sed -e "s/vl[0-9]*\([A-Za-z]*[0-9A-Za-z]*\)\./vl${DIST_RELEASE}\1\./")
[396]830
831    ## rebuild $BASE_RPM_PKG on ${DIST_RELEASE}
[969]832    $__chroot_sh "cd ${BUILD_DIR}/SRPMS && apt-get -o APT::Install::Virtual=true -y build-dep $BASE_RPM_PKG"
[453]833    $__chroot_sh "cd ${BUILD_DIR}/SRPMS && su ${BUILD_USER} -c 'rpmbuild --rebuild $RPM_OPTS $BASE_RPM_PKG'"
[4622]834
[6713]835    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')
[4622]836
837    [ $with_category_nonfree -eq 1 ] && \
838        [ ! -z "$(echo $BUILT_RPMS_LIST | grep -e 'self-build-' -e 'install-assist-')" ] && \
839        $__chroot_sh 'rpm -q --quiet self-build-setup || apt-get -qq -y install self-build-setup'
840
[1267]841    [ $with_no_install -eq 0 ] && \
[4622]842        $__chroot_sh "cd ${BUILD_DIR} && apt-get -y install $BUILT_RPMS_LIST"
[396]843
[370]844    ## copy built rpms to ${HOME}/rpm/ for each archtectures
[2522]845    echo $"Copying built rpms to ${BUILT_RPMS_DIR} for each archtectures ... "
[4076]846    for i in $RPM_PKG_ARCH_LIST; do
847        [ -d $BUILD_ROOT${BUILD_DIR}/${i} ] || continue
848        if [ ! -d ${BUILT_RPMS_DIR}/${VERSION}/${i} ]; then
849            $__install -d ${BUILT_RPMS_DIR}/${VERSION}/${i}/
850            chown -R ${RPM_PKG_USER}:${RPM_PKG_GROUP} ${BUILT_RPMS_DIR}
[370]851        fi
[4076]852        find $BUILD_ROOT${BUILD_DIR}/${i} -type f -regex '.*\.rpm' \
853            -exec $__install -m0644 {} ${BUILT_RPMS_DIR}/${VERSION}/${i}/ \;
[370]854    done
[412]855
[2718]856    mount-chroot --umount /dev/shm
857    mount-chroot --umount /dev/pts
[3021]858    mount-chroot --umount /proc
[725]859    mount-chroot --umount archives_dir
[485]860    mount-chroot --umount unionfs_dir
[413]861    apt-get-update --host
[412]862
[2522]863    echo $"done."
[1240]864    return 0
[118]865}
866
[1240]867RPM_Sign(){
[1375]868    [ $with_sign -eq 1 ] || return 1
[118]869
[2668]870    setup-vbootstrap || return 1
871
872    [ -d ${BUILD_ROOT} ] || Build
873
874    mount-chroot unionfs_dir
875
[2662]876    echo $"Signing built rpms using ${RPM_SIGN_USER}'s key: "
[5364]877    su $RPM_SIGN_USER -c "rpmsign --addsign $(for i in $RPM_PKG_ARCH_LIST; do find $BUILD_ROOT${BUILD_DIR}/${i} -type f -regex '.*\.rpm' 2>/dev/null; done | sed -e s,$BUILD_ROOT${BUILD_DIR},${BUILT_RPMS_DIR}/${VERSION},g -e 's/$/ \\/g')"
[1375]878
[2668]879    mount-chroot --umount unionfs_dir
880
[1240]881    return 0
882}
883
[2718]884Login_Chroot(){
885    [ $with_login -eq 1 ] || return 1
[1240]886
[2718]887    setup-vbootstrap || return 1
888
889    __chroot="/usr/sbin/chroot ${BUILD_ROOT}"
890    ## setarch ix86 if ix86 chroot on x86_64 host
891    [ $with_ix86_on_x86_64 -eq 1 ] && \
892        __chroot="/usr/sbin/chroot ${BUILD_ROOT} setarch ${VARCH}"
893
894
895    mount-chroot unionfs_dir
896    mount-chroot archives_dir
[3021]897    mount-chroot /proc
[2718]898    mount-chroot /dev/pts
899    mount-chroot /dev/shm
900    mount-chroot /tmp
901    # mount-chroot /home
[6010]902    # apt-get-update --chroot
[2718]903
904    ## copy host's configurations of /etc
905    #passwd shadow group gshadow
906    for i in resolv.conf hosts; do
907        cp -pf /etc/${i} ${BUILD_ROOT}/etc
908    done
909    cp -Ppf /etc/localtime ${BUILD_ROOT}/etc
910
[3678]911    $__chroot /bin/bash
[2718]912
913    # mount-chroot  --umount /home
914    mount-chroot  --umount /tmp
915    mount-chroot --umount /dev/shm
916    mount-chroot --umount /dev/pts
[3021]917    mount-chroot --umount /proc
[2718]918    mount-chroot --umount archives_dir
919    mount-chroot --umount unionfs_dir
[6010]920    # apt-get-update --host
[2718]921
922    return 0
923}
924
925
[304]926##############################################################################
927
[5364]928initialize-variables || exit 1
[304]929
[416]930check-parameter $* || exit 1
931
[5364]932setup-vbuilder || exit 1
933
[118]934while [ $# -gt 0 ]; do
[411]935    tmpARG=$1
936    case $tmpARG in
[5364]937        --profile)
[406]938            shift
939            ;;
[5364]940        --version|--arch|--category|--fetch-url|--target|--rpmbuild-define|--rpmbuild-with|--rpmbuild-without|--bootstrap-dir|--unionfs-dir|--cache-dir|--built-rpms-dir)
941            shift
942            ;;
[5508]943        --dist-upgrade|--unionfs|--with-compat32|--sign|--no-install|--login|--no-build-essential|--debug)
[406]944            ;;
[725]945        --build-rpm|build-rpm|--install-rpm|install-rpm|--remove-rpm|remove-rpm)
946            shift
947            ;;
[3675]948        --build|build|--clean|clean)
[725]949            ;;
[406]950        *)
[416]951            echo unknown option $1
[406]952            exit 1
953            ;;
954    esac
955
[411]956    case $tmpARG in
[5364]957        --profile)
958            ;;
[406]959        --version)
[118]960            VERSION=$1
961            ;;
962        --arch)
963            VARCH=$1
964            ;;
[791]965        --category)
966            CATEGORIES=$1
967            ;;
[5364]968        --fetch-url)
969            VBOOTSTRAP_FETCH_URL=$1
970            ;;
[411]971        --dist-upgrade)
972            with_dist_upgrade=1
973            ;;
[485]974        --unionfs)
975            with_unionfs=1
976            ;;
[406]977        --target)
978            TARGET=$1
979            RPM_OPTS="${RPM_OPTS} --target $TARGET"
980            ;;
[118]981        --with-compat32)
[406]982            RPM_OPTS="${RPM_OPTS} --with compat32"
[118]983            ;;
[2531]984        --rpmbuild-define)
985            RPM_OPTS="${RPM_OPTS} --define $1"
986            ;;
[1476]987        --rpmbuild-with)
988            RPM_OPTS="${RPM_OPTS} --with $1"
989            ;;
[2531]990        --rpmbuild-without)
991            RPM_OPTS="${RPM_OPTS} --without $1"
992            ;;
[1240]993        --sign)
994            with_sign=1
995            ;;
[1267]996        --no-install)
997            with_no_install=1
998            ;;
[5508]999        --no-build-essential)
1000            with_build_essential=0
1001            ;;
[2718]1002        --login)
1003            with_login=1
1004            ;;
[709]1005        --bootstrap-dir)
1006            VBOOTSTRAP_DIR=$1
1007            ;;
[2711]1008        --unionfs-dir)
1009            UNIONFS_DIR=$1
1010            ;;
[725]1011        --cache-dir)
1012            CACHE_DIR=$1
1013            ;;
[709]1014        --built-rpms-dir)
1015            BUILT_RPMS_DIR=$1
1016            ;;
[2718]1017        --debug)
1018            with_debug=1
1019            ;;
[679]1020        --build-rpm|build-rpm)
[118]1021            RPM_PKG=$1
[406]1022            RPM_Build || exit 1
[118]1023            ;;
[679]1024        --install-rpm|install-rpm)
[118]1025            RPM_PKG=$1
[406]1026            RPM_Install || exit 1
[118]1027            ;;
[679]1028        --remove-rpm|remove-rpm)
[118]1029            RPM_PKG=$1
[406]1030            RPM_Remove || exit 1
[118]1031            ;;
[679]1032        --build|build)
[1240]1033            Build || exit 1
[118]1034            ;;
[679]1035        --clean|clean)
[1240]1036            Clean || exit 1
[118]1037            ;;
1038    esac
1039    shift
1040done
1041
[3479]1042RPM_Sign ||:
[1240]1043
[3479]1044Login_Chroot ||:
[2718]1045
[118]1046exit
Note: See TracBrowser for help on using the repository browser.