source: projects/self-build-setup/trunk/pre-allocate-rpm.sh @ 419

Revision 419, 1.1 KB checked in by munepi, 14 years ago (diff)

added self-build-setup

  • Property svn:executable set to *
Line 
1#!/bin/bash
2#
3# Helper script for self-build rpm package.
4# This script extract and allocate files prior to install rpm package.
5# arguments: rpmfile(s)
6
7TEXTDOMAIN=self-build-setup
8TEXTDOMAINDIR=/usr/share/locale
9
10_QUEDIR=/var/cache/self-build
11
12# create temporary file
13if ! _LIST_EXCLUDE=`mktemp /var/tmp/pre-allocate-exclude.XXXXXX`; then
14    echo -n "     "
15    echo $"*ERROR: can't crete temporary file."
16    exit 0
17fi
18
19# create list of files and extract it from rpm
20for f in $@; do
21    _RPM=$_QUEDIR/$f*.rpm
22    if [ -f $_RPM ] ; then
23        rpm -qpc $_RPM | sed -e 's/^/\./' > $_LIST_EXCLUDE
24        rpm -qpd $_RPM | sed -e 's/^/\./' >> $_LIST_EXCLUDE
25        cd /
26        if ! rpm2cpio $_RPM | cpio -idmu -f -E $_LIST_EXCLUDE >/dev/null 2>&1 ; then
27            echo -n "     "
28            echo $"*ERROR: can't extract files from rpm package."
29            exit 0
30        fi     
31    else
32        echo -n "     "
33        echo $"*ERROR: can't find rpm package."
34    exit 0
35    fi
36done
37
38echo -n "     "
39echo $"Pre-allocated required files from created rpm packages."
40
41# clean up
42rm -rf $_LIST_EXCLUDE
43
Note: See TracBrowser for help on using the repository browser.