diff options
author | D. Johnson <fenris02@fedoraproject.org> | 2011-09-10 19:44:25 -0500 |
---|---|---|
committer | D. Johnson <fenris02@fedoraproject.org> | 2011-09-10 19:44:25 -0500 |
commit | 3c770b8f58ddaaf2da017b4b9a7c724e7c8b4146 (patch) | |
tree | ce5ff64c14e1b876cf97c3e87b31eb771bf62704 /distro-clean.sh | |
parent | 01f89f3c32826b8d764bcdb666b904461b1ecbd8 (diff) | |
download | cleanup-3c770b8f58ddaaf2da017b4b9a7c724e7c8b4146.tar.gz cleanup-3c770b8f58ddaaf2da017b4b9a7c724e7c8b4146.tar.xz cleanup-3c770b8f58ddaaf2da017b4b9a7c724e7c8b4146.zip |
Shorten yum-grouplist handling.
Diffstat (limited to 'distro-clean.sh')
-rw-r--r-- | distro-clean.sh | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/distro-clean.sh b/distro-clean.sh index a6ffc51..0813efd 100644 --- a/distro-clean.sh +++ b/distro-clean.sh @@ -6,6 +6,9 @@ TMPDIR=/root/tmp DEBUG="" +DS=$(date +%Y%d%m) +LANG=C + if [ "$(whoami)" != "root" ]; then echo "Must be run as root" exit 1 @@ -39,9 +42,6 @@ TEEPID=$! exec > $PIPEFILE 2>&1 #exec < /dev/null 2<&1 -DS=$(date +%Y%d%m) -YSHELL=${TMPDIR}/YUM-SHELL_${DS}.txt - setenforce 0 # @@ -68,6 +68,8 @@ rpm -a --setugids; rpm -a --setperms [ -x /usr/bin/package-cleanup ] || yum install yum-utils +YSHELL=${TMPDIR}/YUM-SHELL_${DS}.txt + # Locate installed leaves packages that were installed as a dep of some other package repoquery --installed --qf "%{nvra} - %{yumdb_info.reason}" \ `package-cleanup --leaves -q --all` \ @@ -78,12 +80,12 @@ repoquery --installed --qf "%{nvra} - %{yumdb_info.reason}" \ # Locate installed desktops yum grouplist -v \ - |sed '1,/^Installed/d;/^Available/,$d;s/[^()]*//;s/(//;s/)//;s/^/remove @/' \ - |grep desktop >> $YSHELL - -yum grouplist -v \ - |sed '1,/^Installed/d;/^Available/,$d;s/[^()]*//;s/(//;s/)//;s/^/install @/' \ - |grep desktop >> $YSHELL + |sed '1,/^Installed/d;/^Available/,$d;s/[^()]*//;s/(//;s/)//;' \ + |grep desktop \ + |while read GROUP; do + echo "remove @${GROUP}" >> $YSHELL + echo "install @${GROUP}" >> $YSHELL + done # Add default package sets cat ->> $YSHELL <<EOT |