All pastes #155742 Raw Edit

unmasker

public text v1 · immutable
#155742 ·published 2006-08-31 09:24 UTC
rendered paste body
#!/bin/bash
#
# gentoo package unmask script by tilya starwing
# version 0.1
#
# last update: 3rd August 2006
# message of the day:
# vysaj voko vysavacem vole!
#

# arguments
# -k <something>        keyword
# -h                    hardmasked
# -p                    package to unmask

# TODO
# automatically unmask dependencies (if argument given)

# default output file
TARGET="/etc/portage/package.keywords"

# if keyword not supplied by user, use default
KEY="~x86"

# parse the argumets
while getopts p:hk: arg
do
        case $arg in
                p)  file=$(eix -e $OPTARG |head -n 1 |awk '-F ' ' {print $2}');;
                h)  $TARGET="/etc/portage/package.unmask"; $KEY="";;
                k)  $KEY=$OPTARG;;
                *) echo "no arguments supplied";;
        esac
done

if [ FILE = " " ]; then
        echo "file must be specified"
        exit 1
fi

echo "${FILE} ${KEY}" >> ${TARGET}
echo "${FILE} ${KEY} added to ${TARGET}"

shift $(($OPTIND - 1))