Archive

Archive for the ‘Fedora Linux’ Category

Running Logitech Media Server (LMS SqueezeServer) in a closed Environment (Perl 5.14) – Fedora 18 x86_64 Tested

December 25th, 2012 8 comments

Having updated my Mythtv Box to Fedora 18 it came bundled with Perl 5.16. Having never had an issue with LMS I never thought twice. Alas it would not run.

No problem.. there will soon be an update….WHAT? Logitech have discontinued the Squeezebox lineup… now that had me ranting, a product that would be a good market to a small company not fitting in with the huge volumes someone like Logitech needs.

Ok… so how on earth to get it running.

Firstly we need to create a version of Perl 5.14 on the system we can use (no package in Fedora below 5.16)

yum install expat-devel
cd /opt
mkdir Perl5.14
cd Perl5.14
wget http://www.cpan.org/src/5.0/perl-5.14.3.tar.gz
gunzip *.gz
tar -xvf *.tar
cd perl-5.14.3
./Configure -des -Dprefix=/opt/Perl5.14
make
make install
cd /opt/Perl5.14/bin
./perl -v

Note the /opt/Perl5.14 is important as it fits in with my mod to buildme.sh, so if you change, edit buildme.sh

So now we need to grab the CPAN files needed from Logitech. This is in their SVN, but I have replicated here to include the edits to buildme.sh.

cd /opt
git clone https://github.com/jamesarbrown/slimserver-vendor.git
cd slimserver-vendor/CPAN
./buildme.sh

Now we need the slimserver itself

cd /opt
git clone https://github.com/jamesarbrown/slimserver.git

Finally running Slimserver is done by

chown -R myuser.myuser slimserver
su myuser
/opt/Perl5.14/bin/perl -I /opt/slimserver-vendor/CPAN/build/arch/5.14 /opt/slimserver/slimserver.pl

For BBC Iplayer plugin on x86_64 it needed the 32 bit libraries for faad

yum install glibc.i686
Categories: Fedora Linux Tags:

Linux Security – Ban an Entire Country

June 10th, 2012 No comments

Yes at somepoint you will become fed up of spam, attacks and so on, and hey presto… it seems to me to always be ru and cn domains. That brazen they dont even bother with proxies.

So here is a script that will autofill the hosts.deny file with countries of your choosing. After all we don’t expect business from China anyway… too busy copying our industry?!

#!/bin/bash
# Copyright 2007 Michael Pagano
# Distributed under the terms of the GNU General Public License v2
# $Header$
#
# Modified by James A R Brown 2012 so countries added are the ones we
# want to ban.
#
# This script will download the country files from ipdeny.com, extract
# the ranges, backup the hosts.deny file, add the new ip's
#
# Special shout out to the folks at IPdeny who provide complete IP 
# block downloads as a free and public service. Check them out at
# http://www.ipdeny.com 
#
# If you use this script, please follow the usage rules of IPdeny 
# located at http://www.ipdeny.com/usagelimits.php

version=0.2jarb

# full name and path to hosts.deny
denyFile=/etc/hosts.deny

#backup directory for hosts.deny
backupDir=/tmp/

# array of countries to ban e.g. badCountries=( cn ru )
badCountries=( cn ru )

# url of ipdeny.com's MD5SUM to retrieve list of countries
downloadUrl=http://www.ipdeny.com/ipblocks/data/countries/
md5sumUrl=$downloadUrl/MD5SUM

usage() {
	echo "countryblock.sh [-h | -v]"
	echo "where"
	echo "	-v - print version information"
	echo "	-h - print usage"
	exit
}

for arg in $* ; do
    case "${arg}" in
    -v)
        echo "countryblock.sh version: $version"
		exit
        ;;
    -h)
        usage
		exit
        ;;
    esac
done

wget -m -nd $md5sumUrl

# did file download?
if [ ! -e MD5SUM ]; then
	echo "Could not locate ipdeny file: MD5SUM. Is the URL still valid?"
	echo "Url used: $md5sumUrl"
	exit 1
fi

# extract the country codes into an array
countryCodeList=$(awk < MD5SUM -F" " '{ split($2, a, ".");print a[1]}')
countryCodes=($countryCodeList)

# backup the old hosts.deny file
if [ ! -e $denyFile ]; then
	echo "Could not find file: $denyFile specified in the variable \$denyFile"
	exit
else
	#Create tar to backup first
	tar -cPzf $backupDir"hosts.deny."$(date +%Y%m%d%H%M%S).tgz $denyFile
fi

# delete the hosts.deny file
rm $denyFile

#iterate through the array skipping anything in the array safeCountries
for country in ${countryCodes[@]}
do
	country_is_bad="false"
	for badCountry in ${badCountries[@]}
	do
		if [ $badCountry = $country ]; then
			country_is_bad="true"
		fi
		if [ $country_is_bad = "true" ]; then
			# download the each country zone file
			zoneFile="$country.zone"
			wget -m -nd  $downloadUrl$zoneFile

			# make sure the file dowmloaded
			if [ ! -e $zoneFile ]; then
				echo "Problem downloading $downloadUrl$zoneFile"
			else
				# add the IP addresses to the new file
				awk < $zoneFile  '{ print "ALL: ",$0,"# ""'"$country"'"}' >> $denyFile
			fi
		fi
	done
done

#cleanup
rm MD5SUM

for country in ${countryCodes[@]}
do
	rm $country.zone 2>/dev/null
done

Categories: Fedora Linux Tags:

Garmin Forerunner 405 (ANT USB2) in Linux

April 14th, 2012 5 comments

RE-PUBLISHED FOR FEDORA 16

Today is my birthday… wahey!

Having reached that point in life where you either have to “get fat or get fit”, a few months ago I started running again… on sunny days where I feel vitalised.

My wife kindly has bought me a Garmin Forerunner 405, which comes with a Garmin “ANT+” dongle and per normal no Linux support. After pouring over much of google, I finally got it working in Linux Fedora and here is how.

Making the device be recognised to the system

My device reported (via lsusb) as follows

Bus 003 Device 005: ID 0fcf:1008 Dynastream Innovations, Inc.

Which apparently is a Version 2 Garmin device, and on plugging did not get a /dev/ttyUSB0 as most articles expected. A bit more digging in posts found this valuable snippet

< Fedora 15

sudo modprobe usbserial vendor=0x0fcf product=0x1008

This finally gave me a device in the form of /dev/ttyUSB0

Fedora 16 Onwards

It seems from Fedora 15 the usbserial module is compliled within the Kernel. Then from Fedora 16 we migrated from grub to grub2.

Find the file /etc/default/grub It will probably look like this

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Fedora"
GRUB_DEFAULT=saved
GRUB_CMDLINE_LINUX="rd.md=0 rd.dm=0 rd.lvm.lv=vg_office/lv_root quiet SYSFONT=latarcyrheb-sun16 rhgb  KEYTABLE=uk rd.luks=0 rd.lvm.lv=vg_office/lv_swap LANG=en_US.UTF-8"

On the GRUB_CMDLINE_LINUX add the following to the end “usbserial.vendor=0x0fcf usbserial.product=0×1008″ so that we have something like this

GRUB_DISTRIBUTOR="Fedora"
GRUB_DEFAULT=saved
GRUB_CMDLINE_LINUX="rd.md=0 rd.dm=0 rd.lvm.lv=vg_office/lv_root quiet SYSFONT=latarcyrheb-sun16 rhgb  KEYTABLE=uk rd.luks=0 rd.lvm.lv=vg_office/lv_swap LANG=en_US.UTF-8 usbserial.vendor=0x0fcf usbserial.product=0x1008"

Update the grub config by issuing

grub2-mkconfig > /boot/grub2/grub.cfg

Reboot!

 

 

Connecting and Downloading Software

To do this you need a piece of software called gant and be warned there are two pieces of software out there with the same name, both as of 15 Apr 2012 unable to locate on the internet, so I have put the working one up at https://github.com/jamesarbrown/Gant

So download it,

git clone git://github.com/jamesarbrown/Gant.git
cd Gant
make clean
make

You can now pair the device. On the Forerunner ensure under settings > computer that pairing is on, force send is on and enabled is on. Issue the following command. This will pair the device

./gant -f mydevname -a auth405

Once done you can either use the command line as follows

./gant -nza auth405 > output

Which will create a tcx v2 file which can be imported for instance into Garmin Connect or as follows something more Linux native.

I much prefered the program

./GantMonitor.py

Which Gave a nice icon on my Gnome taskbar

pytrainer

I will skip howto install pytrainer. There is enough out there, but to concentrate on how to import your file.

In pytrainer select File > Import. Select the plugins tab. It will appear as follows

Click the “Garmin Training Center File (v2)” configure button. Select Enabled. Once done you can click run and pick the file you want to import.

References

http://groups.google.com/group/golden-cheetah-users/browse_thread/thread/341ff35f231ee7b2

https://forums.garmin.com/showthread.php?t=9799

Categories: Fedora Linux Tags:

Merging a parent dev branch with your dev branch on gitHub.

September 3rd, 2011 No comments

Git can be complicated for beginners, and I found myself trashing my branch a few times in order to merge. So these are my notes for future reference and put here to help you if necessary,

The dev branch I am working with is remove_smarty. To clone my own I issue the command

git clone --branch remove_smarty https://jamesarbrown@github.com/jamesarbrown/poMMo.git remove_smarty
git clone –branch <branch name> <git hub url> <folder I want to call it>

Now cd into the directory.

So if we look at the branches we get

git branch -r
origin/HEAD -> origin/master
origin/master
origin/remove_smarty 

So now I want to add the branch I originally forked from.

git remote add -t remove_smarty soonick https://github.com/soonick/poMMo.git
git remote add -t <branch name> <what I want to call it> <github URL>

Now we can fetch that branch

git fetch soonick
git fetch <what I called it>

and this can be confirmed by

git branch -r
origin/HEAD -> origin/master
origin/master
origin/remove_smarty
soonick/remove_smarty 

And now to merge that in

 git merge soonick/remove_smarty 

Which resulted in some conflicts

Auto-merging themes/default/inc/admin.footer.php
CONFLICT (content): Merge conflict in themes/default/inc/admin.footer.php
Automatic merge failed; fix conflicts and then commit the result. 

If you open a file with conflicts you will see something like this

<<<<<<< HEAD 
This is code in my head
=======
This is code commited by soonic
>>>>>>> soonick/remove_smarty

Regard the ======= as OR

 

Delete above or below as applicable, mix, what ever you want and once done you can commit. (for which I use git-gui)

 

 

 

 

Categories: Fedora Linux Tags:

Getting RaLink rt3090 Wireless Running on HP620 Laptop and Fedora15

July 20th, 2011 No comments

Fedora 15 out of the box appeared to work with this wireless card, however I found that I could connect to one router with WEP, but not the other. Also using the Wifi key on the keyboard broke it.

Step 1 – Download

Download the driver from http://www.ralinktech.com/support.php?s=2 .You want the RT3090PCIe file

Step 2 – Unpack The driver

unzip  2010_1217_RT3090_LinuxSTA_V2.4.0.4_WiFiBTCombo_DPO.zip
cd 2010_1217_RT3090_LinuxSTA_V2.4.0.4_WiFiBTCombo_DPO
cd os/linux

Step 3 – Edit config.mk

Use your normal editor to edit config.mk and change

#Support MAC80211 LINUX-only function
HAS_CFG80211_SUPPORT=y
To
HAS_CFG80211_SUPPORT=n

Step 4 – Build and Install It

cd ../..
make
make install

Step 5 – Blacklist 2860 Driver

Use your editor and open up /etc/modprobe.d/blacklist.conf and add to it

blacklist rt2800pci
blacklist rt2800lib
blacklist rt2x00usb
blacklist rt2x00pci
blacklist rt2x00lib
blacklist rt2860sta
Categories: Fedora Linux Tags:

Fedora 15 & Gnome3…wow… and Autostarting an app eg Skype

June 19th, 2011 No comments

Gnome3

Always a heavy user of a text console, resulting back to the days of typing programmes into an old Sinclair Spectrum, I have heavily learnt to realise Linux (as all POSIX OS) are far superior to Windows, but one thing Bill and his boys are good at is Windows.. ie the nice pictures you see on the screen

Windows 95 at Launch was awesome, Win98 imrpoved, XP a major improvement. Then with millions of users, along came over commercialisation and viruses. That was the end of Windows for me. Vista was plain awful, and Win7 simply is nothing special.

So when I am travelling I can not help but notice the vast increase in Apple Macs (Another POSIX OS very similar to Linux) and realise the people buying these just regard it as a “computer”, gone are the days you bought an OS on the back of what programmes you could get for it.

And Apples OSX10 operating system is as usual Apple is incredible, targeted at all those people whom don’t want to know what’s under the hood.

So this left Linux as always, technically fantastic, some amazing apps and free at that, but nothing special in the graphical display and certainly nothing original, having nothing special over win95.

Until now… we have a new graphical manager called Gnome3

And like everything that is destined to be good and staple diet, its a bit ahead of its acceptance and debate has been raging. Some love it, Some really really hate it.

After 3 days I can honestly say its great, and as for those complaining about the changes, you need to read the manuals. For example don’t complain there is no “shutdown” option and only “suspend”…. press the ALT key and it changes to “Shutdown”

For those never having used a Linux system before you can, burn a disc, put it in your standard computer and use it to try without upsetting your Windows. Once finished, eject disc, reboot and you are back to “normal”.

Discs are from http://www.redhat.com/fedora and follow.

Skype

As with all things new… somethings are not straight forward to do yet.

For the techies… to auto start an application on login open up a terminal

cd ~/.config
mkdir autostart

Create the following file, call it skype.desktop and put in autostart directory

[Desktop Entry]
Type=Application
Exec=/usr/bin/skype
Hidden=false
X-GNOME-Autostart-enabled=true
Name[en_US]=skype
Name=skype
Comment[en_US]=Skype Telephony Application
Comment=Skype Telephony Application


Categories: Fedora Linux Tags: