Archive for the ‘PPA’ Category

[PLEASE SEE Better PPA Fixkey Method the below is for informational purposes only.]

In Fix Software Sources Bad Behaviour we reported two methods for accomplishing the same task of fixing keys. The first, involved manually entering two lines in a terminal. The second involved one entry. Now there is a third faster method. Aliasing.

ICE20.com describes aliasing in BASH this way:

Many of us use certain commands over and over again, or we have preferred combinations of options which we always give to certain commands. We can create shortcuts to these commands by giving them an alias in our ~/.bashrc file. The format is:

alias new_name=’command -options’

There are some examples provided at the above site, but the one we want to create is this:

alias fixkey=’sudo apt-key adv –recv-keys –keyserver keyserver.ubuntu.com’

Which will execute a command string when you type fixkey.

1. All you have to do is backup your ~/.bashrc file

cp .bashrc .bashrc.bak

2. then open it in a text editor

gedit ~/.bashrc

3. Scroll down to the relevant section.

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

#if [ -f ~/.bash_aliases ]; then
#. ~/.bash_aliases

4. Uncomment so it looks like this

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases

5 Save and exit.

Bash documentation recommends creating a separate file for aliases like this.

6. Create the  ~/.bash_aliases file

gedit ~/.bash_aliases

7. Enter the following code

alias fixkey=’sudo apt-key adv –recv-keys –keyserver keyserver.ubuntu.com’

8. Save and exit.

9. Refresh bash. by either logging out, closing the terminal or entering $ bash

10 To fix an errant key, using fixkey. Open Terminal


WARNING: I  tried the above first leaving the sudo command out and entering it directly in .bashrc expecting that one should be able to simply sudo fixkey in this instance, but this merely turns up a “command not found” dialogue and so I included sudo  in the command string in order for it to execute. This might not be the case with the .bash_aliases file. Any advice on this would be welcome. please see Better PPA Fixkey Method

NOTE: I don’t recommend going off and aliasing everything you do, as you terminal will quickly begin to resemble a unique creature which might bork when you install a new piece of software with the same command structure. (How exactly does this problem of potential commandline scripting conflict get resolved? For example, the above is substantially similar to the following posting at Commandlinefu. Depending on whether your starting point is the ‘addition’ of a key, or ‘fixing’ a key after the fact. Of course both fixkey and launchpadkey can coexist) Rather, I suggest we share commands at places like Commandlinefu or Ubuntu Forums and see if there is any agreement within the broader Ubuntu Community at what to do about reducing relatively complex or time-consuming CLI tasks into easy to remember, attractive or familiar commands. In fact creating more human, or themed commands using the aliasing capabilities of bash, could be the next frontier. I imagine the day when we will be sharing and exchanging CLI matrices or schemas as easily as trying on a new hat or pair of shoes. If the shoe fits, wear it, if not, give it away. – DRL

SEE Environment Variables


Read Full Post »