Difference between revisions of "Custom Perl For Chumby"

From Chumby Wiki
Jump to: navigation, search
(Pre-compiled, ready-to-run Perl)
Line 9: Line 9:
  
 
This is the file that will get updated on a regular basis. This build contains some generic CPAN modules that can be useful when writing Perl scripts on the Chumby. Among them are the libwww package and the Mail::Sender package.
 
This is the file that will get updated on a regular basis. This build contains some generic CPAN modules that can be useful when writing Perl scripts on the Chumby. Among them are the libwww package and the Mail::Sender package.
  http://files.chumby.com/resources/Arm.usb.5.10.Chumby.tgz
 
  
All the applications listed on the [[Scratchbox|'''How-to page''']] are included in this package.
+
  http://files.chumby.com/resources/usr_arm_ext3_basicperl.tgz
 +
  http://files.chumby.com/resources/usr_arm_ext3.tgz
 +
  http://files.chumby.com/resources/usr_arm_fat32.tgz
  
If you are unpacking this on a FAT/FAT32 USB key, you will have an issue with the symlink to perl - namely the /mnt/usb/usr/local/bin/perl.5.10.0 > perl, that will not be created on a FAT/FAT32. To remedy this, copy the perl binary to the expected name:
+
The '''usr_arm_ext3_basicperl.tgz''' contains only basic things as:
  
   cd /mnt/usb/usr/local/bin/
+
Perl 5.10.0 with a lot of CPAN modules installed
  cp perl.5.10.0 perl
+
id3v2
 +
ImageMagick
 +
vim
 +
 
 +
The other two contain all the applications listed on the [[Scratchbox|'''How-to page''']], like:
 +
 
 +
GNU Debugger
 +
Subversion
 +
GNU Screen
 +
tcpdump
 +
GNU Netcat
 +
NMap
 +
Pipe Viewer
 +
Lighttpd
 +
Python
 +
 
 +
If you are unpacking this on a FAT/FAT32 USB key, you will have an issue with the symlink to perl - namely the usr/bin/perl.5.10.0 > perl, that will not be created on a FAT/FAT32. To remedy this, copy the perl binary to the expected name:
 +
 
 +
   cd /mnt/usb
 +
  cp usr/bin/perl.5.10.0 /usr/bin/perl
 +
 
 +
You can also use a shell script to set your environment, create the proper symlink in /psp and correct the missing file:
 +
 
 +
#!/bin/sh
 +
if [ ! -e /psp/usr ]; then
 +
  if [ -e /mnt/storage/usr ]; then
 +
    ln -s /mnt/storage/usr /psp/usr
 +
  else
 +
    if [ -e /mnt/usb/usr ]; then
 +
      ln -s /mnt/usb/usr /psp/usr
 +
    else
 +
      echo "Could not find /mnt/storage/usr or /mnt/usb/usr"
 +
      exit 1
 +
    fi
 +
  fi
 +
fi
 +
if [ ! -f /psp/usr/bin/perl ]; then
 +
  if [ -f /psp/usr/bin/perl5.10.0 ]; then
 +
    # We run this from the USB as FAT32 and Perl was not correctly unpacked
 +
    echo "Making a working copy of Perl as /psp/usr/bin/perl"
 +
    cp /psp/usr/bin/perl5.10.0 /psp/usr/bin/perl
 +
    sync
 +
  else
 +
    echo "Could not find perl in /psp/usr/bin"
 +
    exit 1
 +
  fi
 +
fi
 +
if [ ! -e /tmp/home ]; then
 +
  mkdir /tmp/home
 +
fi
 +
export HOME=/tmp/home
 +
export PATH=/psp/usr/sbin:/psp/usr/bin:$PATH
 +
export LD_LIBRARY_PATH=/psp/usr/lib:$LD_LIBRARY_PATH
 +
export PS1="\[\e[36;1m\]\u\[\e[33;1m\]:\[\e[0m\]\w\[\e[32;1m\] > \[\e[0m\]"
 +
export TERM='ansi'
 +
export PERL_PATH=/psp/usr/bin/perl
 +
if [ -e /psp/usr/vimrc ]; then
 +
  cp /psp/usr/vimrc /tmp/home/.vimrc
 +
fi
 +
 
 +
Save this as /mnt/usb/setdev, and invoke the following when you start your session:
 +
 
 +
source /mnt/usb/setdev

Revision as of 11:24, 13 November 2009

The instructions for building Perl to work on the Chumby are found Here.

You will learn how to set up a development environment using Scratchbox, and compile your own Perl and applications.


Pre-compiled, ready-to-run Perl

Download here the Perl, the include libraries, and applications as they should be installed on a Chumby USB key. They will get unpacked in "usr", which will appear on the Chumby as /mnt/usb/usr.

This is the file that will get updated on a regular basis. This build contains some generic CPAN modules that can be useful when writing Perl scripts on the Chumby. Among them are the libwww package and the Mail::Sender package.

 http://files.chumby.com/resources/usr_arm_ext3_basicperl.tgz
 http://files.chumby.com/resources/usr_arm_ext3.tgz
 http://files.chumby.com/resources/usr_arm_fat32.tgz

The usr_arm_ext3_basicperl.tgz contains only basic things as:

Perl 5.10.0 with a lot of CPAN modules installed
id3v2
ImageMagick
vim

The other two contain all the applications listed on the How-to page, like:

GNU Debugger
Subversion
GNU Screen
tcpdump
GNU Netcat
NMap
Pipe Viewer
Lighttpd
Python

If you are unpacking this on a FAT/FAT32 USB key, you will have an issue with the symlink to perl - namely the usr/bin/perl.5.10.0 > perl, that will not be created on a FAT/FAT32. To remedy this, copy the perl binary to the expected name:

 cd /mnt/usb
 cp usr/bin/perl.5.10.0 /usr/bin/perl

You can also use a shell script to set your environment, create the proper symlink in /psp and correct the missing file:

#!/bin/sh
if [ ! -e /psp/usr ]; then
  if [ -e /mnt/storage/usr ]; then
    ln -s /mnt/storage/usr /psp/usr
  else
    if [ -e /mnt/usb/usr ]; then
      ln -s /mnt/usb/usr /psp/usr
    else
      echo "Could not find /mnt/storage/usr or /mnt/usb/usr"
      exit 1
    fi
  fi
fi
if [ ! -f /psp/usr/bin/perl ]; then
  if [ -f /psp/usr/bin/perl5.10.0 ]; then
    # We run this from the USB as FAT32 and Perl was not correctly unpacked
    echo "Making a working copy of Perl as /psp/usr/bin/perl"
    cp /psp/usr/bin/perl5.10.0 /psp/usr/bin/perl
    sync
  else
    echo "Could not find perl in /psp/usr/bin"
    exit 1
  fi
fi
if [ ! -e /tmp/home ]; then
  mkdir /tmp/home
fi
export HOME=/tmp/home
export PATH=/psp/usr/sbin:/psp/usr/bin:$PATH
export LD_LIBRARY_PATH=/psp/usr/lib:$LD_LIBRARY_PATH
export PS1="\[\e[36;1m\]\u\[\e[33;1m\]:\[\e[0m\]\w\[\e[32;1m\] > \[\e[0m\]"
export TERM='ansi'
export PERL_PATH=/psp/usr/bin/perl
if [ -e /psp/usr/vimrc ]; then
  cp /psp/usr/vimrc /tmp/home/.vimrc
fi

Save this as /mnt/usb/setdev, and invoke the following when you start your session:

source /mnt/usb/setdev