Copying files and dirs with tar

If you want to copy a bunch of files from one spot to another, but preserve links/permissions/ownership/…, it’s usually a big hassle.

With tar, you can make this hassle disappear!

Copying a directory tree and its contents to another filesystem using tar will preserve ownership, permissions, and timestamps. You can use pipe tar to another tar to prevent having to create an intermediate file to store the stuff you want to copy around.

To copy all of the files and subdirectories in the current working directory to the directory /destination, use:

tar cf - * | ( cd /destination; tar xfp -)

The first part of the command – tar – makes a tarball of all the files, and writes this to stdout. The second part of the command part will first change directory, and then extract the tarball in that location, reading from it’s stdin.

Since the cd and tar commands are contained within parentheses, their actions are performed together.

The p option in the tar command instructs tar to preserve the permission and ownership information, if possible. So if you want to move a lot of files around, it’s advisable to do so with the root user to keep all them permissions!

Funpidgin

Thanks to a post on Frank Goosens’ blog I discovered FunPidgin! A fork of Pidgin, a multi-messenger client formerly known as Gaim.

My biggest (and actually, only) gripe with Pidgin is that they changed the way the contact list works/behaves – you no longer have a clear view of what protocol a user is added with, so you also don’t know what protocol to pick for someone to send him/her a message/file. Since they were obviously not going to listen to their users (although it has been requested a ton of times, search their Trac), it was only a matter of time before a fork was created: Funpidgin.

“What makes us different from the official client, is that we work for you. Unlike the Pidgin developers, we believe the user should have the final say in what goes into the program.”

I’m definitely gonna check it out!

Linux on my MacBook

I’m currently trying to get Linux (Debian Sid) working on my MacBook… it’s installed, but still needs lots of tweaking.

Most of the things work out of the box, except the things listed below:

Specific things that work (after tweaking):

  • Xorg with resolution at 1280×800
  • WiFi (atheros)
  • special buttons (volume/brightness/…)

Things that need to work still:

  • Touchpad (well, it works, but it needs to work better)
  • iSight

Sources I’m using at the moment:

I’ll write a detailed post on this later… when I’m not uberly lazy ;)

Vmware console on Debian Lenny

I just installed VMWare server on my gf’s linux-laptop, but the server console didn’t want to start for some reason… Just came back to the command line, nothing happening.

Running vmware as
LD_PRELOAD=/usr/lib/libdbus-1.so.3:$LD_PRELOAD vmware made things work, strangely enough ;)

Guess it’s because she’s not running any dbus-aware windowmanager, and thus said library not being loaded before the start of the server console. Ah well, fixed now ;)

2600 – Off The Hook / Off The Wall radio show archive downloader

This script is a downloader for the entire archives of the 2600 radio shows Off The Hook and Off The Wall.

These radio shows are (ofcourse) © 2600. The script is mine :p

Usage

Download the script, gunzip it and run it. It will tell you the correct usage.

For example: ./get_2600_archive otw /tmp/offthewall

Requirements

wget, sed, … the usual linux tools

get_2600_archive.gz (53 downloads)

arm-linux crosscompiling on Debian Sid

Here’s a simple howto on how to install an ARM crosscompiling environment on your Debian Unstable:

  1. Install crosscompiler packages from http://debian.speedblue.org/
  2. Create a virtual deb package extraction directory:
    1. Create the directory /usr/arm-deb
    2. Create the directory /usr/arm-deb/usr
    3. Create the following symlinks in /usr/arm-deb/usr:
      1. ln -s /usr/arm/bin /usr/arm-deb/usr/bin
      2. ln -s /usr/arm/lib /usr/arm-deb/usr/lib
      3. ln -s /usr/arm/include /usr/arm-deb/usr/include
      4. ln -s /usr/arm/share /usr/arm-deb/usr/share

    This will allow easy package extraction.

