[clue-tech] Playing this type of flash on Linux
Tom Poindexter
tpoindex at nyx.net
Tue Aug 29 14:04:35 MDT 2006
I found it easier to set up a chroot32 environment. There's quite a bit
to download, but I have a script to automate all of the dirty work after
setting some shell variables. The script installs firefox, flash (Ver 7),
mplayer & plugin, java plugin, cups (for printing), some browser helpers
(xpdf, abiword, gnumeric), and sets a sound wrapper, all out of the box.
Plus, it mounts most of your relevant directories & files in the chroot32
filesystem.
Uncomment a few variables to install win32 codecs, realplayer, skype, etc.
Note: for Ubuntu/Kubuntu as written.
--
Tom Poindexter
tpoindex at nyx.net
----cut here-----------------------------------------------------------------
#!/bin/bash
# chroot32.sh - set up a 32-bit chroot environment and install
# 32-bit Firefox browser, plugins, helpers, other 32bit programs
#
# Tom Poindexter tpoindex at nyx.net
# Version 0.1 June 25, 2006
# Designed for Ubuntu Dapper 6.06
# Any claim of copyright is expressly disclaimed; placed in the public domain.
#
# Instructions:
#
# 1. Download this file, save as 'chroot32.sh'
#
# 2. Edit this file. Look for shell variables afer the line 'EDIT THIS'
# and change as desired. You shouldn't have to change
# anything below the line marked: 'DO NOT EDIT BELOW THIS LINE'
# Defaults are generally reasonable so that little editing
# is required.
#
# Especially note that some extra 3rd party programs and libraries can
# be installed by uncommenting their definitions. Determining
# the authenticity and legality of such packages are the responsibility
# of anyone running this script.
#
# 3. Execute this file using sudo and bash:
#
# sudo bash chroot32.sh
#
# Depending on what packages are installed, you may have to
# interactively configure programs and/or accept licenses.
#
# Other notes:
#
# - Files created or modified in native enviorment:
# /etc/dchroot.conf (new chroot name and directory added, backed up)
# /etc/fstab (additional 'bind' mounts for chrootdir, backed up)
# /usr/local/bin/* (32bit program links, or as set by 'bin32' variable)
# /var/chroot32/* (the chroot env, or as set by 'chrootdir' variable)
#
# - Expect to download 48 Mb of packages for the initial chroot bootstrap,
# and an additional 100 - 130 Mb for packages installed. Nearly all the
# time required to run this script is downloading packages, expect
# 30+ minutes for a moderately fast DSL or Cable connection, much
# longer if you have a slower connection.
#
# - The chroot will consume 600+ Mb of disk after installation. The
# downloaded packages are removed after package installation, saving
# approximately 200 Mb.
#
# - 32-bit chroot programs are installed in the native system in $bin32
# (/usr/local/bin as a default) with a suffix of '32'.
# E.g. 'firefox' in the chroot can be executed by 'firefox32', assuming
# /usr/local/bin is in your PATH.
#
###############################################################################
# EDIT THIS: here is the start of the configuration variables
###############################################################################
# YOU MUST COMMENT OUT THE FOLLOWING COMMAND TO RUN THIS SCRIPT.
# BY EDITING THIS SCRIPT, YOU TAKE RESPONSIBLITY FOR THE ENTIRE
# EXECUTION OF THIS SCRIPT.
echo "$0 has not been configured." && exit
#########################
# BASE DEFINITIONS
#########################
# Set the ubuntu release, archive and security sites, chroot name and
# directory for chroot.
# bin32 directory is where to link installed programs in the native enviroment.
# should be somewhere on your PATH.
release="dapper"
archive="http://archive.ubuntu.com/ubuntu"
security="http://security.ubuntu.com/ubuntu"
chroot=chroot32
chrootdir=/var/chroot32
bin32=/usr/local/bin
#########################
# SOUND SYSTEM WRAPPER
#########################
# Optional soundwrapper program when running programs in chroot,
# Typically 'artsdsp' for a KDE environment, or 'esddsp' for GNOME environment.
# Also, define the required packages to be installed in the chroot.
# Comment out for no sound wrapper.
# If soundwrapper is "auto", then try to figure out what is running.
soundwrapper="auto"
pkg_sound="auto"
# uncomment for KDE (arts)
#soundwrapper="artsdsp"
#pkg_sound="libarts1c2a"
# uncomment for GNOME (esd)
#soundwrapper="esddsp"
#pkg_sound="esound-clients"
# note that esddsp is known to be buggy:
# https://launchpad.net/malone/bugs/29760
# uncomment for no sound wrapper defined
#soundwrapper=""
#pkg_sound=""
# figure out which soundwrapper to use if 'auto'
if [ "$soundwrapper" = "auto" ] ; then
if [ `pgrep -c '^esd$'` -gt 0 -o `pgrep -c '.*/esd$'` -gt 0 ] ; then
soundwrapper="esddsp"
pkg_sound="esound-clients"
fi
if [ `pgrep -c '^artsd$'` -gt 0 -o `pgrep -c '.*/artsd$'` -gt 0 ] ; then
soundwrapper="artsdsp"
pkg_sound="libarts1c2a"
fi
if [ "$soundwrapper" = "auto" ] ; then
echo "Couldn't figure out sound system, please set"
echo "the 'soundwrapper' and 'pkg_sound' settings in $0"
echo "Aborting."
exit
fi
echo "Sound configuration found as: $soundwrapper package: $pkg_sound"
fi
#########################
# PACKAGES - UBUNTU
#########################
# Packages to install from ubuntu archives.
# Usually no need to edit these.
pkg_firefox="firefox"
pkg_flash="flashplugin-nonfree"
pkg_java="sun-java5-bin sun-java5-plugin"
pkg_mplayer="mplayer mencoder mplayer-fonts mozilla-mplayer"
# Packages for system support: printing, etc.
pkg_system="cupsys cupsys-client"
# Helper programs for firefox, to open PDF, MS Word, Excel documents.
# These helpers are not absolutely necessary, you can always save the
# document, and open it in the native 64 bit environment with openoffice, etc.
# Default is to use xpdf, abiword, gnumeric
# Alternative: use xpdf (or manual install of Adobe Arcobat) and openoffice
pkg_helpers="xpdf abiword gnumeric"
#pkg_helpers="xpdf openoffice.org"
# Other packages, uncomment and edit to suit your taste.
pkg_other=""
#pkg_other="$pkg_other synaptic"
#pkg_other="$pkg_other vlc vlc-plugin-esd vlc-plugin-arts vls"
#pkg_other="$pkg_other avidemux-2.1.0 avifile-player avifile-divx-plugin"
#pkg_other="$pkg_other ogle ogle-gui totem xine-ui"
#pkg_other="$pkg_other libxvidcore4 libdvdnav4 libdvdread3"
#pkg_other="$pkg_other your-choice"
#########################
# PACKAGES - OTHER
#########################
# Packages from 3rd party archives.
# Uncomment both sets of variables to install
# wine - execute windows applications
#deb_1="deb http://wine.budgetdedicated.com/apt dapper main"
#pkg_1="wine"
# multimedia codecs, read dvds, realplayer, skype
#deb_2="deb http://packages.freecontrib.org/ubuntu/plf/ $release free non-free"
#pkg_2="w32codecs libdvdcss2 realplay skype"
# other - add your own
#deb_3=""
#pkg_3=""
# The total list of packages to install in the chroot
packages=""
packages="$packages $pkg_sound $pkg_firefox"
packages="$packages $pkg_helpers $pkg_flash $pkg_java $pkg_mplayer"
packages="$packages $pkg_system"
packages="$packages $pkg_other"
packages="$packages $pkg_wine $pkg_1 $pkg_2 $pkg_3"
#########################
# PROGRAMS INSTALLED
#########################
# Programs that may be installed during package installation.
# If a program in this list is found in the chroot, then a link
# to it will be made in the $bin32 directory with a suffix of '32'.
# Add other programs here if you added other packages.
# Missing programs will not cause an error, so it's safe to
# make this list of every possible program.
programs=""
programs="$programs firefox"
programs="$programs mplayer gmplayer mencoder java"
programs="$programs realplay skype"
programs="$programs xpdf abiword gnumeric ooffice"
programs="$programs realplay skype"
programs="$programs wine winecfg winefile"
programs="$programs synaptic xine totem ogle avidemux aviplay"
###############################################################################
# DO NOT EDIT BELOW THIS LINE
###############################################################################
###############################################################################
echo "Checking configurations...."
# check that bin32 exists
if [ ! -d $bin32 ] ; then
echo "bin32 directory '$bin32' does not exist."
echo "Aborting."
exit
fi
# make sure chrootdir is non-null and does not exist
if [ "$chrootdir" ] ; then
if [ -f $chrootdir -o -d $chrootdir ] ; then
echo "chrootdir '$chrootdir' already exists."
echo "Aborting."
exit
else
if ( echo $chrootdir | egrep -q '^/' ) ; then
: ok, starts with /
else
echo "chrootdir '$chrootdir' doesn't begin with '/', should be an absolute pathname"
echo "Aborting."
exit
fi
fi
else
echo "'chrootdir' must not be blank and be a valid absolute pathname"
echo "Aborting."
exit
fi
# make sure $chroot does not already exist in /etc/dchroot.conf
if egrep -q "^$chroot " /etc/dchroot.conf ; then
echo "chroot name '$chroot' already exists in /etc/dchroot.conf"
echo "Aborting."
exit
fi
echo "Configuration check ok."
###############################################################################
echo "Building initial chroot in $chrootdir"
apt-get update
apt-get -y install dchroot debootstrap linux32
mkdir -p $chrootdir
echo "Backing up /etc/dchroot.conf in /etc/dchroot.conf.$$"
cp /etc/dchroot.conf /etc/dchroot.conf.$$
echo "$chroot $chrootdir" >>/etc/dchroot.conf
chmod 644 /etc/dchroot.conf
debootstrap --arch i386 $release $chrootdir/ $archive
echo $chroot >$chrootdir/etc/debian_chroot
###############################################################################
echo "Set up directories and files from primary environment in chroot"
echo "Backing up /etc/fstab in /etc/fstab.$$"
cp /etc/fstab /etc/fstab.$$
echo -e "\n#\n#\n# binds added for $chroot in $chrootdir\n" >>/etc/fstab
# note: these files and directories will be deleted in the
# chrootdir and mounted (via bind) from the native enviroment.
chfiles='/proc
/dev
/home
/media
/mnt
/opt
/tmp
/etc/aliases
/etc/cups
/etc/environment
/etc/hosts
/etc/passwd
/etc/shadow
/etc/group
/etc/gshadow
/etc/sudoers
/etc/timezone
/etc/resolv.conf
/usr/lib/locale
/usr/share/fonts'
for f in $chfiles ; do
if [ -f $f -o -d $f ] ; then
echo " Mounting $f in $chrootdir"
/bin/rm -rf $chrootdir$f >/dev/null
dir=`dirname $f`
if [ ! -d $chrootdir$dir ] ; then
mkdir -p $chrootdir$dir
fi
if [ -d $f ] ; then
mkdir $chrootdir$f
else
touch $chrootdir$f
fi
echo -e "$f\t$chrootdir$f\t\tnone bind\t0 0" >>/etc/fstab
mount $chrootdir$f
fi
done
echo "Configure locales in $chroot"
dchroot -d -c $chroot "dpkg-reconfigure locales"
localedef="-i en_US -c -f UTF-8 en_US.UTF-8"
dchroot -d -c $chroot "localedef $localedef"
###############################################################################
echo "Building initial /etc/apt/sources.list, update, and install pacakges"
cp $chrootdir/etc/apt/sources.list $chrootdir/etc/apt/sources.list.$$
/bin/rm -f $chrootdir/etc/apt/sources.list
echo "deb $archive $release main restricted universe multiverse" >>$chrootdir/etc/apt/sources.list
echo "deb $archive ${release}-security main restricted universe multiverse" >>$chrootdir/etc/apt/sources.list
echo "deb $archive ${release}-backports main restricted universe multiverse" >>$chrootdir/etc/apt/sources.list
echo "deb $archive ${release}-updates main restricted universe multiverse" >>$chrootdir/etc/apt/sources.list
echo "deb $security $release main restricted universe multiverse" >>$chrootdir/etc/apt/sources.list
echo "deb $security ${release}-security main restricted universe multiverse" >>$chrootdir/etc/apt/sources.list
echo "deb $security ${release}-backports main restricted universe multiverse" >>$chrootdir/etc/apt/sources.list
echo "deb $security ${release}-updates main restricted universe multiverse" >>$chrootdir/etc/apt/sources.list
# add in any extra 3rd party deb archives to sources.list
for i in 1 2 3 4 5 6 7 8 9 ; do
deb=deb_$i
val=`eval echo \\$$deb`
if [ "$val" ] ; then
echo "$val" >>$chrootdir/etc/apt/sources.list
fi
done
echo "Updating $chroot apt sources (apt-get -y update)"
dchroot -d -c $chroot "apt-get -y update"
echo "Upgrading $chroot packages (apt-get -y upgrade)"
dchroot -d -c $chroot "apt-get -y upgrade"
echo "Installing packages in $chroot"
for pkg in $packages ; do
echo " apt-get -y --force-yes install $pkg"
dchroot -d -c $chroot "apt-get -y --force-yes install $pkg"
done
echo "Cleaning deb archives..."
echo " apt-get clean"
dchroot -d -c $chroot "apt-get clean"
# fix up chroot firefoxrc to use sound wrapper
if [ "$soundwrapper" ] ; then
echo "FIREFOX_DSP=$soundwrapper" >>$chrootdir/etc/firefox/firefoxrc
fi
###############################################################################
echo "Creating $chroot launcher script $bin32/exec_soundwrapped_$chroot"
echo "Creating $chroot launcher script $bin32/exec_$chroot"
cat >$bin32/exec_soundwrapped_$chroot <<EOF
#!/bin/bash
chroot=$chroot
soundwrapper=$soundwrapper
EOF
cat >>$bin32/exec_soundwrapped_$chroot <<'EOF'
# get the program name, and strip off any trailing '32'
pgm=`basename $0`
pgm=`echo "$pgm" | sed -e 's/32\$//'`
args="$pgm"
# quote each arg so that args with embbed spaces and quotes are passed correctly
while [ $# -gt 0 ] ; do
arg=`echo "$1" | sed -e 's/./\\\&/g'`
args="$args $arg"
shift
done
# silly hack: use 'nice' as a wrapper, because soundwrappers can't execute
# scripts directly. notice the nice value is zero, so it's not realy nice'd
exec linux32 dchroot -q -d -c $chroot "$soundwrapper /usr/bin/nice -0 $args"
EOF
cat >$bin32/exec_$chroot <<EOF
#!/bin/bash
chroot=$chroot
EOF
cat >>$bin32/exec_$chroot <<'EOF'
# get the program name, and strip off any trailing '32'
pgm=`basename $0`
pgm=`echo "$pgm" | sed -e 's/32\$//'`
args="$pgm"
# quote each arg so that args with embbed space and quotes are passed correctly
while [ $# -gt 0 ] ; do
arg=`echo "$1" | sed -e 's/./\\\&/g'`
args="$args $arg"
shift
done
exec linux32 dchroot -q -d -c $chroot "$args"
EOF
chmod 755 $bin32/exec_soundwrapped_$chroot
chmod 755 $bin32/exec_$chroot
# cd to $bin32 and link programs that were installed
cd $bin32
for pgm in $programs ; do
# try to figure out if the program exists, capture ldd info
found=""
ldd=""
for chbindir in usr/bin usr/sbin sbin usr/local/bin ; do
if [ -f $chrootdir/$chbindir/$pgm ] ; then
found=yes
ldd=`ldd $chrootdir/$chbindir/$pgm 2>/dev/null`
break
fi
done
if [ "$found" ] ; then
# try to see if program uses the sound system we have.
# if so, then use the nosound wrapper, otherwise use sound wrapper
echo -n " Found $pgm in $chroot, installing as $bin32/${pgm}32"
has_libartsc=`echo $ldd | grep -c libartsc`
has_libesd=`echo $ldd | grep -c libesd`
if [ "$soundwrapper" = "artsdsp" -a $has_libartsc -gt 0 ] ; then
ln -s exec_$chroot ${pgm}32
echo " .... linked to exec_$chroot"
elif [ "$soundwrapper" = "esddsp" -a $has_libesd -gt 0 ] ; then
ln -s exec_$chroot ${pgm}32
echo " .... linked to exec_$chroot"
else
ln -s exec_soundwrapped_$chroot ${pgm}32
echo " .... linked to exec_soundwrapped_$chroot"
fi
fi
done
cd -
###############################################################################
echo -e "\n\nFinshed setting up $chroot and installing programs.\n"
echo
echo "Post-install tasks, as needed:"
echo
echo "1. If you have a menu entry or taskbar icon to lauch Firefox, "
echo " change its configuration to use 'firefox32', or add a new menu item"
echo " or icon to start '$bin32/firefox32'."
echo
echo "2. If xpdf, abiword, and gnumeric were installed, run these commands:"
echo
echo "echo 'application/pdf;/usr/bin/xpdf %s' >> ~/.mailcap"
echo "echo 'application/msword;/usr/bin/abiword %s' >> ~/.mailcap"
echo "echo 'application/vnd.ms-excel;/usr/bin/gnumeric %s' >> ~/.mailcap"
echo
echo "3. If xpdf and openoffice were installed, run these commands:"
echo
echo "echo 'application/pdf;/usr/bin/xpdf %s' >> ~/.mailcap"
echo "echo 'application/msword;/usr/bin/ooffice %s' >> ~/.mailcap"
echo "echo 'application/vnd.ms-excel;/usr/bin/ooffice %s' >> ~/.mailcap"
echo
echo "4. Create or edit ~/.mplayer/config, depending on your sound system."
echo " Choose the proper setting for audio output (ao=...)"
echo
echo "mkdir ~/.mplayer"
echo "echo 'ao=arts' >> ~/.mplayer/config # if running KDE"
echo "echo 'ao=esd' >> ~/.mplayer/config # if running GNOME"
echo "echo 'ao=alsa' >> ~/.mplayer/config # direct sound with alsa"
echo "echo 'ao=oss' >> ~/.mplayer/config # direct sound with oss"
echo
echo "5. If you add additional programs to your chroot environment later,"
echo " create links to invoke those programs, e.g.:"
echo
echo "sudo dchroot -d -c $chroot apt-get update"
echo "sudo dchroot -d -c $chroot apt-get install some-package"
echo "cd $bin32"
echo "sudo ln -s exec_soundwrapped_$chroot some-program32 # uses sound wrapper"
echo "or"
echo "sudo ln -s exec_$chroot some-program32 # no sound wrapper"
echo
echo
echo
echo "Done."
More information about the clue-tech
mailing list