[PATCH] Added Ubuntu mode.
Hello Folks,
I've created a patch to add Ubuntu mode to live-helper. The patch mostly touches functions/defaults.sh but also makes a few small tweaks helpers/lh_chroot_sources which I'm hoping can be reverted in the future by removing the hard coded security suite names from helpers/lh_chroot_sources.
functions/defaults.sh | 165 ++++++++++++++++++++++++++++++++++++++-------
helpers/lh_chroot_sources | 58 +++++++++++-----
2 files changed, 182 insertions(+), 41 deletions(-)
Using this patch, I've successfully created a Ubuntu live image (specifically, a mobile-netbook-remix image). The only difference in terms of packages in the live image produced by live-helper and the live image created today by Ubuntu are that:
* my image didn't have ubiquity or its dependencies as I didn't tell live-helper to install ubiquity in the image I created; and
* live-helper's standard package list had console-common and console-data causing these two packages to be added whereas they are not a part of Ubuntu images.
This patch does not touch includes or the templates (so the syslinux splash still shows Debian Live) but I'll be sending in a patch shortly if this one is accepted to address this.
If you have any questions, comments, or concerns then please feel free to shoot them my way. :)
Cheers,
--
Cody A.W. Somerville
Software Systems Release Engineer
Foundations Team
Custom Engineering Solutions Group
Canonical OEM Services
Phone: +1-781-850-2087
Cell: +1-506-471-8402
Email: cody.somerville@canonical.com
From bff1edc52f0c2747b8506eee3b85fe68b32e8d83 Mon Sep 17 00:00:00 2001
From: Cody A.W. Somerville <cody.somerville@canonical.com>
Date: Wed, 15 Apr 2009 07:44:52 -0300
Subject: [PATCH] Added Ubuntu mode.
---
functions/defaults.sh | 165 ++++++++++++++++++++++++++++++++++++++-------
helpers/lh_chroot_sources | 58 +++++++++++-----
2 files changed, 182 insertions(+), 41 deletions(-)
diff --git a/functions/defaults.sh b/functions/defaults.sh
index 2b2e3f7..dfe8d48 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -25,6 +25,10 @@ Set_defaults ()
LH_DISTRIBUTION="lenny"
;;
+ ubuntu)
+ LH_DISTRIBUTION="jaunty"
+ ;;
+
emdebian)
LH_DISTRIBUTION="sid"
;;
@@ -72,7 +76,7 @@ Set_defaults ()
# Setting apt recommends
case "${LH_MODE}" in
- debian|debian-release)
+ debian|debian-release|ubuntu)
LH_APT_RECOMMENDS="${LH_APT_RECOMMENDS:-enabled}"
;;
@@ -136,6 +140,10 @@ Set_defaults ()
LH_INITRAMFS="live-initramfs"
fi
;;
+
+ ubuntu)
+ LH_INITRAMFS="casper"
+ ;;
*)
LH_INITRAMFS="live-initramfs"
@@ -199,6 +207,10 @@ Set_defaults ()
debian|debian-release)
LH_ROOT="debian-live"
;;
+
+ ubuntu)
+ LH_ROOT="ubuntu-live"
+ ;;
emdebian)
LH_ROOT="emdebian-live"
@@ -285,6 +297,18 @@ Set_defaults ()
esac
;;
+ ubuntu)
+ case "${LH_ARCHITECTURE}" in
+ amd64|i386)
+ LH_MIRROR_BOOTSTRAP="http://archive.ubuntu.com/ubuntu/"
+ ;;
+
+ *)
+ LH_MIRROR_BOOTSTRAP="http://ports.ubuntu.com/"
+ ;;
+ esac
+ ;;
+
emdebian)
LH_MIRROR_BOOTSTRAP="http://buildd.emdebian.org/grip/"
;;
@@ -301,6 +325,18 @@ Set_defaults ()
LH_MIRROR_CHROOT_SECURITY="http://security.debian.org/"
;;
+ ubuntu)
+ case "${LH_ARCHITECTURE}" in
+ amd64|i386)
+ LH_MIRROR_CHROOT_SECURITY="http://archive.ubuntu.com/ubuntu/"
+ ;;
+
+ *)
+ LH_MIRROR_CHROOT_SECURITY="http://ports.ubuntu.com/"
+ ;;
+ esac
+ ;;
+
emdebian)
LH_MIRROR_CHROOT_SECURITY="none"
;;
@@ -323,6 +359,18 @@ Set_defaults ()
esac
;;
+ ubuntu)
+ case "${LH_ARCHITECTURE}" in
+ amd64|i386)
+ LH_MIRROR_BINARY="http://archive.ubuntu.com/ubuntu/"
+ ;;
+
+ *)
+ LH_MIRROR_BINARY="http://ports.ubuntu.com/"
+ ;;
+ esac
+ ;;
+
emdebian)
LH_MIRROR_BINARY="http://buildd.emdebian.org/grip/"
;;
@@ -337,6 +385,18 @@ Set_defaults ()
LH_MIRROR_BINARY_SECURITY="http://security.debian.org/"
;;
+ ubuntu)
+ case "${LH_ARCHITECTURE}" in
+ amd64|i386)
+ LH_MIRROR_BINARY_SECURITY="http://archive.ubuntu.com/ubuntu/"
+ ;;
+
+ *)
+ LH_MIRROR_BINARY_SECURITY="http://ports.ubuntu.com/"
+ ;;
+ esac
+ ;;
+
emdebian)
LH_MIRROR_BINARY_SECURITY="none"
;;
@@ -382,6 +442,10 @@ Set_defaults ()
LH_KEYRING_PACKAGES="${LH_KEYRING_PACKAGES:-debian-archive-keyring}"
;;
+ ubuntu)
+ LH_KEYRING_PACKAGES="${LH_KEYRING_PACKAGES:-ubuntu-keyring}"
+ ;;
+
emdebian)
LH_KEYRING_PACKAGES="${LH_kEYRING_PACKAGES:-debian-archive-keyring}"
;;
@@ -399,7 +463,12 @@ Set_defaults ()
;;
amd64)
- LH_LINUX_FLAVOURS="amd64"
+ if [ "${LH_MODE}" = "ubuntu" ]
+ then
+ LH_LINUX_FLAVOURS="generic"
+ else
+ LH_LINUX_FLAVOURS="amd64"
+ fi
;;
hppa)
@@ -407,15 +476,20 @@ Set_defaults ()
;;
i386)
- case "${LIST}" in
- stripped|minimal)
- LH_LINUX_FLAVOURS="486"
- ;;
-
- *)
- LH_LINUX_FLAVOURS="486 686"
- ;;
- esac
+ if [ "${LH_MODE}" = "ubuntu" ]
+ then
+ LH_LINUX_FLAVOURS="generic"
+ else
+ case "${LIST}" in
+ stripped|minimal)
+ LH_LINUX_FLAVOURS="486"
+ ;;
+
+ *)
+ LH_LINUX_FLAVOURS="486 686"
+ ;;
+ esac
+ fi
;;
ia64)
@@ -461,20 +535,27 @@ Set_defaults ()
# Set linux packages
if [ -z "${LH_LINUX_PACKAGES}" ]
then
- LH_LINUX_PACKAGES="linux-image-2.6 \${LH_UNION_FILESYSTEM}-modules-2.6"
+ case "${LH_MODE}" in
+ debian|debian-release|embedian)
+ LH_LINUX_PACKAGES="linux-image-2.6 \${LH_UNION_FILESYSTEM}-modules-2.6"
+ if [ "${LH_CHROOT_FILESYSTEM}" = "squashfs" ]
+ then
+ LH_LINUX_PACKAGES="${LH_LINUX_PACKAGES} squashfs-modules-2.6"
+ fi
- if [ "${LH_CHROOT_FILESYSTEM}" = "squashfs" ]
- then
- LH_LINUX_PACKAGES="${LH_LINUX_PACKAGES} squashfs-modules-2.6"
- fi
+ case "${LH_ENCRYPTION}" in
+ ""|disabled)
+ ;;
+ *)
+ LH_LINUX_PACKAGES="${LH_LINUX_PACKAGES} loop-aes-modules-2.6"
+ ;;
+ esac
+ ;;
- case "${LH_ENCRYPTION}" in
- ""|disabled)
- ;;
- *)
- LH_LINUX_PACKAGES="${LH_LINUX_PACKAGES} loop-aes-modules-2.6"
+ ubuntu)
+ LH_LINUX_PACKAGES="linux"
;;
- esac
+ esac
fi
# Setting packages string
@@ -647,6 +728,15 @@ Set_defaults ()
LH_BOOTAPPEND_INSTALL=" -- \${LH_BOOTAPPEND_LIVE}"
fi
fi
+
+ if [ "${LH_MODE}" = "ubuntu" ]
+ then
+ if [ "${LH_BINARY_IMAGES}" = "usb-hdd" ]
+ then
+ LH_BOOTAPPEND_INSTALL="cdrom-detect/try-usb=true -- \${LH_BOOTAPPEND_LIVE}"
+ fi
+ fi
+
# Setting encryption
LH_ENCRYPTION="${LH_ENCRYPTION:-disabled}"
@@ -657,7 +747,15 @@ Set_defaults ()
# Setting hostname
if [ -z "${LH_HOSTNAME}" ]
then
- LH_HOSTNAME="debian"
+ case "${LH_MODE}" in
+ ubuntu)
+ LH_HOSTNAME="ubuntu"
+ ;;
+
+ *)
+ LH_HOSTNAME="debian"
+ ;;
+ esac
fi
# Setting iso author
@@ -667,6 +765,10 @@ Set_defaults ()
debian|debian-release)
LH_ISO_APPLICATION="Debian Live"
;;
+
+ ubuntu)
+ LH_ISO_APPLICATION="Ubuntu Live"
+ ;;
emdebian)
LH_ISO_APPLICATION="Emdebian Live"
@@ -693,6 +795,10 @@ Set_defaults ()
LH_ISO_VOLUME="Debian ${VERSION} ${LH_ARCHITECTURE} live"
;;
+ ubuntu)
+ LH_ISO_VOLUME="Ubuntu ${LH_DISTRIBUTION} \$(date +%Y%m%d-%H:%M)"
+ ;;
+
emdebian)
LH_ISO_VOLUME="Emdebian ${LH_DISTRIBUTION} \$(date +%Y%m%d-%H:%M)"
;;
@@ -729,6 +835,10 @@ Set_defaults ()
LH_NET_ROOT_PATH="/srv/debian-live"
;;
+ ubuntu)
+ LH_NET_ROOT_PATH="/srv/ubuntu-live"
+ ;;
+
emdebian)
LH_NET_ROOT_PATH="/srv/emdebian-live"
;;
@@ -780,7 +890,14 @@ Set_defaults ()
LH_SYSLINUX_MENU_MEMTEST_ENTRY="${LH_SYSLINUX_MENU_MEMTEST_ENTRY:-Memory test}"
# Setting username
- LH_USERNAME="${LH_USERNAME:-user}"
+ case "${LH_MODE}" in
+ ubuntu)
+ LH_USERNAME="${LH_USERNAME:-ubuntu}"
+ ;;
+ *)
+ LH_USERNAME="${LH_USERNAME:-user}"
+ ;;
+ esac
## config/source
diff --git a/helpers/lh_chroot_sources b/helpers/lh_chroot_sources
index d5e640c..303393f 100755
--- a/helpers/lh_chroot_sources
+++ b/helpers/lh_chroot_sources
@@ -51,15 +51,27 @@ case "${1}" in
if [ "${LH_SECURITY}" = "enabled" ]
then
- if [ "${LH_DISTRIBUTION}" != "sid" ] && [ "${LH_DISTRIBUTION}" != "unstable" ]
- then
- echo "deb ${LH_MIRROR_CHROOT_SECURITY} ${LH_DISTRIBUTION}/updates ${LH_CATEGORIES}" >> chroot/etc/apt/sources.list
+ case "${LH_MODE}" in
+ ubuntu)
+ echo "deb ${LH_MIRROR_CHROOT_SECURITY} ${LH_DISTRIBUTION}-security ${LH_CATEGORIES}" >> chroot/etc/apt/sources.list
+ if [ "${LH_SOURCE}" = "enabled" ]
+ then
+ echo "deb-src ${LH_MIRROR_CHROOT_SECURITY} ${LH_DISTRIBUTION}-security ${LH_CATEGORIES}" >> chroot/etc/apt/sources.list
+ fi
+ ;;
+
+ *)
+ if [ "${LH_DISTRIBUTION}" != "sid" ] && [ "${LH_DISTRIBUTION}" != "unstable" ]
+ then
+ echo "deb ${LH_MIRROR_CHROOT_SECURITY} ${LH_DISTRIBUTION}/updates ${LH_CATEGORIES}" >> chroot/etc/apt/sources.list
- if [ "${LH_SOURCE}" = "enabled" ]
- then
- echo "deb-src ${LH_MIRROR_CHROOT_SECURITY} ${LH_DISTRIBUTION}/updates ${LH_CATEGORIES}" >> chroot/etc/apt/sources.list
- fi
- fi
+ if [ "${LH_SOURCE}" = "enabled" ]
+ then
+ echo "deb-src ${LH_MIRROR_CHROOT_SECURITY} ${LH_DISTRIBUTION}/updates ${LH_CATEGORIES}" >> chroot/etc/apt/sources.list
+ fi
+ fi
+ ;;
+ esac
fi
# Check local sources.list
@@ -361,15 +373,27 @@ case "${1}" in
if [ "${LH_SECURITY}" = "enabled" ]
then
- if [ "${LH_DISTRIBUTION}" != "sid" ] && [ "${LH_DISTRIBUTION}" != "unstable" ]
- then
- echo "deb ${LH_MIRROR_BINARY_SECURITY} ${LH_DISTRIBUTION}/updates ${LH_CATEGORIES}" >> chroot/etc/apt/sources.list
-
- if [ "${LH_SOURCE}" = "enabled" ]
- then
- echo "deb-src ${LH_MIRROR_BINARY_SECURITY} ${LH_DISTRIBUTION}/updates ${LH_CATEGORIES}" >> chroot/etc/apt/sources.list
- fi
- fi
+ case "${LH_MODE}" in
+ ubuntu)
+ echo "deb ${LH_MIRROR_BINARY_SECURITY} ${LH_DISTRIBUTION}-security ${LH_CATEGORIES}" >> chroot/etc/apt/sources.list
+ if [ "${LH_SOURCE}" = "enabled" ]
+ then
+ echo "deb-src ${LH_MIRROR_BINARY_SECURITY} ${LH_DISTRIBUTION}-security ${LH_CATEGORIES}" >> chroot/etc/apt/sources.list
+ fi
+ ;;
+
+ *)
+ if [ "${LH_DISTRIBUTION}" != "sid" ] && [ "${LH_DISTRIBUTION}" != "unstable" ]
+ then
+ echo "deb ${LH_MIRROR_BINARY_SECURITY} ${LH_DISTRIBUTION}/updates ${LH_CATEGORIES}" >> chroot/etc/apt/sources.list
+
+ if [ "${LH_SOURCE}" = "enabled" ]
+ then
+ echo "deb-src ${LH_MIRROR_BINARY_SECURITY} ${LH_DISTRIBUTION}/updates ${LH_CATEGORIES}" >> chroot/etc/apt/sources.list
+ fi
+ fi
+ ;;
+ esac
fi
# Check local sources.list
--
1.6.0.4
Reply to: