[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

getting next-generation LTSP into Debian/main



> if we built debian packages that don't have dependencies outside of
> debian, it would be even easier to make a wrapper script and custom
> configuration file that would also work more easily on debian machines.
> maybe i will work on that more, too.

i couldn't resist re-building the ltsp packages for debian, with a few
changes:

ltsp (0.43-0+vagrant.1) experimental; urgency=low

  * add /etc/default/ltsp-client-setup
    - use_bind_mounts=true
  * ltsp-build-client: bugfix configuring mkinitrd.conf

 -- Vagrant Cascadian <vagrant@freegeek.org>  Fri,  5 Aug 2005 11:33:40 -0600

ltsp (0.43-0+vagrant.0) experimental; urgency=low

  * ltsp-build-client:
    - bugfixes in sources.list generation
    - drop laptop-detect from packages to be installed by default

 -- Vagrant Cascadian <vagrant@freegeek.org>  Fri,  5 Aug 2005 10:59:21 -0600

ltsp (0.43-0+vagrant) experimental; urgency=low

  * rebuild for debian sarge
  * allow initrd-netboot-tools as alternative to initramfs-tools
  * allow ssh as alternative to openssh-client and openssh-server
  * warn about modifying /etc/exports instead of modifying directly
  * provide tmpfs+bindmount alternative to unionfs
  * ltsp-build-client:
    - commandline options to set variables
    - variable defaults for debian sarge
    - file urls for MIRROR
  * add patch to provide long descriptions (Petter Reinholdtsen)
  * suggest sdm/sdm-terminal as a lightweight alternative to ldm

 -- Vagrant Cascadian <vagrant@freegeek.org>  Fri,  5 Aug 2005 09:48:08 -0600

as you can see, i've already made a couple bugfix "releases", and i
wouldn't be surprised if i make more as i continue to test it.

packages and source available at:

deb http://llama.freegeek.org/~vagrant/debian experimental/

i made considerable changes to ltsp-build-client, making many of the
options configurable with commandline options.  also added an
--extra-archive commandline option.

so, you could install on debian sarge with:

ltsp-build-client --dist sarge --extra-archive "http://llama.freegeek.org/~vagrant/debian experimental/"

or if you've got a CDROM with all the appropriate packages:

ltsp-build-client --dist sarge --mirror "file:///media/cdrom" --extra-archive "http://llama.freegeek.org/~vagrant/debian experimental/"

or to specify additional components beyond main:

ltsp-build-client --dist sarge --mirror "file:///media/cdrom sarge main local" --extra-archive "http://llama.freegeek.org/~vagrant/debian experimental/"

i would have to make tweaks to get the ltsp-install wrapper script (to
use lessdisks-install) working, but it wouldn't take much.  instead i
figured i'd just improve the ltsp-build-client script.

since the postinstall script doesn't modify /etc/exports anymore(due to
debian policy), you have to do that manually.  could instead make it an
option to ltsp-build-client.

attached is a patch (really) containing the differences between ubuntu's
ltsp 0.43 and the version i built.

live well,
  vagrant
* looking for matt.zimmerman@canonical.com/ltsp--main--0--patch-131 to compare with
* comparing to matt.zimmerman@canonical.com/ltsp--main--0--patch-131
................

* modified files

--- orig/debian/changelog
+++ mod/debian/changelog
@@ -1,3 +1,35 @@
+ltsp (0.43-0+vagrant.1) experimental; urgency=low
+
+  * add /etc/default/ltsp-client-setup
+    - use_bind_mounts=true
+  * ltsp-build-client: bugfix configuring mkinitrd.conf
+
+ -- Vagrant Cascadian <vagrant@freegeek.org>  Fri,  5 Aug 2005 11:33:40 -0600
+
+ltsp (0.43-0+vagrant.0) experimental; urgency=low
+
+  * ltsp-build-client: 
+    - bugfixes in sources.list generation
+    - drop laptop-detect from packages to be installed by default
+    
+ -- Vagrant Cascadian <vagrant@freegeek.org>  Fri,  5 Aug 2005 10:59:21 -0600
+
+ltsp (0.43-0+vagrant) experimental; urgency=low
+
+  * rebuild for debian sarge
+  * allow initrd-netboot-tools as alternative to initramfs-tools 
+  * allow ssh as alternative to openssh-client and openssh-server
+  * warn about modifying /etc/exports instead of modifying directly
+  * provide tmpfs+bindmount alternative to unionfs
+  * ltsp-build-client:
+    - commandline options to set variables
+    - variable defaults for debian sarge
+    - file urls for MIRROR
+  * add patch to provide long descriptions (Petter Reinholdtsen)
+  * suggest sdm/sdm-terminal as a lightweight alternative to ldm
+
+ -- Vagrant Cascadian <vagrant@freegeek.org>  Fri,  5 Aug 2005 09:48:08 -0600
+
 ltsp (0.43) breezy; urgency=low
 
   * Start the X server with the -br option


