From 4c7bc94994c3e5b42030496b9f9cff8d1b79e7fa Mon Sep 17 00:00:00 2001 From: Brett Parker Date: Tue, 11 Nov 2014 15:02:33 +0000 Subject: [PATCH] Slightly updated, deal with x86_64 and fix bug in arch handling --- rpmbased-dist-chroot.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/rpmbased-dist-chroot.sh b/rpmbased-dist-chroot.sh index 7fd9a19..2349b2e 100755 --- a/rpmbased-dist-chroot.sh +++ b/rpmbased-dist-chroot.sh @@ -24,7 +24,7 @@ RPMArchives=/media/cdrom/Fedora/RPMS InstallRoot=/mnt/temp/fedora -installpackages="bash coreutils yum" +installpackages="bash coreutils yum basesystem redhat-release" ourcachedirectory=$(mktemp -d) @@ -32,6 +32,9 @@ architecture=$(uname -m) export ARCH=$architecture case $architecture in + x86_64) + architecture="x86_64,i686,i586,i486,i386" + ;; i686) architecture="i686,i586,i486,i386" ;; @@ -126,9 +129,11 @@ echo "InstallRoot : $InstallRoot" function buildcache() { cd $RPMArchives - for file in *.{noarch,$architecture}.rpm; do - rpm -qpl $file | sed 's#^#'$file':#' >> $ourcachedirectory/files-cache - rpm -qp --provides $file | cut -d " " -f 1 | sed 's#^#'$file':#' >> $ourcachedirectory/package-cache + for arch in noarch $(echo $architecture | sed -e 's/,/\n/g'); do + for file in *.$arch.rpm; do + rpm -qpl $file | sed 's#^#'$file':#' >> $ourcachedirectory/files-cache + rpm -qp --provides $file | cut -d " " -f 1 | sed 's#^#'$file':#' >> $ourcachedirectory/package-cache + done done } @@ -216,8 +221,10 @@ for package in $installpackages; do cd ${RPMArchives} && rpm -r ${InstallRoot} --ignorearch --install $(cat $ourcachedirectory/build-packagelist | cut -d ' ' -f 1) if ( ! grep " $package\$" $ourcachedirectory/build-packagelist > /dev/null 2>/dev/null ); then - echo rpm -r ${InstallRoot} --ignorearch --install $(findrpm $package) >> $ourcachedirectory/install-log - cd ${RPMArchives} && rpm -r ${InstallRoot} --ignorearch --install $(findrpm $package) + packages="$(findrpm $package)" + echo rpm -r ${InstallRoot} --ignorearch --install "${packages}" >> $ourcachedirectory/install-log + echo "${packages}" >> $ourcachedirectory/packages-installed + cd ${RPMArchives} && rpm -r ${InstallRoot} --ignorearch --install ${packages} fi else echo " Failed to find the RPM providing $package - skipping" -- 2.39.5