View previous topic :: View next topic |
Author |
Message |
d_u_s_t n00b
Joined: 11 Jul 2006 Posts: 8 Location: Berlin
|
Posted: Fri Sep 15, 2006 9:02 pm Post subject: [howto] quick and dirty package unmasking |
|
|
Hi again!
I'm running a stable (x86) gentoo install, but sometimes (often?) I want to emerge some unstable (~x86) packages. If I only know the package names but not the categories (e.g. net-www) I have to search for it and add it to package.keywords. I wrote this small script to do all the work by using locate and sed.
As root save it to e.g. /usr/local/bin/unmask.sh and change ARCH at the beginning of the code as needed (e.g. ~x86 for me), then do a chmod u+x unmask.sh.
Now you can use it like this:
unmask.sh <PACKAGENAME>
or
unmask.sh <CATEGORY>/<PACKAGENAME>
- It checks if the entry is already present
- If there is more than one package with the same name it tells you and you can use the pattern <CATEGORY>/<PACKAGENAME>
- It does a backup
Code: |
#!/bin/sh
ARCH="~x86"
echo "Searching in portage tree..."
if [[ $1 =~ '.*/.*' ]]
then
result=`locate -i -l 0 -r /usr/portage/$1/ChangeLog | sed -e 's#/usr/portage/##' -e 's#/ChangeLog##'`
if [[ $result =~ '.*/.*' ]]
then
if [[ `cat /etc/portage/package.keywords | grep -i "$result " ` ]]
then
echo "Error: Already in list!"
echo -e $result
exit 1
fi
echo "Adding $result to package.keywords"
echo "$result $ARCH" >> /etc/portage/package.keywords
echo "done."
cp /etc/portage/package.keywords /etc/portage/package.keywords.backup
else
echo "Error or not found!"
echo -e $result
exit 1
fi
else
result=`locate -i -l 0 -r /usr/portage/.*/$1/ChangeLog | sed -e 's#/usr/portage/##' -e 's#/ChangeLog##'`
if [[ $result =~ '.*/.*/.*' ]]
then
echo "Error: Ambiguous results:"
echo -e $result
exit 1
elif [[ $result =~ '.*/.*' ]]
then
if [[ `cat /etc/portage/package.keywords | grep -i "$result " ` ]]
then
echo "Error: Already in list!"
echo -e $result
exit 1
fi
echo "Adding $result to package.keywords"
echo "$result $ARCH" >> /etc/portage/package.keywords
echo "done."
cp /etc/portage/package.keywords /etc/portage/package.keywords.backup
else
echo "Error or not found!"
echo -e $result
exit 1
fi
fi
|
---
I know this is just dirty and I`m almost sure there is something better around here (although I haven't found anything) but this is working perfectly for me so it might also help somebody else! Don't blame me if your computer explodes! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|