Tag: Fixkey

Fastest PPA fixkey method yet


This is the fastest “safe” fixkey method around, since it does not involve aliasing which strictly speaking should be kept for shortening or modifying commands that you already have in your shell, nor does it update software sources, which can slow down valuable time, especially if you have a lot of them.
1. Create a new file named ‘fixkey’ at ‘/usr/bin’ with your favorite text editor:
sudo gedit /usr/bin/fixkey
Then, paste this code:
#! /bin/bash
echo please input your key
read KEY
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com $KEY

2. Give the file executable privileges with this command:
sudo chmod +x /usr/bin/fixkey
3. Start fixing keys using the command line by typing ‘fixkey’ [wait for prompt] [key]. See example below:
please input your key

5. You have just fixed a PPA key via the Linux command line!
Previous threads on this subject can be found here and here.
6. Now to fix the key for the chromium-daily ppa:
please input your key

For a more inclusive but slower method of updating keys, you might like this script from Dominic Evans, which was first noted here. If you have a lot of keys that need to be updating then I suggest you use it, at least once.

If you like my method, please let me know.

Categories: BASH CLI Scripts Ubuntu

Tags: ,

Favourite your top Ubuntu commands and add fixkey

1 Comment

[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

Categories: CLI PPA Ubuntu

Tags: ,