simple shell script to download the frontpage of major greek newspapers has a very usefull feature on their site, it has all major greek newspapers’ front page scanned and posted in a place called kiosk.

Even though this is very nice, it doesn’t fit my viewing needs, I want all newspapers on my local drive every morning so I can view them with my favorite image viewer. In order to do so I created a small shell script.

The script:

#simple shell script to download the frontpage of major greek newspapers from
#feel free to modify it as you wish :)
YEAR=`date +%Y`
MONTH=`date +%m`
DAY=`date +%d`
mkdir -p ~/${YEAR}/${MONTH}/${DAY}/
cd ~/${YEAR}/${MONTH}/${DAY}/
exclude=(30 31 32 33 34 58 60 61 69 78 79)
while [ "$i" -lt 80 ]; do
if [ "$i" = "${exclude[$j]}" ]; then
echo "excluding $i"
wget -q -nc -c${YEAR}/${MONTH}/${DAY}/${i}_h.jpg
while [ "$k" -lt $include_len ]; do
wget -q -nc${YEAR}/${MONTH}/${DAY}/${include[$k]}_h.jpg

Just add the script to your user’s crontab and you are ready. Since not all newspapers come out in the morning at the same time, you can add that script to run on your crontab every one hour in the morning from 7 o’clock until 12 o’clock.

Some details:
The kiosk has an interesting and weird “feature”. To find a newspaper’s ID-url you can go to and click on the newspaper you want. A window with a thumbnail will appear, click on the thumbnail and a new pop-up window with a bigger image will come forward. Now right click on the image and select copy image location. It should be something like: Even though most newspapers feature sequential numbering until number 34, some come with a higher number like 53, 60, 61, 78, 79. So while one might think that it’s safe to iterate until 80 to catch them all, that’s not the case. Some sports and all local newspapers have ID numbers like 69389! In order to cope with these, for anyone who might want them, I added another loop in the script that uses an “include” array. Put any high numbers above 80 inside the include array (seperated by a whitespace) and the script will download them. Since I don’t like reading sports and gossip newspapers I have added an exclude array in the main loop in order to avoid downloading them. If you want to download all newspapers simply remove the numbers I have in my exclude list.

I don’t understand what’s the purpose of having both small sequential numbers and bigger “random” ones as IDs. Do you ?

iloog-7.06 on Sony Vaio PCG-SR21K

A new old Laptop to test iloog:

A few days ago my friend Dimitris gave me his old Sony Vaio PCG-SR21K since he didn’t need it any more.


Mobile Pentium III/650 with SpeedStep technology and 256Kb of on-die Level 2 cache, 64Mb of PC100 SDRAM, Intel 440Z motherboard chipset, fixed 10Gb IBM Travelstar DJSA-210 hard disk, external 16x CD-ROM, 8Mb S3 Savage/IX graphics, 10.4in XGA TFT screen, Yamaha DS-XG audio, integrated stereo speakers, integrated V.90 modem, one Type II PC Card slot, expansion port, plus ports for USB, IEEE-1394 and Sony Memory Stick, Windows 2000 Professional (nooooooooooooot!), Sony video-editing suite (crap!). Dimensions: 259 x 209 x 32mm (W x D x H). Weight: 1.4kg.

It is a perfect laptop for iloog testing.

Boot Process:

When I tried to boot iloog to it from it’s external pcmcia cdrom I faced the a problem though, the iloog kernel does not support (yet ?) cdrom drives on pcmcia (I had never thought of booting from such devices when creating the iloog kernel) so iloog’s initrd couldn’t operate as it should. As long as the iloog kernel started and initrd scripts run, they couldn’t find a bootable device since no cdrom device was found, only the hard disk was recognized that far. This laptop is pretty old so there wasn’t either any option to boot from usb. The good news was that the laptop already had an old slackware (version 10 or 11, I can’t really remember) running on it, with two ext3 partitions (hda2 and hda3) and another one for swap (hda1). We had installed that slackware version with Dimitris following the advice posted on this forum One has to add this:

linux ide2=0x180,0x386

to the boot prompt.

Since there was already another linux OS installed on the laptop I didn’t need to put that command on iloog’s boot prompt and decided to take another path. I started slackware normally, then I put iloog-7.06 CD in the pcmcia cdrom drive, mounted it under /mnt/cdrom and then copied the contents of /mnt/cdrom to /mnt/hda3 (where /dev/hda3 was already mounted). I rebooted the laptop and made it boot again from the pcmcia cdrom drive. The iloog kernel and initrd scripts started and could now find the files they needed under /dev/hda3, so it the boot process continued just fine. Since no files but the kernel and initrd scripts ran from the external cdrom the boot process was a lot faster than it would have been running from the old external 16x cdrom drive. This process of storing iloog’s files on a hard disk partition should have provided enough info for those who want to run iloog as a livecd from their hard disk for testing.

