All 18 entries tagged Linux

View all 59 entries tagged Linux on Warwick Blogs | View entries tagged Linux at Technorati | There are no images tagged Linux on this blog

May 15, 2015

Because 'dconf update' looks at modification time of directory not files

Are you making modifications to a dconf profile, running 'dconf update' and wondering why the settings aren't applying? I was. And this is why…


I have some dconf settings that I want to set conditionally and that's done by writing relevant value to a file like this:

#!/bin/bash

F=/etc/dconf/db/foo.d/blah

if [ "$(something)" = "yes" ];then
   V='true';
else
   V='false';
fi

cat > "${F}" << EOF
[what/ever/]
key=${V}
EOF

dconf update

/etc/dconf/db/foo.d/blah was getting updated, but the setting wasn't being applied. I noticed the binary database /etc/dconf/db/foo wasn't being updated, which was evident by the modification time stamp not changing after 'dconf update' was run.

Eventually I discovered that 'dconf update' doesn't look at the file modification times, it looks at the modification time of the directory containing the files. See https://bugzilla.gnome.org/show_bug.cgi?id=708258 Changing the contents of the file by writing to it with cat doesn't cause the modification time of the enclosing directory to change. So I needed to also change the modification time of foo.d, which can be done with touch

#!/bin/bash

F=/etc/dconf/db/foo.d/blah

[ as above cut for brevity ]

touch $(dirname ${F})
dconf update

With that additional touch command, things started to work as desired.


August 07, 2013

Netflix on SUSE Linux Enterprise Desktop

Netflix provide a means for you to watch stuff on your 'smart' TV, your iThing, your Androids and your computer, unless it runs Linux. To watch in a web browser on a computer you need Silverlight and of course there is no Silverlight for Linux. Apparently Netflix are ditching Silverlight, but right now you still need it. Inevitably lots of people using Linux want to watch Netflix on their computer and have been hacking together ways to achieve it. Here is my take on it, which works on SUSE Linux Enterprise Desktop 11 SP3 64bit. It's put together from various sources with some adaptations.

One additional package is needed which isn't included in a default SLED 11 SP3 64bit install and that's alsa-plugins-pulse-32bit. Without that you won't get any sound. Apart from installing that package it's all done as a regular non-root user and everything is kept nice and neat in one single directory.

$ cd 
$ mkdir netflix

Go to http://www.compholio.com/wine-compholio/#download get the x86-64 wine-compholio alien-ized RPM and save it to the netflix directory you just created. Wine Compholio Edition is a build of Wine with special patches which amongst other things, make Netflix work. Hurray for that guy.


Go to ftp://ftp.mozilla.org/pub/firefox/releases/ and get the 32bit Windows version of Firefox. Apparently it doesn't matter what version you get. I used what is at time of writing the latest 17ESR release, 17.0.8. Save the installer to the to the netflix directory

$ cd netflix
$ mkdir wine
$ cd wine
$ rpm2cpio ../wine-compholio-1.5.30.x86_64.rpm | cpio -idmv
$ cd ..
$ export PATH=${PATH}:${PWD}/wine/opt/wine-compholio/bin/
$ export WINEARCH=win32
$ export WINEPREFIX=${PWD}/winerootdir
$ wine Firefox\ Setup\ 17.0.8esr.exe

If asked about a Gecko-Wine installation, say yes. I said yes when I was asked. I ran through this process from scratch multiple times and wasn't always asked though. Couldn't work out why. Anyway, say yes if asked. Select Custom install and untick the option to put an icon on the Desktop to avoid ending up with a weird and unhelpful Firefox icon on your Desktop which launches the Windows version of Firefox. Untick the 'Launch Firefox' option at the end of the install.

Get and install Silverlight 4. I tried Silverlight 5 and Firefox locked up when I tried to watch anything on Netflix. I was able to watch Silverlight video on another website I tried though, which is curious, but so it goes with this sort of thing.

$ wget http://silverlight.dlservice.microsoft.com/download/6/A/1/6A13C54D-3F35-4082-977A-27F30ECE0F34/10329.00/runtime/Silverlight.exe
$ wine Silverlight.exe /q

Get Winetricks and use it to install the Microsoft Core Fonts for the Web. If you don't have these the Netflix player chucks an error and won't play anything.

$ wget http://winetricks.org/winetricks
$ chmod u+x winetricks
$ ./winetricks corefonts

Now make a script to set all the required environment variables and launch Firefox.

$ touch netflix
$ chmod u+x netflix

