[pisa-src] r2493 - trunk/tools/live-cds/ubuntu_live

  • From: Samuel Richter <samuel.richter@xxxxxxxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Sun, 03 Apr 2011 18:54:08 +0200

Author: richter
Date: Sun Apr  3 18:54:08 2011
New Revision: 2493

Log:
add ability to patch the live-cd and fix live-cd creation script

now you can give a folder with patches to the ubuntu_live script.
these patches are applied just before the final initrd is generated.

all input directories are now transformed to absolute paths

fix operator precedence in some conditionals

shell coding guidelines will be applied in the next commit

Modified:
   trunk/tools/live-cds/ubuntu_live

Modified: trunk/tools/live-cds/ubuntu_live
==============================================================================
--- trunk/tools/live-cds/ubuntu_live    Sun Apr  3 18:40:32 2011        (r2492)
+++ trunk/tools/live-cds/ubuntu_live    Sun Apr  3 18:54:08 2011        (r2493)
@@ -17,6 +17,7 @@
     echo "  -c, --change OLDISO: change an existing live-cd"
     echo "  --isolinux ISOLINUX_CFG: use isolinux with supplied config"
     echo "  --diskdefines DISKDEFINES: optional ubuntu file"
+    echo "  --patches PATCHES_PATH: directory with patches to be applied"
     echo "  -h, --help: show this help"
 }
 
@@ -25,6 +26,10 @@
     chroot $CHROOT bash -c "export HOME=/root; export LC_ALL=C; $*"
 }
 
+sanitize_path(){
+    (cd $1; pwd)
+}
+
 #defaults
 BUILD_PATH=$(pwd)
 ISO=$(pwd)/ubuntu-remix.iso
@@ -45,7 +50,7 @@
 
         -f|--files) FILES=$2; shift 2;;
 
-        -b|--build-path) BUILD_PATH=$2; shift 2;;
+        -b|--build-path) BUILD_PATH=$(sanitize_path $2); shift 2;;
 
         -c|--change) OLDISO=$2; shift 2;;
 
@@ -53,6 +58,8 @@
 
         --diskdefines) DISKDEFINES=$2; shift 2;;
 
+        --patches) PATCHES=$(sanitize_path $2); shift 2;;
+
         -h|--help) usage; exit;;
     esac
 done
@@ -63,9 +70,9 @@
 mkdir -p $CHROOT
 trap "rm -rf $IMAGE_PATH $CHROOT; exit" 0 1 2 15 # SIGHUP SIGINT SIGTERM
 
-[ $INSTALL_LIST ] || [ -f $BUILD_PATH/pkg_list ] && 
INSTALL_LIST=$BUILD_PATH/pkg_list
-[ $ISOLINUX_CFG ] || [ -f $BUILD_PATH/isolinux.cfg ] || 
ISOLINUX_CFG=$BUILD_PATH/isolinux.cfg
-[ $DISKDEFINES ] || [ -f $BUILD_PATH/README.diskdefines ] || 
DISKDEFINES=$BUILD_PATH/README.diskdefines
+[ -z "$INSTALL_LIST" ] && [ -f "$BUILD_PATH/pkg_list" ] && 
INSTALL_LIST="$BUILD_PATH/pkg_list"
+[ -z "$ISOLINUX_CFG" ] && [ -f "$BUILD_PATH/isolinux.cfg" ] && 
"ISOLINUX_CFG=$BUILD_PATH/isolinux.cfg"
+[ -z "$DISKDEFINES" ] && [ -f $BUILD_PATH/README.diskdefines ] && 
DISKDEFINES=$BUILD_PATH/README.diskdefines
 
 IMAGE_NAME="PisaLive"
 DATE=$(date +%Y%m%d)
@@ -120,6 +127,11 @@
 [ -f $BUILD_PATH/files.tar.gz ] && tar -xzf $BUILD_PATH/files.tar.gz -C $CHROOT
 [ $FILES ] && tar -xzf $FILES -C $CHROOT
 
+for PATCH in "$PATCHES"/*
+do
+    patch --batch --input=$PATCH --strip=1 --directory=$CHROOT
+done
+
 # remake initramfs (needed cause casper settings may change)
 chroot_run update-initramfs -u
 
-- 
This is the pisa developer mailing list. Please also subscribe to the main pisa 
list at:
//www.freelists.org/list/pisa

Other related posts:

  • » [pisa-src] r2493 - trunk/tools/live-cds/ubuntu_live - Samuel Richter