[DebianGIS-dev] r1237 - packages/debian-gis

nd-guest at alioth.debian.org nd-guest at alioth.debian.org
Mon Oct 22 14:41:00 UTC 2007


Author: nd-guest
Date: 2007-10-22 14:41:00 +0000 (Mon, 22 Oct 2007)
New Revision: 1237

Modified:
   packages/debian-gis/build-gis-live
Log:
Building livecd works again. Tested with 1.0~31-1.
Execute hooks in hooks/ inside the chroot
Install packagelists in packages/ inside chroot
Copy files in files/ inside the chroot.


Modified: packages/debian-gis/build-gis-live
===================================================================
--- packages/debian-gis/build-gis-live	2007-10-20 17:08:08 UTC (rev 1236)
+++ packages/debian-gis/build-gis-live	2007-10-22 14:41:00 UTC (rev 1237)
@@ -1,7 +1,8 @@
 #!/bin/sh
 #
 # (c) 2006, 2007	Holger Levsen <debian at layer-acht.org>
-# (c) 2007 		Petter Reinholdtsen <pere at hungry.com>
+# (c) 2007 		    Petter Reinholdtsen <pere at hungry.com>
+# (c) 2007          Andreas Putzo <andreas at putzo.net>
 #
 # Licended under GPL2
 #
@@ -10,110 +11,104 @@
 #
 # Build depends: live-helper tasksel
 #
-# Tested using live-helper version 1.0a19-1.0.edu.etch.1
+# Tested using live-helper version 1.0~a31-1
 #
 ##############################################################################
 
 # Exit on errors
 set -e
 
+# Config options. See also lh_config call below.
+verbose=1
+build_dir=build
+publish_dir=$(pwd)/pub
+logfile=`mktemp`
+today="`date +%Y%m%d%H%M`"
+lockfile="/var/lock/gislive-build"
+mirror=http://ftp.de.debian.org/debian
+dist=lenny
+# package (-lists) to install
+package_list_dir=$(pwd)/packages
+# scripts to execute in the chroot
+hook_dir=$(pwd)/hooks
+# Files to copy into the chroot to /
+misc_files_dir=$(pwd)/files
+publisher="Debian GIS Project"
+live_username="gis"
+live_hostname="Debian-GIS"
 # CD boot image
-#SPLASHPNG=foo.png
+#splashpng=foo.png
 
-# Update scripts from svn during the build?
-UPDATESVN=false
 
-# Where to fetch the base system
-mirror=http://ftp.se.debian.org/debian/
-
-# Some steps need to run as root. Use sudo unless already root
-if [ root != "$(whoami)" ] ; then
-    SUDO=sudo
-fi
-
-BUILD_DIR="$(dirname $0)"
-
+# helper functions
 msg_info() {
-  #echo info: $@
-  :
+  echo info: $@
 }
 
 msg_error() {
   echo error: $@
 }
 
-if cd $BUILD_DIR ; then
-	:
-else
-	msg_error "$BUILD_DIR doesn't exist, aborting."
-	echo
-	echo "svn co svn://svn.debian.org/svn/pkg-grass/packages/debian-gis"
-	exit 1
-fi
+at_exit() {
+    rm $lockfile
+    if [ -f $logfile ] ; then
+    	cp $logfile $publish_dir/gislive-${today}.log
+	    chmod 644 $publish_dir/gislive-${today}.log
+    	rm $logfile
+    fi
+    cd -
+}
 
-PUBLISH_DIR=~ftp/pub/debian-gis/live/
-#PUBLISH_DIR=$(pwd)/../debian-gis-live
-LOCKFILE="/var/lock/gislive-build"
-LOGFILE=`mktemp`
-TODAY="`date +%Y%m%d%H%M`"
+####
+trap at_exit EXIT
+if [ "$verbose" ]; then
+    tail -f $logfile &
+fi    
 
-if [ ! -d $PUBLISH_DIR ] ; then
-    msg_error "$PUBLISH_DIR does not exist, aborting."
-    exit 1
+# Some steps need to run as root. Use sudo unless already root
+if [ root != "$(whoami)" ] ; then
+    SUDO=sudo
 fi
 
-#
 # check lockfile
