#!/bin/bash
#
# This script walks through the to-be-downgraded packages (world) and opts
# for adding the lastest unstable version to $KEYW_FILE (usually
# /etc/portage/package.keywords)
#
#-------------------------------------------------------------------------------
#
# Copyright (c) 2009 Henry78, mailto:henry78@gmx.at
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see .
#
#-------------------------------------------------------------------------------
#
#--- Changelog ---#
# 2009-04-17 by Henry: initial version
#
#--- Authors ---#
# Henry78, mailto:henry78@gmx.at
#--- Variables ---#
KEYW_FILE=/etc/portage/package.keywords
VER="0.1"
# text formatting
BoldOn="\033[1m"
BoldOff="\033[0m"
Green="\E[32m"
#--- Main ---#
echo -e "Using file ${Green}${BoldOn}$KEYW_FILE${BoldOff} for appending."
echo
echo
for PKG in $(eix --format " /" -I | grep downgrade | cut -d' ' -f2); do
# print full package description
eix -e $PKG
# find latest unstable version
PKG_STRING=$(ACCEPT_KEYWORDS="~x86" eix "-*" -e --format "<=fullbestslotupgradeshort>" $PKG)
echo
echo -en "Add ${Green}${BoldOn}$PKG_STRING${BoldOff}"
read -p " ? (y/n) "
if [ $REPLY != "y" ]; then
echo "Skipping $PKG"
else
echo "$PKG_STRING ~x86" >> $KEYW_FILE
fi
echo
echo
done