summaryrefslogtreecommitdiffstats
path: root/sbin/keyword_package
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/keyword_package')
-rwxr-xr-xsbin/keyword_package26
1 files changed, 26 insertions, 0 deletions
diff --git a/sbin/keyword_package b/sbin/keyword_package
new file mode 100755
index 0000000..93b93d9
--- /dev/null
+++ b/sbin/keyword_package
@@ -0,0 +1,26 @@
+#!/bin/sh
+SPECIAL_LINE_COUNT=$(grep -nE "(/\*)|(\*/)" /etc/portage/package.keywords | tail -n 1 | awk -F: '{ print $1 }')
+TMP_FILE=$(mktemp)
+
+head -n $SPECIAL_LINE_COUNT /etc/portage/package.keywords > $TMP_FILE
+
+(
+ while [ -n "${1}" ] ; do
+ LINE="${1} ~x86"
+ if [ -z "$(grep "^${LINE}$" /etc/portage/package.keywords)" ]
+ then
+ echo "${LINE}"
+ echo "adding \"${LINE}\" to /etc/portage/package.keywords" | logger -st $(basename $0)
+ else
+ echo "Don't adding \"${1}\". Already there." > /dev/stderr
+ fi
+
+ shift 1
+ done
+
+ tail -n $(($(cat /etc/portage/package.keywords | wc -l)-$SPECIAL_LINE_COUNT)) /etc/portage/package.keywords
+) | grep -v "^$" | sort | awk -F/ '{ if (OLD_PREFIX!=$1) print ""; OLD_PREFIX=$1 ; print }' >> $TMP_FILE
+
+mv /etc/portage/package.keywords /etc/portage/package.keywords.bak
+mv $TMP_FILE /etc/portage/package.keywords
+chmod +r /etc/portage/package.keywords