-#
-if [ -f "$LOCKFILE" ] ; then
-	echo $LOCKFILE exists, aborting
+if [ -f "$lockfile" ] ; then
+	echo $lockfile exists, aborting
 	exit 1
 fi
-at_exit() {
-    rm $LOCKFILE
-    if [ -f $LOGFILE ] ; then
-	cp $LOGFILE $PUBLISH_DIR/gislive-${TODAY}.log
-	chmod 644 $PUBLISH_DIR/gislive-${TODAY}.log
-	rm $LOGFILE
-    fi
-}
-trap at_exit EXIT
-touch $LOCKFILE
+$SUDO echo $$ > $lockfile
 
-#
-# prepare
-#
-if [ true = "UPDATESVN" ] ; then
-    # display diffs from current local version to version in repository
-    svn diff --revision HEAD
-
-    # update to version in repository
-    svn up -q
+# check publishdir
+if [ ! -d "$publish_dir" ] ; then
+    msg_error "$publish_dir does not exist, aborting."
+    exit 1
 fi
 
-# cleanup
-if [ -d debian-live ] ; then
-    if $SUDO /bin/rm -rf $BUILD_DIR/debian-live > /dev/null ; then
-	msg_info "removed old build directory"
-    else
-	msg_error "problems removing old build"
-	exit 1
-    fi
+# cleanup from previous builds
+[ -d "$build_dir" ] || mkdir -p $build_dir
+cd $build_dir
+if lh_clean all; then
+    msg_info cleaning old build dir succeeded
+    rm -rf config
+else
+    msg_error generating configuration failed
+    exit 1
 fi
 
-# Installing 'etch' to make this buildable with debootstrap from etch,
-# but adding a lenny archive below to get the packages from lenny.
-if /usr/bin/make-live config \
-    --initramfs live-initramfs \
+# configure live-helper
+export LH_BOOTAPPEND_LIVE="quiet splash"
+if /usr/bin/lh_config \
     --bootappend "quiet splash" \
     --keyring-packages debian-archive-keyring \
-    --mirror-bootstrap $mirror \
-    --distribution etch \
+    --mirror-bootstrap "$mirror" \
+    --distribution "$dist" \
     --sections "main" \
-    --packages-lists packages-live \
     --apt-recommends disabled \
-    --hooks /root/post-install-hook
-#    --packages early-package
+    --union-filesystem aufs \
+    --linux-packages 'linux-image-2.6 aufs-modules-2.6 squashfs-modules-2.6' \
+    --iso-publisher "$publisher" \
+    --username "$live_username" \
+    --hostname "$live_hostname" \
+    --verbose
 then
   msg_info generating configuration succeeded
 else
@@ -121,103 +116,78 @@
   exit 1
 fi
 
-# Generate host-install hook script
-mkdir -p debian-live/chroot/root
-cat <<EOF > debian-live/chroot/root/post-install-hook
-#!/bin/sh
-# Script executed in the build chroot after the packages are installed.
+# copy hooks
+if [ -d "$hook_dir" ]; then
+    for hook in $(ls "$hook_dir"); do
+        cp $hook_dir/$hook config/chroot_local-hooks
+    done
+fi
 
-aptitude dist-upgrade -y
-EOF
-chmod a+rx debian-live/chroot/root/post-install-hook
+# copy package lists
+if [ -d "$package_list_dir" ]; then
+    for list in $(ls "$package_list_dir"); do
+        cp $package_list_dir/$list config/chroot_local-packageslists
+        echo cp $package_list_dir/$list config/chroot_local-packageslists
+    done
+fi
 