--- orig/debian/control
+++ mod/debian/control
@@ -7,20 +7,27 @@
 
 Package: ltsp-server
 Depends: debootstrap, nfs-kernel-server, tftpd-hpa, syslinux
-Recommends: openssh-server
-Suggests: dhcp3-server
+Recommends: openssh-server | ssh
+Suggests: dhcp3-server, sdm
 Architecture: all
 Description: Basic LTSP server environment
+ The scripts needed to generate the client environment on a server.
+ This is the basic environment depending on external a DHCP server to
+ point the clients to the LTSP server.
 
 Package: ltsp-server-standalone
 Depends: ltsp-server, ltsp-utils, dhcp3-server
 Architecture: all
 Description: Complete LTSP server environment
+ The scripts needed to generate the client environment on a server.
+ This is the complete environment including a DHCP server to bootstrap
+ the clients.
  
 Package: ltsp-client
-Depends: lsb-base, nbd-client, openssh-client, python-gtk2, python-glade2, initramfs-tools (>= 0.11)
-Recommends: ubuntu-thin-client
+Depends: lsb-base, nbd-client, openssh-client | ssh, python-gtk2, python-glade2, python, initramfs-tools (>= 0.11) | initrd-netboot-tools
+Suggests: kernel-image-netbootable, sdm-terminal
 Conflicts: ltsp-utils
 Replaces: ltsp-utils
 Architecture: any
 Description: LTSP client environment
+ The scripts needed to configure and boot an LTSP client.


--- orig/debian/copyright
+++ mod/debian/copyright
@@ -1,6 +1,9 @@
 This package was created by Matt Zimmerman <mdz@ubuntu.com> in May of
 2005.
 
+modifications for use with debian by Vagrant Cascadian <vagrant@freegeek.org>
+in August of 2005.
+
 Several components have been copied from the LTSP project's build
 environment (LBE) tree, and are copyrighted by Jim McQuillan
 <jam@ltsp.org>, and licensed under the GPL version 2.
@@ -24,5 +27,5 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-On Ubuntu systems, a copy of the GNU General Public License version 2
-may be found in the file /usr/share/common-licenses/GPL-2.
+On Ubuntu and Debian systems, a copy of the GNU General Public License version
+2 may be found in the file /usr/share/common-licenses/GPL-2.


--- orig/debian/ltsp-client.install
+++ mod/debian/ltsp-client.install
@@ -12,3 +12,4 @@
 client/initramfs/init-bottom/unionfs_cow usr/share/initramfs-tools/scripts/init-bottom
 client/initramfs/modules.d/unionfs_cow usr/share/initramfs-tools/modules.d
 client/lp_server/src/lp_server usr/lib/ltsp
+client/ltsp-client-setup etc/default


--- orig/debian/ltsp-client.ltsp-client-setup.init
+++ mod/debian/ltsp-client.ltsp-client-setup.init
@@ -18,6 +18,7 @@
 . /lib/lsb/init-functions
 . /usr/lib/ltsp/ltsp_functions
 . /usr/lib/ltsp/ltsp_config
+test -f /etc/default/ltsp-client-setup && . /etc/default/ltsp-client-setup
 
 load_modules() {
     for module in $(env | awk -F= '$1 ~ /^MODULE_/ { print $2 }'); do
@@ -113,10 +114,51 @@
     fi
 }
 
+bind_mounts () {
+  # set defaults
+  test -z "$tmpfs_dir" && tmpfs_dir=/var/state/ltsp
+  test -z "$rw_dirs" && rw_dirs="/var/cache/man /var/lib/xkb /var/lock /var/run /var/log /var/spool /var/tmp /tmp /var/lib/discover"
+  test -z "$copy_dirs" && copy_dirs=""
+  test -z "$bindfiles" && bindfiles="/etc/X11/xorg.conf /etc/X11/XF86Config-4"
+  mount -t tmpfs -o mode=0755 tmpfs $tmpfs_dir
+  # preserve directory structure
+  for d in $rw_dirs ; do
+    if [ -d "$d" ]; then
+      cd $tmpfs_dir
+      tar --no-recursion -cpf - $(find $d -type d 2> /dev/null) 2> /dev/null | tar xpf -
+      mount --bind $tmpfs_dir/$d $d
+    else
+      echo "WARNING: $d does not exist"
+    fi
+  done  
+  # copy contents into tmpfs
+  for d in $copy_dirs ; do
+    if [ -d "$d" ]; then
+      cd $tmpfs_dir
+      tar -cpf - $d 2> /dev/null | tar xpf -
+      mount --bind $tmpfs_dir/$d $d
+    else
+      echo "WARNING: $d does not exist"
+    fi
+  done
+  # mount one file on top of another
+  for f in $bindfiles ; do
+    if [ -e "$f" ]; then
+      mkdir -p "$(dirname $tmpfs_dir/$f)"
+      cp $f $tmpfs_dir/$f
+      mount --bind $tmpfs_dir/$f $f
+    else
+      echo "WARNING: $f does not exist"
+    fi
+  done
+}
+
 case "$1" in
   start)
         log_begin_msg "Setting up LTSP client..."
