Archive

Archive for the ‘Linux’ Category

Unrar Bug

February 22nd, 2010 No comments

So I was recently scripting with the unrar tool and discovered something stupid:

unrar t file.rar
if [ $? -eq 0 ]; then
  echo "Rar file is good?"
fi

However it was returning zero all the time, even when the file wasn’t a rar:

# unrar t file.rar
 
UNRAR 3.80 freeware      Copyright (c) 1993-2008 Alexander Roshal
 
file.rar is not RAR archive
# echo $?
0

So it fails the test but returns zero regardless. This makes it very unhelpful for using in scripting. Fortunately enough a mate on IRC discovered that his version did.

So I first download the existing SRPM and installed it:

# yumdownloader --source unrar
# rpm -i unrar*.srpm

Then I installed that and simply modified so I downloaded the latest, created a RPM and installed.

I have submitted the updated spec file to RPMfusion.

Tags: ,

WPA2 Wireless With Linux

February 18th, 2010 No comments

This is a simple tutorial produced by me and my good mate enigma. It is aimed at Gentoo and uses the Broadcom drivers but this should replicate to other systems.

The first step is to get your drivers and for Broadcom, which is relatively easy as they produce them for us. So first download the driver (these drivers support BM4311-, BCM4312-, BCM4321-, and BCM4322-based cards) and was also successful in this case with BCM4328.

Check that the package ‘linux-headers’ is installed, this is really just for completeness sakes. Gentoo would not work for long without this package!

(gentoo)# emerge linux-headers
... output ...

Unpack the downloaded drivers and build for your current kernel:

(gentoo)# tar -xzf hybrid-portsrc-ARCH-VERSION.tar.gz
(gentoo)# make -C /lib/modules/`uname -r`/build M=`pwd`
... output ...

Remove any existing wireless drivers.

(gentoo)# rmmod ndiswrapper b43 ssb bcm43xx b43legacy

Add in some modules required for WPA wireless:

(gentoo)# modprobe ieee80211_crypt_tkip

Test the newly built wireless driver:

(gentoo)# insmod wl.ko
(gentoo)# iwconfig
.. output ...
(gentoo)# iwlist scanning
... output ...

If that is working we can copy in the driver to the kernel and add to the autoload:

(gentoo)# cp wl.ko /lib/modules/`uname-r`/kernel/net/wireless/
(gentoo)# rmmod wl
(gentoo)# modprobe wl
(gentoo)# echo 'wl' >>/etc/modules.autoload.d/kernel-2.6

So now we have a working driver we can go on to configure for WPA. Alter the /etc/conf.d/net (note we assume that eth0 is wireless):

# Prefer wpa_supplicant over wireless-tools
modules=( "wpa_supplicant" )
 
# It's important that we tell wpa_supplicant which driver we should
# be using as it's not very good at guessing yet
wpa_supplicant_eth0="-Dmadwifi"

Next set up the network in the /etc/wpa_supplicant/wpa_supplicant.conf:

# This setting is required or the connection will not work
ctrl_interface=/var/run/wpa_supplicant
 
# Ensure that only root can read the WPA configuration
ctrl_interface_group=0
 
# Let wpa_supplicant take care of scanning and AP selection
ap_scan=1
 
# Only WPA-PSK is used. Any valid cipher combination is accepted
network={
  ssid="example"
  proto=WPA RSN   # RSN is needed for WPA2
  key_mgmt=WPA-PSK
  pairwise=CCMP TKIP
  group=CCMP TKIP WEP104 WEP40
  psk=06b4be19da289f475aa46a33cb793029d4ab3db7a23ee92382eb0106c72ac7bb
  #The higher the priority the faster it connects
  priority=2
}

And that is it, you should find that your wireless is enabled on boot.

Thanks should also go to DJ Kaos for the preparation of the driver.

Tags: ,

Acer Aspire One Tips

September 29th, 2009 No comments

Just came across a really good site with lots of tips and tricks for the AA1.

I have owned this dinky wee notebook for sometime now and can highly advise it for anyone looking for a Linux Notebook.

Some tricks I have are:

Alt+F2 > xfce-settings-show > Desktop > Behaviour > Show desktop menu on right click.
The will enable the XFCE menu on right click, which is useful to me.

Alt+F2 > xfce-settings-show > Sessions and Startup > Advanced > Launch Gnome services on startup
This will allow NetworkManger to use gnome-keyring and therefore finally store the keys for wireless!

Simple but effective!

Tags: ,

GPG Errors

August 11th, 2009 No comments

Sometimes when you are installing RPM’s or Deb’s you will find yourself faced with GPG errors. Instead of ignoring them why not fix them!

Simply download the key by using the GPG tool:

gpg --keyserver pgpkeys.mit.edu --recv-key E6F33B6628973CC0

Then import that key into either apt:

gpg -a --export 010908312D230C5F | sudo apt-key add -

Or rpm:

gpg --export -a 010908312D230C5F >key.txt
rpm --import key.txt

Simple!

Tags: ,

HTML E-mails And Mutt

June 27th, 2009 2 comments

I find myself regularly using terminals and thus have grown to love any tool that allows me to remain in terminal. Mutt is only of those, a fantastic terminal mail client. The only issue is that most people these days send HTML e-mails rather than plain text. This means that when I open them in mutt it is very unreadable. However there is a very simple solution.

First off lets make a simple script to convert the HTML into text. Several terminal based browsers exist and these can do the conversion for us (make sure to place it in your PATH somewhere).

#!/bin/sh

if [ ! -z `which links | grep -v 'no links'` ]
then
  links -html-numbered-links 1 -html-images 1 -dump "file://$@"
elif [ ! -z `which lynx | grep -v 'no lynx'` ]
then
  lynx -force_html -dump "$@"
elif [ ! -z `which w3m | grep -v 'no w3m'` ]
then
  w3m -T text/html -F -dump "$@"
else
  cat $@
fi

Add this to your ~/.muttrc:

auto_view text/html
alternative_order text/enriched text/plain text text/html

And then this to your ~/.mailcap:

text/html;html2txt %s; copiousoutput

Start up Mutt and get nothing but text e-mails.

Tags: ,