-# Make the package list available
-(
-    # Enable this to get a complete desktop
-    if false ; then
-	tasksel --task-packages kde-desktop
-	tasksel --task-packages desktop
-	tasksel --task-packages laptop
-    else # A minimum desktop
-	cat <<EOF
-# Boot progress bar
-usplash
-usplash-theme-debian
-# Get the graphical environment
-xorg
-xserver-xorg
-# and a desktop with menues
-kde-core
-menu
-menu-xdg
-kdm
-# Get some development tools
-cvs
-cvsutils
-cvs2cl
-subversion
-subversion-tools
-bzr
-bzrtools
-less
-# Include tool to make it easier to trim the live CD
-deborphan
-EOF
-    fi
-    cat packages-live 
-# When the task is available, we can do like this:
-#    tasksel --task-packages gis-workstation
-) | grep -v '#' > debian-live/config/chroot_local-packageslists/packages-live
+# copy misc files 
+if [ -d "$misc_files_dir" ]; then
+    for file in $(ls "$misc_files_dir"); do
+        # copy recursive by default
+        cp -v -r $misc_files_dir/$file config/chroot_local-includes
+    done
+fi
 
-# Add an extra repository to use during package installation
-for file in live.bootstrap live.binary ; do
-    echo deb ftp://ftp.no.debian.org/debian/ lenny main contrib \
-	>> debian-live/config/chroot_sources/$file
-done
 
+# prepare chroot
+if $SUDO /usr/bin/lh_bootstrap >> $logfile 2>&1; then
+    msg_info "bootstrap succeeded."
+else
+    msg_error "bootstrap failed."
+    exit 1
+fi
+
+if $SUDO /usr/bin/lh_chroot >> $logfile 2>&1; then
+    msg_info "creating chroot succeeded."
+else
+    msg_error "creating chroot failed."
+    exit 1
+fi    
+
 # Generate RLE from a splash image PNG
 # Color index 0 is background, and index 7 is foreground.  Set to
 # black and white respecively
-if [ -f "$SPLASHPNG" ] ; then
-    mkdir -p debian-live/config/binary_syslinux
-    pngtopnm < $SPLASHPNG | ppmquant 16 2>/dev/null | \
+if [ -f "$splashpng" ] ; then
+    pngtopnm < $splashpng | ppmquant 16 2>/dev/null | \
 	ppmtolss16 "#ffffff=7" "#000000=0"  2>/dev/null \
-	> debian-live/config/binary_syslinux/splash.rle
+	> config/binary_syslinux/splash.rle
 fi
 
-#
-# build
-#
-if $SUDO /usr/bin/make-live > $LOGFILE 2>&1 < /dev/null; then
+# call lh_binary to build the iso image and publish the result
+if $SUDO /usr/bin/lh_binary >> $logfile 2>&1; then
   msg_info "build succeeded."
 else
   msg_error "build failed."
   exit 1
 fi
-
-#
-# publish
-# 
-if [ -f debian-live/binary.iso ] ; then
-  mv debian-live/binary.iso $PUBLISH_DIR/gislive-${TODAY}.iso
-  md5sum $PUBLISH_DIR/gislive-${TODAY}.iso > $PUBLISH_DIR/gislive-${TODAY}.md5sum
-  msg_info successfully build live-cd, download at http://ftp.skolelinux.org/pub/debian-gis/live/gislive-${TODAY}.iso
+if [ -f binary.iso ] ; then
+  mv binary.iso $publish_dir/gislive-${today}.iso
+  md5sum $publish_dir/gislive-${today}.iso > $publish_dir/gislive-${today}.md5sum
+  msg_info successfully build live-cd.
 else 
   echo "#########################################################"
   echo 
   echo "An error occured, .iso was not created :-("
   echo 
-  echo "30 last lines of the make-live output:"
-  echo
-  tail -30 $LOGFILE
+  if [ ! "$verbose" ]; then
+      echo "30 last lines of the make-live output:"
+      echo
+      tail -30 $logfile
+  fi          
 fi 
 
-#
 # cleanup old images and logs
-#
-cd $PUBLISH_DIR
-find . -mtime +1 !  -name "gislive-*00.???" -exec rm {} \;
-find . -mtime +2 !  -name "gislive-1600.???" -exec rm {} \;
-find . -mtime +14 ! -name "gislive-0400.???" -exec rm {} \;
-
-# The lockfile is removed by the at_exit function
+find $publish_dir -mtime +1 !  -name "gislive-*00.???" -exec rm {} \;
+find $publish_dir -mtime +2 !  -name "gislive-1600.???" -exec rm {} \;
+find $publish_dir -mtime +14 ! -name "gislive-0400.???" -exec rm {} \;




More information about the Pkg-grass-devel mailing list