-
+        if [ "true" = "$use_bind_mounts" ]; then
+          bind_mounts
+        fi
         load_modules
         configure_console
         configure_swap


--- orig/debian/ltsp-server.postinst
+++ mod/debian/ltsp-server.postinst
@@ -14,11 +14,10 @@
 case "$1" in
     configure)
         if ! grep -q '^/opt/ltsp' /etc/exports; then
-            cat <<EOF >> /etc/exports
-# Automatically added by ltsp-server
-/opt/ltsp       *(ro,no_root_squash,async)
-EOF
-            invoke-rc.d nfs-kernel-server reload
+echo 'NOTE: you will probably want to add to /etc/exports:'
+echo '/opt/ltsp       *(ro,no_root_squash,async)'
+echo 'and then run:'
+echo 'invoke-rc.d nfs-kernel-server reload'
         fi
         ;;
 


--- orig/debian/ltsp-server.postrm
+++ mod/debian/ltsp-server.postrm
@@ -18,9 +18,9 @@
 
 case "$1" in
     remove)
-        if grep -q '^# Automatically added by ltsp-server' /etc/exports; then
-            sed -i -e '/^# Automatically added by ltsp-server/,+1d' /etc/exports
-        fi
+        #if grep -q '^# Automatically added by ltsp-server' /etc/exports; then
+        #    sed -i -e '/^# Automatically added by ltsp-server/,+1d' /etc/exports
+        #fi
         ;;
     upgrade|failed-upgrade|abort-install|abort-upgrade|disappear|purge)
         ;;


--- orig/server/ltsp-build-client
+++ mod/server/ltsp-build-client
@@ -5,12 +5,60 @@
 LC_ALL=C
 export LC_ALL
 
-ROOT=/opt/ltsp/$(dpkg --print-architecture)
-DIST=breezy
-MIRROR=http://us.archive.ubuntu.com/ubuntu
+# TODO: source configuration file
+
+# process commandline arguments
+while [ -n "$1" ]; do
+  case $1 in
+    --root) ROOT="$2" 
+      test -n "$1" && shift
+      ;;
+    --dist) DIST="$2" 
+      test -n "$1" && shift
+      ;;
+    --components) COMPONENTS="$2"
+      test -n "$1" && shift
+      ;;
+    --mirror) MIRROR="$2"
+      test -n "$1" && shift
+      ;;
+    --extra-mirror) EXTRA_MIRROR="$2"
+      test -n "$1" && shift
+      ;;
+    --early-packages) EARLY_PACKAGES="$2" 
+      test -n "$1" && shift
+      ;;
+    --late-packages) LATE_PACKAGES="$2" 
+      test -n "$1" && shift
+      ;;
+  esac
+  test -n "$1" && shift
+done
+
+# set defaults
+test -z "$ROOT" && ROOT=/opt/ltsp/$(dpkg --print-architecture)
+test -z "$DIST" && DIST=sarge
+case $DIST in
+  breezy) 
+    test -z "$COMPONENTS" && COMPONENTS="main restricted"
+    test -z "$MIRROR" && MIRROR="http://us.archive.ubuntu.com/ubuntu $DIST $COMPONENTS"
+    test -z "$EARLY_PACKAGES" && EARLY_PACKAGES="x-window-system-core ltsp-client discover1 laptop-detect mdetect xresprobe"
+    test -z "$LATE_PACKAGES" && LATE_PACKAGES="linux"
+    ;;
+esac
+test -z "$COMPONENTS" && COMPONENTS="main"
+test -z "$MIRROR" && MIRROR="http://http.us.debian.org/debian $DIST $COMPONENTS"
+test -z "$EARLY_PACKAGES" && EARLY_PACKAGES="x-window-system-core ltsp-client discover1 mdetect xresprobe"
+test -z "$LATE_PACKAGES" && LATE_PACKAGES="kernel-image-netbootable"
+
+if [ -z "$(echo $MIRROR | awk '{print $2}')" ]; then
+  echo "NOTE: adding default dist and components to mirror:"
+  MIRROR="$MIRROR $DIST $COMPONENTS"
+  echo "$MIRROR"
+fi
 
 # Install base packages
