RPMArchives=/media/cdrom/Fedora/RPMS
InstallRoot=/mnt/temp/fedora
-installpackages="bash coreutils yum"
+installpackages="bash coreutils yum basesystem redhat-release"
ourcachedirectory=$(mktemp -d)
export ARCH=$architecture
case $architecture in
+ x86_64)
+ architecture="x86_64,i686,i586,i486,i386"
+ ;;
i686)
architecture="i686,i586,i486,i386"
;;
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
}
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"