Local Install:

The next thing I wanted to do was to install iloog locally on the hard disk than just having it boot as a livecd from the disk. The process was exactly the same as I have described in a previous post about installing an older iloog version to another old laptop. The only difference was that I installed grub instead of lilo, but that’s more of a preference than a necessity.


Even though the laptop has an S3 savage graphics chipset, the only working xorg driver for me is vesa, but it does work just fine. If you don’t know how to change your xorg driver to vesa just use the script (found under /usr/local/bin).

Install New Applications:

Since the laptop has only 64Mb of ram, using Firefox is extremely difficult. Fuzz proposed to install Opera. In order to install anything from portage to iloog one must run the script first . This script fetches the database of all installed packages on iloog (/var/db/), normally these are not on the livecd because a) they take too much space b) who and why would install new apps on a livecd c) they take way too much space :). When the script finishes, one has to run an:
emerge --sync
in order to fetch the latest portage.

The an emerge -avt opera to install the latest opera 🙂

So, after running and emerge --sync, you can install any applications you want on an iloog.

I wanted to build a newer stable kernel (emerge -avt sys-kernel/gentoo-sources, gentoo-sources-2.6.21-r4 at the current time) to test the performance and remove unused stuff from the kernel. This newer kernel has also the sony_laptop module included. This is the config I used:

kernel 2.6.21 config for PCG-SR21K

I’ve build the sonypi and sony_laptop as external modules and since udev does not load them automagically I needed to edit
/etc/modules.autoload.d/kernel-2.6 and add the modules in that file.

Extra controls
To control the brightness of the screen, check/set the fan speed, check the temperature and see the remaining battery I run an emerge app-laptop/spicctrl. spicctrl uses the sonypi module, so make sure you have already loaded it. This module also makes the jog dial button act as extra mouse keys. iloog’s xorg file already has support for 5 button mice, so I was good to go. I was no able to scroll up and down using the jod dial button. When the jog dial is pressed it acts as middle mouse button so I can use it as that too.

In order to make use of the extra function keys I needed to emerge app-misc/sonypid. With the help of a brilliant perl script called sonypidd I could assign various functions/scripts to the function keys.
I’ve made some modifications to the original one though, the original script uses aumix to change the sound settings but I like amixer more, so I used that one. I’ve even changed the program it used for playing a click.wav upon pressing the function keys (it used sox, I used play), and the click.wav itself (I’ve used the click.wav that comes with the game gweled).

Here’s my sonypidd: sonypidd for iloog
and click.wav: sonypidd for iloog
To make it all work, extract sonypidd.gz to /usr/local/bin/sonypidd and click.tar.gz to /usr/share/sounds/click.wav. Then, edit /etc/conf.d/local.start and add:
/usr/local/bin/sonypidd >/dev/null 2>&1>
to the end of the file

I also wanted to make the jog dial button to appear the fluxbox menu, so I’ve edited ~/.fluxbox/keys file and changed the line that referred to Mouse2 from:
OnDesktop Mouse2 :workspaceMenu
None Mouse2 :rootMenu

Now I can open a fluxbox menu even when I have other applications on top of the desktop by pressing the jog dial button 🙂

I’d be glad if sjog or rsjog worked so I could do more with the jogdial, but I haven’t made it yet. Their development has stopped and their code no longer builds with the current libraries. Any good programmers out there to revive these programs ? 🙂

Speeding up compilations:
To speed up package compilation I’ve set up distcc on the laptop and on my desktop pc. The problem I faced though was that iloog is compiled as i586 arch and my desktop as i686 so I had to use distcc with crossdev. Even though crossdev appeared to save the day it had a minor problem with it. It always installs the latest testing packages for crosscompiling, and since iloog uses stable packages there were some conflicts while installing packages. These were solved by a brutal hack, editing the /usr/sbin/crossdev binary (line 472) and commenting out the “if [[ -f package.keywords ]]” loop. Then I could put the versions I wanted inside /etc/portage/package.keywords like that:

=cross-i586-pc-linux-gnu/gcc-4.1.2 x86~x86
=cross-i586-pc-linux-gnu/glibc-2.5-r4 x86 ~x86

Since distcc with crossdev in now installed I will try to install xorg-server with kdrive use flag. I think that Xvesa will be a loooot lighter than X server.

Pages I’ve read during the process:

Oneliner: text to image using imagemagick

$ convert -size 200x30 xc:transparent -font /usr/share/fonts/dejavu/DejaVuSansMono.ttf -fill black -pointsize 12 -draw "text 5,15 'this is just a test'" test.png

The result:

With this oneliner it’s very easy to create images of e-mail addresses for anti-spam purposes (pretty old-fashioned though).