From d637d73430222e8f9aa5969fe87409d6bdca7516 Mon Sep 17 00:00:00 2001
From: Christopher Spinrath <christopher.spinrath@rwth-aachen.de>
Date: Sun, 7 Apr 2013 14:14:49 +0200
Subject: [PATCH] Added support for isofs patches

Moved patch_all function to customize_common which is sourced by all customize* scripts
Moved /etc/apt/sources.list content from the customize script to lip_sources.list
Added ubiquity-keep-installed patch
---
 .../customize-lip-testing/customize           | 79 +++----------------
 .../customize-lip-testing/customize_common    | 24 ++++++
 .../customize-lip-testing/customize_initrd    | 52 ++++++++++++
 .../customize-lip-testing/customize_iso       | 11 +++
 .../iso-patches/ubiquity-keep-installed.patch |  9 +++
 .../customize-lip-testing/lip_sources.list    | 54 +++++++++++++
 6 files changed, 160 insertions(+), 69 deletions(-)
 mode change 100644 => 100755 Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize
 create mode 100755 Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize_common
 create mode 100755 Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize_initrd
 create mode 100755 Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize_iso
 create mode 100644 Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/iso-patches/ubiquity-keep-installed.patch
 create mode 100644 Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/lip_sources.list

diff --git a/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize b/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize
old mode 100644
new mode 100755
index 3b9e6c1..cc85ed6
--- a/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize
+++ b/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize
@@ -3,63 +3,16 @@
 #is this true for all uck versions??
 SCRIPT_DIR=`dirname "$0"`
 
+#source common functions (e.g. patch_all)
+if [ -e "$SCRIPT_DIR/customize_common" ]
+	source "$SCRIPT_DIR/customize_common"
+fi
+
 function prepare_install()
 {
-	echo "# deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release i386 (20120423)]/ precise main restricted
-
-# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
-# newer versions of the distribution.
-deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise main restricted
-deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise main restricted
-
-## Major bug fix updates produced after the final release of the
-## distribution.
-deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-updates main restricted
-deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-updates main restricted
-
-## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
-## team. Also, please note that software in universe WILL NOT receive any
-## review or updates from the Ubuntu security team.
-deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise universe
-deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise universe
-deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-updates universe
-deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-updates universe
-
-## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
-## team, and may not be under a free licence. Please satisfy yourself as to 
-## your rights to use the software. Also, please note that software in 
-## multiverse WILL NOT receive any review or updates from the Ubuntu
-## security team.
-deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise multiverse
-deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise multiverse
-deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-updates multiverse
-deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-updates multiverse
-
-## N.B. software from this repository may not have been tested as
-## extensively as that contained in the main release, although it includes
-## newer versions of some applications which may provide useful features.
-## Also, please note that software in backports WILL NOT receive any review
-## or updates from the Ubuntu security team.
-
-deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-security main restricted
-deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-security main restricted
-deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-security universe
-deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-security universe
-deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-security multiverse
-deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-security multiverse
-
-## Uncomment the following two lines to add software from Canonical's
-## 'partner' repository.
-## This software is not part of Ubuntu, but is offered by Canonical and the
-## respective vendors as a service to Ubuntu users.
-# deb http://archive.canonical.com/ubuntu precise partner
-# deb-src http://archive.canonical.com/ubuntu precise partner
-
-## This software is not part of Ubuntu, but is offered by third-party
-## developers who want to ship their latest software.
-deb http://extras.ubuntu.com/ubuntu precise main
-deb-src http://extras.ubuntu.com/ubuntu precise main
-" > /etc/apt/sources.list
+	if [ -e "$SCRIPT_DIR/lip_sources.list" ]; then
+		cp -v "$SCRIPT_DIR/lip_sources.list" "/etc/apt/sources.list"
+	fi
 
 	echo "# offline repository of the linux install party
 deb [ trusted=yes ] file:/cdrom/archives precise lip" > /etc/apt/sources.list.d/lipoffline.list
@@ -99,19 +52,6 @@ function install_packages()
 
 }
 