Open the netflix file with your text editor of choice and paste in

#!/bin/bash
scriptdir="$(cd "$( dirname "$0" )" && pwd )";
PATH="${PATH}:${scriptdir}/wine/opt/wine-compholio/bin/" WINEARCH=win32 WINEPREFIX="${scriptdir}/winerootdir" wine "C:\\Program Files\\Mozilla Firefox\\firefox.exe" http://netflix.com/

Whenever you want to run it

$ ~/netflix/netflix

Watch and enjoy. The first time you watch anything you'll get a Silverlight dialogue prompting you to 'Enable playback of protected content'. Do so if you want to be able to watch anything.

I've found that the video is watchable, but not as smooth as it could be even on a machine with an i7 processor. It seems smoother on that other site I mentioned earlier which again, curious but so it goes. I've found audio to be fine.

If like me you're one of the many people who don't live in the United States of America but occasionally wants to watch something that's available on US Netflix but not your regional Netflix, install the Hula Firefox extension and enable it when you want to access US Netflix.


February 14, 2013

B–em

Follow-up to BBC Computer 32K, Acorn DFS, BASIC from Mike's blag

So I found a better BBC Emulator than BeebEm. It's called B-em. Why is it better?

  • It was last updated about a year ago rather than about 5 years ago. Newer is better, right? Sure it is.
  • It allows easy modification of the keyboard layout, including a menu option to remap A/S to Caps Lock/Ctrl which makes playing Arcadians practical. This is nicer than mucking around with setting an environment variable for SDL to make Caps Lock work like a regular key and using xmodmap to remap keys, which is how I made Arcadians playable with BeebEM.
  • It makes disk-drive like noises when you run disks.
  • Probably other... things... maybe...

I run it on SLED 11 SP2. If you want to do likewise, here's how.

If you don't already have it, get the SLE-SDK from http://download.novell.com/Download?buildid=NgW3ToaagDQ~ and use YaST to add it as an Add on Product.

Install the following packages: cmake zlib-devel libpng-devel libjpeg-devel xorg-x11-libX11-devel libogg-devel freetype2-devel libpulse-devel alsa-devel flac-devel libvorbis-devel alsa-oss automake gcc make gcc-c++

Then, as a regular user, run these commands:

$ cd
$ mkdir b-em
$ cd b-em
$ export PKG_CONFIG_PATH=${PWD}/lib/pkgconfig/
$ export PATH=$PATH:${PWD}/bin
$ export LD_LIBRARY_PATH=${PWD}/lib
$ export LIBS="-L${PWD}/lib"
$ export CPPFLAGS="-I${PWD}/include"
$ curl -L http://sourceforge.net/projects/alleg/files/allegro/4.4.2/allegro-4.4.2.tar.gz/download | tar zxvf -
$ cd allegro-4.4.2/
$ mkdir build
$ cd build
$ cmake -DWANT_LINUX_CONSOLE=on -DCMAKE_INSTALL_PREFIX:PATH=$(dirname $(dirname $PWD)) ..
$ make install
$ cd ../..
$ curl http://kcat.strangesoft.net/openal-releases/openal-soft-1.15.1.tar.bz2 | tar jxvf -
$ cd openal-soft-1.15.1/build
$ cmake -DCMAKE_INSTALL_PREFIX:PATH=$(dirname $(dirname $PWD)) ..
$ make install
$ cd ../..
$ curl http://connect.creativelabs.com/openal/Downloads/ALUT/freealut-1.1.0.tar.gz | tar xzvf -
$ cd freealut-1.1.0/
$ ./configure --prefix=$(dirname "${PWD}") && make && make install
$ cd ..
$ curl -L http://b-em.bbcmicro.com/B-emv2.2Linux.tar.gz | tar xvfz -
$ for i in INSTALL depcomp COPYING compile;do unlink $i; ln -s /usr/share/automake-1.10/$i;done
$ ./configure --prefix=${PWD} && make
$ mv b-em b-em.real
$ cat > b-em << EOF
#!/bin/bash
dir="$( cd "$( dirname "$0" )" && pwd )";
export LD_LIBRARY_PATH="${dir}/lib";
cd "${dir}"
./b-em.real
EOF
$ chmod u+x b-em


Grab the images for your favourite games from somewhere such as Stairway to Hell and run the b-em executable

$ ~/b-em/b-em

F11 shows/hides the menu. Once you've loaded a disk you need to hide the menu again and press Shift-F12 to run it.

Obligatory screenshot:

Arcadians running on B-em

The trick to maximum points in Arcadians is to only shoot the aliens whilst they're swooping down. You get double the points for picking them off whilst they're in motion.


January 03, 2013

Handbrake on SLED 11 SP2 revisited

Follow-up to Handbrake on SLED 11 SP2 from Mike's blag

I decided to figure out what needed to be done to build the currently current version of Handbrake, 0.9.8, on SLED 11 SP2.

If you don't already have it, get the SLE-SDK from http://download.novell.com/Download?buildid=NgW3ToaagDQ~ and use YaST to add it as an Add on Product.

Install these packages: doxygen yasm patch autoconf automake libbz2-devel libwebkit-devel libnotify-devel libgudev-1_0-devel gstreamer-0_10-plugins-base-devel dbus-1-glib-devel libtool gcc gcc-c++ intltool gtk2-devel glib2-devel zlib-devel libogg-devel

Then run the following commands. hbinstdir is where Handbrake gets installed to, change the value if you want. You can omit the lines relating to libdvdcss if you already have that installed somewhere Handbrake will find it, or if you don't want to be able to rip any DVDs that use CSS.

$ hbinstdir=/local/myapps/handbrake/
$ mkdir handbrakebuild
$ cd handbrakebuild
$ curl http://ftp.gnu.org/gnu/automake/automake-1.12.tar.gz | tar xvfz -
$ cd automake-1.12/
$ ./configure --prefix="${hbinstdir}" && make && make install
$ cd "${hbinstdir}"share/aclocal
$ for i in /usr/share/aclocal/*;do ln -s $i;done
$ cd -
$ cd ..
$ curl http://fribidi.org/download/fribidi-0.19.5.tar.bz2 | tar xvfj -
$ cd fribidi-0.19.5/
$ ./configure --prefix="${hbinstdir}" && make && make install
$ cd ..
$ curl http://download.videolan.org/pub/libdvdcss/1.2.12/libdvdcss-1.2.12.tar.bz2 | tar xvfj -
$ cd libdvdcss-1.2.12/
$ ./configure --prefix="${hbinstdir}" && make && make install
$ cd ..
$ export PATH="${hbinstdir}bin:${PATH}"
$ export FRIBIDI_LIBS="-L${hbinstdir}lib/ -lfribidi"
$ export FRIBIDI_CFLAGS="-I${hbinstdir}include/"
$ export LDFLAGS="-L${hbinstdir}lib/ -lfribidi"
$ curl -L "http://downloads.sourceforge.net/project/handbrake/0.9.8/HandBrake-0.9.8.tar.bz2?r=http%3A%2F%2Fhandbrake.fr%2Fdownloads.php&ts=1356991772&use_mirror=garr" | tar xvfj -
$ cd HandBrake-0.9.8
$ sed -i 's/autoreconf -I m4 -fiv/sh autogen.sh/' contrib/libvorbis/module.defs
$ ./configure --prefix="${hbinstdir}" --launch --launch-jobs=0 --verbose

Assuming the build process finishes without errors then install

$ cd build && make install

The binaries have been compiled against fribidi-0.19.5 but they're dynamically linked. So if you have the version of fribidi that's included with SLED installed the binaries will find and use that by default. If you don't have fribidi installed, they'll be looking for something that doesn't exist. So to make the binaries look at the right version of fribidi they need to be run in a wrapper

$ cd "${hbinstdir}/bin"
$ mv ghb ghb.real
$ mv HandBrakeCLI HandBrakeCLI.real
$ cat > ghb << EOF
#!/bin/bash
dir="\$(dirname "\$( cd "\$( dirname "\$0" )" && pwd )")"
PATH="\${dir}/bin:\${PATH}"
LD_LIBRARY_PATH="\${dir}/lib"
ghb.real
EOF
$ chmod u+x ghb
$ cat > HandBrakeCLI << EOF
#!/bin/bash
dir="\$(dirname "\$( cd "\$( dirname "\$0" )" && pwd )")"
PATH="\${dir}/bin:\${PATH}"
LD_LIBRARY_PATH="\${dir}/lib"
HandBrakeCLI.real
EOF
$ chmod u+x HandBrakeCLI

Run Handbrake with

$ /replace_with_whatever_you_set_hbinstdir_to/bin/ghb

The tweak to libvorbis/module.defs comes from http://benjisimon.blogspot.co.uk/2012/04/gotcha-of-day-building-handbrake-on.html

Initially I used LIBRARY_PATH=${hbinstdir}lib/ instead of LDFLAGS but system locations are searched before anything specified in LIBRARY_PATH and if you have fribidi-devel installed that's found first and the Handbrake build fails.

I also initially used export PKG_CONFIG_PATH="${hbinstdir}/lib/pkgconfig/" instead of FRIBIDI_CFLAGS and FRIBIDI_LIBS but the Handbrake build process was still finding the system version. I eventually realised the Handbrake build process sets it's own value for PKG_CONFIG_PATH which overwrites anything you've set.



April 10, 2012

Handbrake on SLED 11 SP2

The recently released Handbrake 0.9.6 doesn't build on SLED 11 SP2, which is a shame. It's probably possible to make it build if you have more patience and knowledge of such things than I have, but 0.9.5 builds fine.

Get HandBrake-0.9.5.tar.bz2 from http://sourceforge.net/projects/handbrake/files/0.9.5/

If you don't already have it, get the SLE-SDK from http://download.novell.com/Download?buildid=NgW3ToaagDQ~ and use YaST to add it as an Add on Product.

Become root and install the packages you need

$ zypper in -y -l yasm patch autoconf automake libbz2-devel libwebkit-devel libnotify-devel libgudev-1_0-devel fribidi-devel  gstreamer-0_10-plugins-base-devel dbus-1-glib-devel libtool gcc gcc-c++ intltool gtk2-devel glib2-devel zlib-devel

Then as your your regular usercode you can do

$ cd /tmp
$ tar xf ~/HandBrake-0.9.5.tar.bz2
$ cd HandBrake-0.9.5
$ ./configure --prefix=/local/handbrake --launch --launch-jobs=0 && cd build && make install

--launch-jobs=0 causes the build process to make use of however many cores/cpus your machine has. On a machine with an Intel Core i7-2600 @ 3.40GHz it took under two minutes. Assuming all goes well, run it with

$ /local/handbrake/bin/ghb

June 29, 2011

Update a driver in an initrd file

Recently I found myself wanting to put SUSE Linux Enterprise Desktop 11 SP1 on to machine with a Sandybridge chipset. This was a problem as the e1000e driver in SLED 11 SP1 isn't new enough to support the network card in the machine. Having found an updated driver I still had the problem that I wanted to be able to do installations over the network with AutoYaST and PXE boot. That didn't work because the initrd file being used for PXE boot didn't have the new e1000e driver in. So the install failed almost immediately due to the absence of a network connection.

The solution is to make a new initrd file containing the new e1000e driver. It's far from obvious how to do this but I found the solution at http://www.sharms.org/blog/2007/11/howto-add-updated-e1000-driver-to-sled-10-sp1/ This post is basically just me duplicating the information because you can never have such information in too many places. Also I've expanded it a little bit to include instructions on how to do some bits that I had to work out. You can of course adapt the following for whatever module you might find the need to update.

First of all, make a new directory and unpack the current initrd in to it

$ mkdir -p updated_initrd/initrd_unpack
$ cd updated_initrd/initrd_unpack
$ gunzip -dc /path/to/initrd | cpio -idmuv

Now get the new version of the e1000e module. I found this in an rpm on Novell's website which I needed to download and unpack to get the driver out of it.

$ cd ..
$ wget http://drivers.suse.com/driver-process/pub/update/Intel/sle11sp1/common/i586/intel-e1000e-kmp-pae-1.2.20_2.6.32.12_0.7-1.i586.rpm
$ mkdir rpmcontents
$ cd rpmcontents
$ rpm2cpio ../intel-e1000e-kmp-pae-1.2.20_2.6.32.12_0.7-1.i586.rpm | cpio -idv

Next copy the new driver over in to where you unpacked the initrd

$ cp lib/modules/2.6.32.12-0.7-pae/updates/e1000e.ko ../initrd_unpack/modules/
cp: overwrite `../initrd/modules/e1000e.ko'? y

Now you need to update files called modules.alias and modules.pcimap using information that you get from the depmod command. You can get the information to put in modules.alias with

$ /sbin/depmod -n $(pwd)/lib/modules/2.6.32.12-0.7-pae/updates/e1000e.ko | grep ^alias > /tmp/newaliases

Then I made a copy of the modules.alias file with the information for e1000e removed from it

$ grep  -v ' e1000e$' ../initrd_unpack/lib/modules/2.6.32.12-0.7-default/modules.alias > /tmp/modules.alias

Add the new information to that file

$ cat  /tmp/newaliases >>  /tmp/modules.alias

And then replace the original file

$ cp /tmp/modules.alias  ../initrd_unpack/lib/modules/2.6.32.12-0.7-default/modules.alias
cp: overwrite `../initrd_unpack/lib/modules/2.6.32.12-0.7-default/modules.alias'? y

The process is the same for the modules.pcimap file

$ /sbin/depmod -n $(pwd)/lib/modules/2.6.32.12-0.7-pae/updates/e1000e.ko | grep '^e1000e ' > /tmp/newpcimap
$ grep -v '^e1000e ' ../initrd_unpack/lib/modules/2.6.32.12-0.7-default/modules.pcimap > /tmp/modules.pcimap
$ cat /tmp/newpcimap >> /tmp/modules.pcimap
$ cp /tmp/modules.pcimap ../initrd_unpack/lib/modules/2.6.32.12-0.7-default/modules.pcimap
cp: overwrite `../initrd_unpack/lib/modules/2.6.32.12-0.7-default/modules.pcimap'? y

Finally, make the new initrd file

$ cd ../initrd_unpack
$ find . | cpio --quiet -o -H newc > ../initrd
$ cd ..
$ gzip -v9c initrd > initrd.gz
$ mv initrd.gz initrd
mv: overwrite `initrd'? y
$ file initrd
initrd: gzip compressed data, was "initrd", from Unix, last modified: Wed Jun 29 12:31:49 2011, max compression

October 07, 2010

Where am I?

Writing about web page http://go.warwick.ac.uk/vpn

If you are one of those people who might be able to tell where I was when I posted this by looking at logs, you'd think I was on campus because of the IP address. Except I'm not. I'm at home. Magic? No, it is of course merely sufficiently advanced technology in the form of a VPN.

The System Requirements for Linux machines for some reason single out two distributions, presumably those known to meet the requirements listed afterword. I'm using openSUSE 11.3 which isn't on the list but it seems to work fine. The only glitch I've seen is that when the client install finished it told me "If you have GTK 2.10.0 or later, look for the icon in the notification area:" and there was no such icon, even though a quick visit to whatismyip showed the connection had worked. Selecting the Cisco client from the Application Browser resulted in the icon appearing as expected though.

One very minor gripe I have is that the client installation process doesn't bother to tell you what it's installing or where it's installing it. A quick bit of detective work reveals it puts stuff in /opt/cisco (and a .desktop file in /usr/share/applications) and there's a script called vpn_uninstall.sh in there.


August 04, 2010

18 degrees celcius and rainy

Follow-up to 9 degrees celcius from Mike's blag

Looks like the new owners of Coventry Airport have found the switch that turns the weather data feed back on.

Right weather



February 05, 2010

Finding the path of a Firefox profile

The other day I found myself needing to be able to determine the path of a user's Firefox profile. It was one of those tasks that seemed very simple to start with but then got more complicated the more I thought about it. Some people have more than one Firefox profile. So it needs to be determined which one is the default, which requires working it out by looking at the user's profiles.ini file. profiles.ini may contain details of one or more profiles. If it contains details of more than one profile one of them will be marked as the default, but if there is only details of one profile it won't be marked as the default. If a profile is marked as default then the line which marks it as default isn't always in the same place in relation to the other information about the profile. The path to the profile that appears in profiles.ini might be relative to the location of profiles.ini, or it might not be. In the end I realised that rather than it being a case of writing a couple of lines in the script I was writing, it was a task best suited to being broken out in to a separate script which I can re-use in future.

Anyway, in the admittedly unlikely event that you've been looking for a way to find the path to a user's Firefox profile, here's a Script to find path of default or specified Firefox profile. It's written for Linux. It will probably work on other *nix systems (e.g. Mac OS X) by changing the value of $firefoxprofiledir and maybe making a few other tweaks.


December 15, 2009

9 degrees celcius

The weather indicator in the top right of my GNOME desktop has been saying 9 degrees celcius for the last few days:

Wrong Weather

Which is clearly wrong. I think I've just worked out why it's not updating. A common source of weather data is airports. GNOME gets it's weather information from airports. For Coventry it uses Coventry Airport. Coventry Airport has been closed due to financial difficulties. Various sites which would usually display information from it's weather data feed all say 'no data'. So looks like the closure of Coventry Airport extends to it's weather data feed. Later on I might look at making it use an alternate data source.


Search this blog

Tags

RSS2.0 Atom
Not signed in
Sign in

Powered by BlogBuilder
© MMXXIV