#!/bin/sh # # Extract packages needed for full install, # by reading the group info of the repository # yum_conf=/tmp/g$$.yum.conf cat << 'EOF' > $yum_conf [main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=0 plugins=1 installonly_limit=5 bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum distroverpkg=centos-release reposdir= [c7-media] name=CentOS-$releasever - Media baseurl=file:///media/cdrom gpgcheck=0 enabled=1 EOF trap 'rm /tmp/g'"$$"'.*; trap - 0 1 2 15; exit' 0 1 2 15 set -x # available groups, extracted by "repoquery -g -a" and filtered out unwanted groups #grep -v anaconda-tools repoquery -c $yum_conf -g -a | awk '{print $1}' | grep -v '^conflicts-' > /tmp/g$$.g #echo "Available groups:" #cat /tmp/g$$.g # extract individual packages in specified groups repoquery -c $yum_conf --grouppkgs=all -g -l `< /tmp/g$$.g` | sort -u > /tmp/g$$.1 # recursive resolve dependent packages for each package while read i; do repoquery -c $yum_conf --qf '%{NAME}' --requires --resolve --recursive $i >> /tmp/g$$.2 done < /tmp/g$$.1 # collect language packs # -> autocorr-* sed -ne 's/^[ ]* /tmp/g$$.3 # sort and collect packages sort -u /tmp/g$$.1 /tmp/g$$.2 /tmp/g$$.3 > /tmp/g$$.5 #xxx output only package basenames #cat /tmp/g$$.5; exit # convert into "cp *.rpm ${DESTDIR}" #while read i; do # repoquery -c $yum_conf --qf 'cp -p %{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}.rpm ${DESTDIR}' >> /tmp/g$$.9 #done < /tmp/g$$.5 repoquery -c $yum_conf --qf 'cp -p %{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}.rpm ${DESTDIR}' `< /tmp/g$$.5` >> /tmp/g$$.9 cat /tmp/g$$.9 #trap rm /tmp/g$$.*