Now, download the packages you need manually (from http://packages.debian.org/ and extract them in the directory using dpkg -x <package file> /usr/arm-deb

To compile something, you first have to add /usr/arm/bin to your path (export PATH=/usr/arm/bin:$PATH), set include paths to those include files (export CPPFLAGS="-I/usr/arm/include") and add
-host=arm-linux to your ./configure.

Happy compiling ;)

Vmware and Linux-2.6.22

If you’re rolling your own kernels, and upgraded to 2.6.22, you might have bumped into a compilation issue:


include/asm/page.h: In function ‘pte_t native_make_pte(long unsigned int)’:
include/asm/page.h:112: error: expected primary-expression before ‘)’ token
include/asm/page.h:112: error: expected ‘;’ before ‘{‘ token
include/asm/page.h:112: error: expected primary-expression before ‘.’ token
include/asm/page.h:112: error: expected `;’ before ‘}’ token

How to fix this:

  1. Download the vmware-any-any-update110.tar.gz update. Unpack in /tmp
  2. Go into the vmware-any-any-update110 directory, and untar the vmmon.tar file (tar xvf vmmon.tar)
  3. Execute the following command:
    sed -i ‘s!# include !!g’ vmmon-only/common/hostKernel.h
  4. Re-tar vmmon.tar (tar cvf vmmon.tar vmmon-only)
  5. run runme.pl

And you’re done!

Thanks to the Gentoo bug tracker and all persons posting on it for the ‘fix’.

As per always, if it eats your cat, it’s not my fault nor my problem! ;)

Edit: vmware-any-any-update112.tar.gz has been released meanwhile, which solves the above problem too.

Gallery-Remote

I was trying to get GalleryRemote installed today on my Linux installation (because for obscure reasons, using the java applet in gallery directly crashes my browsers), which wouldn’t run. Attempting to run the installer gave obscure errors like:

awk: error while loading shared libraries: libm.so.6: cannot open shared object file: No such file or directory
dirname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
...

A quick search led me to see that the problem was related to the variable LD_ASSUME_KERNEL being set, causing libc6 to fail loading its libraries.

So, the process to get it up and running is:

  1. download GalleryRemote (non-vm)
  2. run this in the directory where you downloaded it:
    $ cp GalleryRemote.1.5.Linux.NoVM.bin GalleryRemote.1.5.Linux.NoVM.bin.orig
    $ cat GalleryRemote.1.5.Linux.NoVM.bin.orig | sed "s/export LD_ASSUME_KERNEL/#xport LD_ASSUME_KERNEL/" > GalleryRemote.1.5.Linux.NoVM.bin
  3. install GalleryRemote
  4. run this in the directory where you installed it:
    $ cp Gallery_Remote Gallery_Remote.orig
    $ cat Gallery_Remote.orig | sed "s/export LD_ASSUME_KERNEL/#xport LD_ASSUME_KERNEL/" > Gallery_Remote

Now you should be all set to use GalleryRemote!

Linux, distcc and Mac OS X

If you’re like me, and have Fink installed on your Mac and compiling away all those wonderful unix applications, and you have a desktop nearby running linux (with more processor power being unused), you’ll want to setup distcc so you can harnass all that power.

I found a rather nice article that contains a walkthrough on how to get things done.

It works nicely. A few remarks:

  • Download the correct gcc version from Apple. You can check your Mac’s version by running gcc -v:
    $ gcc -v
    Using built-in specs.
    Target: i686-apple-darwin8
    ...
    Thread model: posix
    gcc version 4.0.1 (Apple Computer, Inc. build 5367)

    That build is important.
  • Don’t bother trying to build the odcctools on x86_64. It’s broken, kaput. Install yourself a 32bit chroot and build as from there. Don’t forget to switch back to the 64bit environment when building gcc!

Now, the other thing you need to do is convince fink to use distcc.

After compiling a while, you should have a working distcc setup. Unfortunately, for some reason my distcc’s keep segfaulting on my debian box, so that’s one issue I have to fix. If anyone can help, feel free ;)