Wednesday, March 25, 2009

Gentoo Easy Handling

Firt of all a brief explanation of how gentoo works (a simplification of http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3&chap=3 look for a more extensive explanation).

Gentoo works with two kinds of software trees: the stable tree, and the unstable one; Gentoo's installer portage works with ebuilds which contains all installation data, and everything gentoo needs to install a package. Inside of it there are one thing of interest: the KEYWORD variable which can determine wheter that package is marked as stable or not.

Before starting to explain how gentoo works, it is interesting to mention how packages are handled, and how versions are handled first. Gentoo has a particular syntax for a package: "category/packagename", but for mentioning a particular version of a package, an operator is strictly needed, for example media-test/test-4.0.0 is incorrect, it should be something like =media-test/test-4.0.0 (you can use <,>,<=,>=,= or ~ operator, the ~ operator will select all revisions for a particular version, for example ~media-test/test-4.0.0 will select 4.0.0-r1, 4.0.0-r2, and so on)

On the other hand, we have the keywords values:

  • Stable, is the value (substitute arch with yours, like for example x86, amd64...) and is meant to be tested enough by gentoo developers and users which will not break things (hopefully). For installing stable software, nothing else is required, only to execute "emerge ".

  • Unstable means that the package is not tested enough and may harm your system (other packages depending of it don't work anymore, etc), and it is not advised to install. They are keyworded with <~ARCH> value (for example ~x86, ~amd64, etc). To install this kind of packages you have to include the line category/package ~arch to your /etc/portage/package.mask

  • But there are more, sometimes, there are certain situations a bit more special: when a package is listed in package.mask file, or also known as hard masked. This happens when a package is known to cause severe problems to rest of system or only if it's too new to be tested. To install this software, you must unmask it by adding the line "category/package" to your /etc/portage/package.unmask
  • There are cases where you need to manually hard mask a package to prevent it from beeing installed in an update (usefull when you mix between stable and unstable branches and don't want a conflictive package to be updated). In this case, it is enough with adding category/package to /etc/portage/package.mask
In order to simplify this task, I've created a script to simplify this task. This script is rather simple to be used, and it is autoinstallable, you just need to copy/paste to a file, and run (as root) ./install.sh arch (substitute arch your your architecture).

After installing, the usage is: gentoo [keyword/mask/unmask] and it will add the correspondent line to the correspondent file inside your /etc/portage directory.

I hope it could be usefull to someone else than me :) and maybe I could update it adding functions or correcting bugs.

Thanks

The Script:
--------------------------

#! /bin/bash
if [ -z $1 ]; then
echo "Use ./$0 [ARCH]!"
exit
fi

echo "Gentoo Easy Handling"
echo "By StormByte (StormByte@gmail.com)"
echo "Execute this as root!"

echo "
echo \"Gentoo Easy Handling\"
echo \"By StormByte (StormByte@gmail.com)\"
echo \"Remember to execute it as root or as user inside Gentoo group!\"

ARCH=$1

function usage {
echo \"Use gentoo [keyword/unmask/mask] category/package\"
exit
}

function display {
echo \"Package \$2 added.\"
}

if [ -z \$2 ]; then
usage
elif [ \$1 == \"keyword\" ]; then
echo \"\$2 ~\$ARCH\" >> /etc/portage/package.keywords
display
elif [ \$1 == \"unmask\" ]; then
echo \"\$2\" >> /etc/portage/package.unmask
display
elif [ \$1 == \"mask\" ]; then
echo \"\$2\" >> /etc/portage/package.mask
display
else
usage
fi;

" >> /usr/bin/gentoo
chown root:portage /usr/bin/gentoo
chmod 775 /usr/bin/gentoo
echo "Installed under /usr/bin, name of command: gentoo"
echo "For more instructions of how to use it, invoke gentoo without arguments"

--------------------------
End of the script

1 comment:

eddalafalce said...

Do free online games for you pay real money - Casinos Sites
If you want to get into slot 카지노사이트 games, you want to play free casino games. This is a good platform to try and get a little tips when trying to 우리카지노 choose the