-debootstrap $DIST $ROOT $MIRROR
+debootstrap $DIST $ROOT $(echo $MIRROR | awk '{print $1}')
 
 # Root password is empty by default, lock it
 chroot $ROOT passwd -l root
@@ -18,9 +66,15 @@
 # Always load mousedev
 echo mousedev >> $ROOT/etc/modules
 
-cat <<EOF > $ROOT/etc/apt/sources.list
-deb $MIRROR $DIST main restricted
-EOF
+test -f $ROOT/etc/apt/sources.list && mv -vf $ROOT/etc/apt/sources.list $ROOT/etc/apt/sources.list.old
+for mirror in "$MIRROR" "$EXTRA_MIRROR" ; do
+  echo "deb $mirror" >> $ROOT/etc/apt/sources.list
+  case $mirror in
+    file:///*) dir="$(echo $mirror | awk '{print $1}' | sed -e 's,^file://,,g')"      mkdir -p $ROOT/$dir
+      mount --bind $dir $ROOT/$dir
+      umounts="$umounts $ROOT/$dir"
+  esac  
+done
 
 chroot $ROOT apt-get update
 
@@ -28,7 +82,7 @@
 export DEBIAN_FRONTEND
 
 # Install remaining packages
-chroot $ROOT apt-get -y install x-window-system-core ltsp-client discover1 laptop-detect mdetect xresprobe
+chroot $ROOT apt-get -y install $EARLY_PACKAGES
 
 # Setup for kernel install
 cat <<EOF > $ROOT/etc/kernel-img.conf
@@ -37,13 +91,19 @@
 relative_links = yes
 link_in_boot = yes
 do_bootloader = no
-ramdisk=/usr/sbin/mkinitramfs
 EOF
 
-sed -i -e 's/^BOOT=.*$/BOOT=nfs/' $ROOT/etc/mkinitramfs/initramfs.conf
+if [ -f $ROOT/etc/mkinitramfs/initramfs.conf ]; then
+  # configuring for initramfs-tools
+  echo "ramdisk=/usr/sbin/mkinitramfs" >> $ROOT/etc/kernel-img.conf
+  sed -i -e 's/^BOOT=.*$/BOOT=nfs/' $ROOT/etc/mkinitramfs/initramfs.conf 
+elif [ -f $ROOT/etc/mkinitrd/mkinitrd.conf ]; then
+  # configuring for initrd-netboot-tools
+  sed -i -e 's/^ROOT=.*$/ROOT=""/' -e 's/^MODULES=.*$/MODULES=none/' $ROOT/etc/mkinitrd/mkinitrd.conf 
+fi
 
-# Install the kernel
-chroot $ROOT apt-get -y install linux
+# Install additional packages, such as the the kernel
+chroot $ROOT apt-get -y install $LATE_PACKAGES
 
 ltsp-update-kernels
 ltsp-update-sshkeys
@@ -51,3 +111,8 @@
 rm -f $ROOT/etc/hostname
 
 chroot $ROOT apt-get clean
+
+# umount bind mounts
+for dir in $umounts ; do
+  umount $dir
+done



* added files

--- /dev/null
+++ mod/client/.arch-ids/ltsp-client-setup.id
@@ -0,0 +1 @@
+Vagrant Cascadian <vagrant@freegeek.org> Fri Aug  5 11:41:16 2005 734.0
--- /dev/null
+++ mod/client/ltsp-client-setup
@@ -0,0 +1,4 @@
+# /etc/default/ltsp-client-setup
+
+# use tmpfs + bind mounts for writeable filesystems
+use_bind_mounts="true"
--- /dev/null
+++ mod/client/screen.d/.arch-ids/sdm.id
@@ -0,0 +1 @@
+Vagrant Cascadian <vagrant@freegeek.org> Fri Aug  5 10:22:31 2005 24344.2
--- /dev/null
+++ mod/client/screen.d/sdm
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec /usr/sbin/sdm
--- /dev/null
+++ mod/debian/.arch-ids/TODO.Debian.id
@@ -0,0 +1 @@
+Vagrant Cascadian <vagrant@freegeek.org> Fri Aug  5 10:22:31 2005 24344.1
--- /dev/null
+++ mod/debian/.arch-ids/ltsp-client.dirs.id
@@ -0,0 +1 @@
+Vagrant Cascadian <vagrant@freegeek.org> Fri Aug  5 10:22:31 2005 24344.0
--- /dev/null
+++ mod/debian/TODO.Debian
@@ -0,0 +1,3 @@
+support for sdm as a lightweight alternative to "ldm"
+
+separate packages for lp_server and ldm (others?)
--- /dev/null
+++ mod/debian/ltsp-client.dirs
@@ -0,0 +1 @@
+/var/state/ltsp

Attachment: signature.asc
Description: Digital signature


Reply to: