Personal tools
You are here: Home download minilive-ldm.sh
Quote of the day
Dof geworden glas / kristal glanst weer na een bad in water met een scheut ammonia. Wel enig geduld hebben.
Volkswijsheid uit Enkhuizen
Log in


Forgot your password?
OpenID Log in

 

minilive-ldm.sh

A script to create a mini live (cdrom) image witl LDM to run as a remote X terminal. It can be used as LTSP terminal where netbooting is not possible.

minilive-ldm.sh2 — text/x-sh, 4Kb

File contents

#!/bin/sh
#
# 2009 Jean-Paul Duyx 
# Script to build debian live image to run as an secure X client, using LDM
# 
# TODO: preconfigure the ssh-key from the ssh server to connect ... else LDM login fails

# Needs to have a recent version of live-helper, i used it from a bootstrapped Sid  chroot
#
# This script was tested from within a Debian Sid/Squeeze chroot and _only_ to make a Lenny image
#
# The backports kernel and aufs packages will probably be out of date soon ... 
#
#
# based on a script by Franklin Piat (Copyright 2007) to make a stripped down live-cd
#
# License GPL + LGPL

#Some local options
DISTRIBUTION=$1

if [ -z "$DISTRIBUTION" ]
then
    echo 
    echo usage: $0 distribution
    echo 
    exit 255
fi

LDM_SERVER=192.168.5.199
LOCALAPTCACHE=
DEBMIRROR=http://${LOCALAPTCACHE}/ftp.debian.org/debian/


WORKDIR=ldm-live-${DISTRIBUTION}
[ ! -d $WORKDIR ] && mkdir -p $WORKDIR
cd $WORKDIR || exit 1

# hack to avoid a strange problem
mkdir -p chroot/usr/sbin/

lh_clean  --binary --stage
rm -rf config 

# make the ldm package list file and put it in the place where live-helper looks for it
cat <<ldm-filelist > /usr/share/live-helper/lists/ldm
# /usr/share/live-helper/lists/ldm-core - package list for live-helper(7)

## LH: LDM Minimal LTSP terminal 
####include <standard-x11>

ldm
console-common
console-tools
netbase 
ifupdown
tcpd
dhcp3-client
debconf-english
e3
xfs
xfonts-base
xfonts-scalable

ldm-filelist


LOCALOPTS="--mirror-bootstrap $DEBMIRROR --mirror-chroot $DEBMIRROR  --mirror-binary $DEBMIRROR --mirror-chroot-security http://security.eu.debian.org/ --mirror-binary-security http://security.eu.debian.org "

#Let's configure live-helper
# distribution specific options:
if [ "$DISTRIBUTION" == "etch" ]
then
lh_config --bootstrap-flavour minimal --packages-lists ldm --hooks stripped --apt apt --apt-recommends disabled --tasksel none --binary-indices disabled --distribution $DISTRIBUTION --linux-flavours 486 --union-filesystem aufs  --memtest disabled --bootappend-live "nolocales" --syslinux-timeout 4 $LOCALOPTS  

elif [ "$DISTRIBUTION" == "lenny" ] || [ "$DISTRIBUTION" == "sid" ]
then # use backport linux
lh_config --bootstrap-flavour minimal --packages-lists ldm --hooks stripped --apt apt --apt-recommends disabled --tasksel none --binary-indices disabled --distribution $DISTRIBUTION --linux-flavours 486 --union-filesystem aufs  --memtest disabled --bootappend-live "nolocales" --syslinux-timeout 4 --packages "" --linux-packages "linux-image-2.6.29-backports.1 aufs-modules-2.6.29-backports.1" $LOCALOPTS  
#squashfs-tools_1:4.0-1~backports50+1_i386 
# configure debian 2.6.29
# 1. configure backports repository through chroot_sources mechanism:

echo "deb http://backports.undebian.org/repositories/backports-kernel/ ./ " > config/chroot_sources/debian-backports.chroot

echo "deb http://backports.undebian.org/repositories/backports-kernel/ ./ " > config/chroot_sources/debian-backports.binary

wget http://backports.undebian.org/repositories/backports-kernel/archive-key.asc -O config/chroot_sources/debian-backports.chroot.gpg
cp config/chroot_sources/debian-backports.chroot.gpg config/chroot_sources/debian-backports.binary.gpg

fi


# Remove locales
# (this could remove other applications. add "-y" if your are confident)
cat <<chrootlocalhooks01 > config/chroot_local-hooks/01-removelocales.sh
apt-get remove locales  --purge
apt-get remove dselect -y --purge 
echo "don t fail on abort (set errorlevel to zero)" > /dev/null
chrootlocalhooks01
chmod +x "config/chroot_local-hooks/01-removelocales.sh"

cat <<CHROOTLOCALHOOKS02 > config/chroot_local-hooks/02-purge-some-modules.sh
#!/bin/sh
# delete the modules we won't need (YMMMV)
rm -Rf /lib/modules/*/kernel/drivers/isdn
rm -Rf /lib/modules/*/kernel/drivers/media
rm -Rf /lib/modules/*/kernel/drivers/net/wireless
CHROOTLOCALHOOKS02
chmod +x "config/chroot_local-hooks/02-purge-some-modules.sh"


cat <<LDMCONFIG01 > config/chroot_local-hooks/03-add-ldm-to-inittab.sh
#!bin/sh
# put following line in /etc/inittab:
# LDM9:23:respawn:/etc/ldm-init
echo "LDM9:23:respawn:/etc/ldm-init" >> /etc/inittab

LDMCONFIG01
chmod +x "config/chroot_local-hooks/03-add-ldm-to-inittab.sh"

mkdir config/chroot_local-includes/etc
cat <<LDMCONFIG02 > config/chroot_local-includes/etc/ldm-init
#!bin/sh
# use this script to run LDM from inittab.

# run on tty:
tty="9"

# set ip address of your ssh server:
export LDM_SERVER=$LDM_SERVER
/usr/sbin/ldm vt$tty :$(($tty))

LDMCONFIG02
chmod +x config/chroot_local-includes/etc/ldm-init

## We could exclude some unused  stuffs.
export LH_BOOTSTRAP_EXCLUDE="vim-tiny,nano,ed"

## exclude some stuffs from the squashfs root
export MKSQUASHFS_OPTIONS=" -e boot* -e boot/* "
nice ionice -c2 lh_build  --quiet

### --debug
Document Actions