-function rootfs_patches()
-{
-	if [ -d "$SCRIPT_DIR/rootfs-patches/" ]
-	then
-		echo "Patching rootfs..."
-		for p in "$SCRIPT_DIR/rootfs-patches/"*
-		do
-			cat "$p" | patch -d "/" -p1
-		done
-		echo "done."
-	fi
-}
-
 function finalize()
 {
 	echo -n "Europe/Berlin" > /etc/timezone
@@ -124,5 +64,6 @@ install_packages
 
 cp "$SCRIPT_DIR/no-bootloader-icon/ubiquity-gtkui-no-bootloader.desktop" /usr/share/applications/
 
-rootfs_patches
+#patch rootfs
+patch_all "$SCRIPT_DIR/rootfs-patches/" "/"
 finalize
diff --git a/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize_common b/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize_common
new file mode 100755
index 0000000..288a769
--- /dev/null
+++ b/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize_common
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+function patch_all()
+{
+	PATCH_DIR="$1"
+	TARGET_DIR="$2"
+
+	if [ ! -d "$PATCH_DIR" ]; then
+		echo "Nothing to patch here!"
+		return 0
+	fi
+	
+	if [ -z "$TARGET_DIR" ]; then
+		echo "No target directory given, assuming /"
+		TARGET_DIR="/"
+	fi
+
+        echo "Patching $TARGET_DIR ..."
+        for p in "$PATCH_DIR/"*
+        do
+                cat "$p" | patch -d "$TARGET_DIR" -p1
+        done
+        echo "done."
+}
diff --git a/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize_initrd b/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize_initrd
new file mode 100755
index 0000000..92eb0ad
--- /dev/null
+++ b/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize_initrd
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+###################################################################################
+# UCK - Ubuntu Customization Kit                                                  #
+# Copyright (C) 2006-2010 UCK Team                                                #
+#                                                                                 #
+# UCK is free software: you can redistribute it and/or modify                     #
+# it under the terms of the GNU General Public License as published by            #
+# the Free Software Foundation, either version 3 of the License, or               #
+# (at your option) any later version.                                             #
+#                                                                                 #
+# UCK is distributed in the hope that it will be useful,                          #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of                  #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                   #
+# GNU General Public License for more details.                                    #
+#                                                                                 #
+# You should have received a copy of the GNU General Public License               #
+# along with UCK.  If not, see <http://www.gnu.org/licenses/>.                    #
+###################################################################################
+
+REMASTER_HOME=$1
+REMASTER_DIR="$REMASTER_HOME/remaster-root"
+INITRD_REMASTER_DIR="$REMASTER_HOME/remaster-initrd"
+
+echo "Using REMASTER_DIR=$REMASTER_DIR, INITRD_REMASTER_DIR=$INITRD_REMASTER_DIR"
+
+IRD="$INITRD_REMASTER_DIR"
+SCRIPT_DIR="`dirname $0`"
+
+if [ -e "$SCRIPT_DIR/customize_common" ]
+        source "$SCRIPT_DIR/customize_common"
+fi
+
+function install_nmtelekinese()
+{
+	mkdir -p "$IRD/nm"
+	cp "$SCRIPT_DIR/nmtelekinese/nmtelekinese.desktop" "$IRD/nm"
+	cp "$SCRIPT_DIR/nmtelekinese/nmtelekinese.py" "$IRD/nm"
+	cp "$SCRIPT_DIR/nmtelekinese/ORDER" "$IRD/scripts/casper-bottom/"
+	cp "$SCRIPT_DIR/nmtelekinese/26mopsmops" "$IRD/scripts/casper-bottom/"
+	chmod +x "$IRD/scripts/casper-bottom/26mopsmops"
+}
+
+function add_no_bootloader_icon()
+{
+	cp "$SCRIPT_DIR/no-bootloader-icon/25adduser" "$IRD/scripts/casper-bottom/"
+	chmod +x "$IRD/scripts/casper-bottom/25adduser"
+}
+
+install_nmtelekinese
+add_no_bootloader_icon
+patch_all "$SCRIPT_DIR/initrd-patches/" "$IRD"
diff --git a/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize_iso b/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize_iso
new file mode 100755
index 0000000..940ad59
--- /dev/null
+++ b/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/customize_iso
@@ -0,0 +1,11 @@
+#!/bin/bash
+SCRIPT_DIR=`dirname "$0"`
+REMASTER_HOME=${1:-~/tmp}
+ISO_REMASTER_DIR="$REMASTER_HOME/remaster-iso"
+REMASTER_DIR="$REMASTER_HOME/remaster-root"
+
+if [ -e "$SCRIPT_DIR/customize_common" ]
+        source "$SCRIPT_DIR/customize_common"
+fi
+
+patch_all "$SCRIPT_DIR/iso-patches/" "$ISO_REMASTER_DIR/"
diff --git a/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/iso-patches/ubiquity-keep-installed.patch b/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/iso-patches/ubiquity-keep-installed.patch
new file mode 100644
index 0000000..64e330e
--- /dev/null
+++ b/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/iso-patches/ubiquity-keep-installed.patch
@@ -0,0 +1,9 @@
+--- a/preseed/ubuntu.seed	2013-02-13 23:21:04.000000000 +0100
++++ b/preseed/ubuntu.seed	2013-04-07 14:11:15.429958827 +0200
+@@ -6,5 +6,5 @@
+ # application packages pulled in by language packs. Given that we clearly
+ # have the space to include them on the DVD, they're useful and we might as
+ # well keep them installed.
+-ubiquity	ubiquity/keep-installed	string icedtea6-plugin openoffice.org
++ubiquity	ubiquity/keep-installed	string icedtea6-plugin openoffice.org gparted kpartx kpartx-boot libgtkmm apt-clone cryptsetup dpkg-repack gir1.2-json-1.0 gir1.2-xkl-1.0 gir1.2-timezonemap-1.0 keyutils libnss3-1d python-pyicu realpath
+ d-i	base-installer/kernel/altmeta	string lts-quantal
diff --git a/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/lip_sources.list b/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/lip_sources.list
new file mode 100644
index 0000000..c85e992
--- /dev/null
+++ b/Installer-USB-Stick/UbuntuCustomizationKit/customize-lip-testing/lip_sources.list
@@ -0,0 +1,54 @@
+# deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release i386 (20120423)]/ precise main restricted
+
+# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
+# newer versions of the distribution.
+deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise main restricted
+deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise main restricted
+
+## Major bug fix updates produced after the final release of the
+## distribution.
+deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-updates main restricted
+deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-updates main restricted
+
+## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
+## team. Also, please note that software in universe WILL NOT receive any
+## review or updates from the Ubuntu security team.
+deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise universe
+deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise universe
+deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-updates universe
+deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-updates universe
+
+## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
+## team, and may not be under a free licence. Please satisfy yourself as to 
+## your rights to use the software. Also, please note that software in 
+## multiverse WILL NOT receive any review or updates from the Ubuntu
+## security team.
+deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise multiverse
+deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise multiverse
+deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-updates multiverse
+deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-updates multiverse
+
+## N.B. software from this repository may not have been tested as
+## extensively as that contained in the main release, although it includes
+## newer versions of some applications which may provide useful features.
+## Also, please note that software in backports WILL NOT receive any review
+## or updates from the Ubuntu security team.
+
+deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-security main restricted
+deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-security main restricted
+deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-security universe
+deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-security universe
+deb http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-security multiverse
+deb-src http://ftp.halifax.rwth-aachen.de/ubuntu/ precise-security multiverse
+
+## Uncomment the following two lines to add software from Canonical's
+## 'partner' repository.
+## This software is not part of Ubuntu, but is offered by Canonical and the
+## respective vendors as a service to Ubuntu users.
+# deb http://archive.canonical.com/ubuntu precise partner
+# deb-src http://archive.canonical.com/ubuntu precise partner
+
+## This software is not part of Ubuntu, but is offered by third-party
+## developers who want to ship their latest software.
+deb http://extras.ubuntu.com/ubuntu precise main
+deb-src http://extras.ubuntu.com/ubuntu precise main
-- 
GitLab