summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2007-09-23 10:04:49 +0200
committerDaniel Baumann <daniel@debian.org>2011-03-09 18:18:29 +0100
commit1863ed88740575342008ac5f694d03e944bcece2 (patch)
tree58272f72528cedb7af31ee6e6c2c0f7fbd602160 /functions
parentda353a5231ad925013d01065768864307c70651a (diff)
downloadlive-build-1863ed88740575342008ac5f694d03e944bcece2.zip
live-build-1863ed88740575342008ac5f694d03e944bcece2.tar.gz
Adding live-helper 1.0~a5-1.
Diffstat (limited to 'functions')
-rwxr-xr-xfunctions/arguments.sh18
-rwxr-xr-xfunctions/breakpoints.sh13
-rwxr-xr-xfunctions/chroot.sh2
-rwxr-xr-xfunctions/common.sh2
-rwxr-xr-xfunctions/defaults.sh207
-rwxr-xr-xfunctions/echo.sh6
-rwxr-xr-xfunctions/lockfile.sh2
-rwxr-xr-xfunctions/stagefile.sh2
8 files changed, 213 insertions, 39 deletions
diff --git a/functions/arguments.sh b/functions/arguments.sh
index b3db8ee..8405dcb 100755
--- a/functions/arguments.sh
+++ b/functions/arguments.sh
@@ -11,7 +11,7 @@ set -e
Arguments ()
{
- ARGUMENTS="`getopt --longoptions conffile:,debug,force,help,logfile:,quiet,usage,verbose,version --name=${PROGRAM} --options huv --shell sh -- "${@}"`"
+ ARGUMENTS="`getopt --longoptions breakpoints,conffile:,debug,force,help,logfile:,quiet,usage,verbose,version --name=${PROGRAM} --options huv --shell sh -- "${@}"`"
if [ "${?}" != "0" ]
then
@@ -24,16 +24,20 @@ Arguments ()
while true
do
case "${1}" in
+ --breakpoints)
+ LH_BREAKPOINTS="enabled"; shift
+ ;;
+
--conffile)
- CONFFILE="${2}"; shift 2
+ LH_CONFFILE="${2}"; shift 2
;;
--debug)
- DEBUG="true"; shift
+ LH_DEBUG="enabled"; shift
;;
--force)
- FORCE="true"; shift
+ LH_FORCE="enabled"; shift
;;
-h|--help)
@@ -41,11 +45,11 @@ Arguments ()
;;
--logfile)
- LOGFILE="${2}"; shift 2
+ LH_LOGFILE="${2}"; shift 2
;;
--quiet)
- QUIET="true"; shift
+ LH_QUIET="enabled"; shift
;;
-u|--usage)
@@ -53,7 +57,7 @@ Arguments ()
;;
--verbose)
- VERBOSE="true"; shift
+ LH_VERBOSE="enabled"; shift
;;
-v|--version)
diff --git a/functions/breakpoints.sh b/functions/breakpoints.sh
index 7dfc24c..70e4738 100755
--- a/functions/breakpoints.sh
+++ b/functions/breakpoints.sh
@@ -1,8 +1,19 @@
#!/bin/sh
-# breakpoints.sh
+# breakpoints.sh - run with breakpoints
# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org>
#
# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
# This is free software, and you are welcome to redistribute it
# under certain conditions; see COPYING for details.
+
+Breakpoint ()
+{
+ if [ "${LH_BREAKPOINTS}" = "enabled" ]
+ then
+ BREAKPOINT="${1}"
+
+ Echo_message "Waiting at ${BREAKPOINT}"
+ read
+ fi
+}
diff --git a/functions/chroot.sh b/functions/chroot.sh
index c40c475..643f08f 100755
--- a/functions/chroot.sh
+++ b/functions/chroot.sh
@@ -15,5 +15,5 @@ Chroot ()
# Executing commands in chroot
Echo_debug "Executing: ${COMMANDS}"
- chroot chroot /usr/bin/env -i HOME="/root" PATH="/usr/sbin:/usr/bin:/sbin:/bin" TERM="${TERM}" ftp_proxy="${LH_APT_FTPPROXY}" http_proxy="${LH_APT_HTTPPPROXY}" DEBIAN_FRONTEND="${LH_DEBCONF_FRONTEND}" DEBIAN_PRIORITY="${LH_DEBCONF_PRIORITY}" ${COMMANDS}
+ chroot chroot /usr/bin/env -i HOME="/root" PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" TERM="${TERM}" ftp_proxy="${LH_APT_FTPPROXY}" http_proxy="${LH_APT_HTTPPPROXY}" DEBIAN_FRONTEND="${LH_DEBCONF_FRONTEND}" DEBIAN_PRIORITY="${LH_DEBCONF_PRIORITY}" ${COMMANDS}
}
diff --git a/functions/common.sh b/functions/common.sh
index 15093cd..61c10c1 100755
--- a/functions/common.sh
+++ b/functions/common.sh
@@ -10,4 +10,4 @@
set -e
PROGRAM="`basename ${0}`"
-VERSION="1.0~a4"
+VERSION="1.0~a5"
diff --git a/functions/defaults.sh b/functions/defaults.sh
index 001ef1c..e22ab93 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -13,6 +13,12 @@ Set_defaults ()
{
## config/common
+ # Setting mode
+ if [ -z "${LH_MODE}" ]
+ then
+ LH_MODE="debian"
+ fi
+
# Setting package manager
if [ -z "${LH_APT}" ]
then
@@ -68,16 +74,36 @@ Set_defaults ()
# Setting bootstrap program
if [ -z "${LH_BOOTSTRAP}" ] || [ ! -x "${LH_BOOTSTRAP}" ]
then
- if [ -x "/usr/bin/cdebootstrap" ]
- then
- LH_BOOTSTRAP="cdebootstrap"
- elif [ -x "/usr/sbin/debootstrap" ]
- then
- LH_BOOTSTRAP="debootstrap"
- else
- echo "E: Can't process file /usr/bin/cdebootstrap or /usr/sbin/debootstrap (FIXME)"
- exit 1
- fi
+ case "${LH_MODE}" in
+ debian)
+ if [ -x "/usr/bin/cdebootstrap" ]
+ then
+ LH_BOOTSTRAP="cdebootstrap"
+ elif [ -x "/usr/sbin/debootstrap" ]
+ then
+ LH_BOOTSTRAP="debootstrap"
+ else
+ echo "E: Can't process file /usr/bin/cdebootstrap or /usr/sbin/debootstrap (FIXME)"
+ exit 1
+ fi
+ ;;
+
+ ubuntu)
+ if [ -x "/usr/sbin/debootstrap" ]
+ then
+ if [ -f /usr/lib/debootstrap/scripts/feisty ]
+ then
+ LH_BOOTSTRAP="debootstrap"
+ else
+ echo "E: Your version of debootstrap does not support ubuntu."
+ exit 1
+ fi
+ else
+ echo "E: You need to install debootstrap from Ubuntu in order to bootstrap ubuntu."
+ exit 1
+ fi
+ ;;
+ esac
fi
# Setting cache option
@@ -121,7 +147,41 @@ Set_defaults ()
# Setting root directory
if [ -z "${LIVE_ROOT}" ]
then
- LIVE_ROOT="debian-live"
+ case "${LH_MODE}" in
+ debian)
+ LIVE_ROOT="debian-live"
+ ;;
+
+ ubuntu)
+ LIVE_ROOT="ubuntu-live"
+ ;;
+ esac
+ fi
+
+ # Setting live helper options
+ if [ -z "${LH_BREAKPOINTS}" ]
+ then
+ LH_BREAKPOINTS="disabled"
+ fi
+
+ if [ -z "${LH_DEBUG}" ]
+ then
+ LH_DEBUG="disabled"
+ fi
+
+ if [ -z "${LH_FORCE}" ]
+ then
+ LH_FORCE="disabled"
+ fi
+
+ if [ -z "${LH_QUIET}" ]
+ then
+ LH_QUIET="disabled"
+ fi
+
+ if [ -z "${LH_VERBOSE}" ]
+ then
+ LH_VERBOSE="disabled"
fi
## config/bootstrap
@@ -140,11 +200,19 @@ Set_defaults ()
# Setting distribution value
if [ -z "${LIVE_DISTRIBUTION}" ]
then
- LIVE_DISTRIBUTION="sid"
+ case "${LH_MODE}" in
+ debian)
+ LIVE_DISTRIBUTION="sid"
+ ;;
+
+ ubuntu)
+ LIVE_DISTRIBUTION="feisty"
+ ;;
+ esac
fi
# Setting distribution configuration value
- # LIVE_DISTRIBUTION_CONFIG
+ # LIVE_BOOTSTRAP_CONFIG
# Setting flavour value
if [ -z "${LIVE_BOOTSTRAP_FLAVOUR}" ]
@@ -155,25 +223,57 @@ Set_defaults ()
# Setting mirror to fetch packages from
if [ -z "${LIVE_MIRROR_BUILD}" ]
then
- LIVE_MIRROR_BUILD="http://ftp.debian.org/debian/"
+ case "${LH_MODE}" in
+ debian)
+ LIVE_MIRROR_BUILD="http://ftp.debian.org/debian/"
+ ;;
+
+ ubuntu)
+ LIVE_MIRROR_BUILD="http://archive.ubuntu.com/ubuntu/"
+ ;;
+ esac
fi
# Setting security mirror to fetch packages from
if [ -z "${LIVE_MIRROR_BUILD_SECURITY}" ]
then
- LIVE_MIRROR_BUILD_SECURITY="http://security.debian.org/"
+ case "${LH_MODE}" in
+ debian)
+ LIVE_MIRROR_BUILD_SECURITY="http://security.debian.org/"
+ ;;
+
+ ubuntu)
+ LIVE_MIRROR_BUILD_SECURITY="http://security.ubuntu.org/ubuntu/"
+ ;;
+ esac
fi
# Setting mirror which ends up in the image
if [ -z "${LIVE_MIRROR_IMAGE}" ]
then
- LIVE_MIRROR_IMAGE="http://ftp.debian.org/debian/"
+ case "${LH_MODE}" in
+ debian)
+ LIVE_MIRROR_IMAGE="http://ftp.debian.org/debian/"
+ ;;
+
+ ubuntu)
+ LIVE_MIRROR_IMAGE="http://archive.ubuntu.com/ubuntu/"
+ ;;
+ esac
fi
# Setting security mirror which ends up in the image
if [ -z "${LIVE_MIRROR_IMAGE_SECURITY}" ]
then
- LIVE_MIRROR_IMAGE_SECURITY="http://security.debian.org/"
+ case "${LH_MODE}" in
+ debian)
+ LIVE_MIRROR_IMAGE_SECURITY="http://security.debian.org/"
+ ;;
+
+ ubuntu)
+ LIVE_MIRROR_IMAGE_SECURITY="http://security.ubuntu.com/ubuntu/"
+ ;;
+ esac
fi
# Setting sections value
@@ -199,7 +299,15 @@ Set_defaults ()
;;
amd64)
- LIVE_KERNEL_FLAVOUR="amd64"
+ case "${LH_MODE}" in
+ debian)
+ LIVE_KERNEL_FLAVOUR="amd64"
+ ;;
+
+ ubuntu)
+ LIVE_KERNEL_FLAVOUR="amd64-generic"
+ ;;
+ esac
;;
arm)
@@ -212,7 +320,15 @@ Set_defaults ()
;;
i386)
- LIVE_KERNEL_FLAVOUR="486"
+ case "${LH_MODE}" in
+ debian)
+ LIVE_KERNEL_FLAVOUR="486"
+ ;;
+
+ ubuntu)
+ LIVE_KERNEL_FLAVOUR="386"
+ ;;
+ esac
;;
ia64)
@@ -233,7 +349,15 @@ Set_defaults ()
;;
sparc)
- LIVE_KERNEL_FLAVOUR="sparc32"
+ case "${LH_MODE}" in
+ debian)
+ LIVE_KERNEL_FLAVOUR="sparc32"
+ ;;
+
+ ubuntu)
+ LIVE_KERNEL_FLAVOUR="sparc64"
+ ;;
+ esac
;;
*)
@@ -245,7 +369,15 @@ Set_defaults ()
# Set kernel packages
if [ -z "${LIVE_KERNEL_PACKAGES}" ]
then
- LIVE_KERNEL_PACKAGES="linux-image-2.6 squashfs-modules-2.6 unionfs-modules-2.6"
+ case "${LH_MODE}" in
+ debian)
+ LIVE_KERNEL_PACKAGES="linux-image-2.6 squashfs-modules-2.6 unionfs-modules-2.6"
+ ;;
+
+ ubuntu)
+ LIVE_KERNEL_PACKAGES="linux-image"
+ ;;
+ esac
if [ -n "${LIVE_ENCRYPTION}" ]
then
@@ -253,6 +385,9 @@ Set_defaults ()
fi
fi
+ # Setting keyring packages
+ # LIVE_KEYRING_PACKAGES
+
# Setting language string
# LIVE_LANGUAGE
@@ -327,7 +462,15 @@ Set_defaults ()
# Setting hostname
if [ -z "${LIVE_HOSTNAME}" ]
then
- LIVE_HOSTNAME="debian"
+ case "${LH_MODE}" in
+ debian)
+ LIVE_HOSTNAME="debian"
+ ;;
+
+ ubuntu)
+ LIVE_HOSTNAME="ubuntu"
+ ;;
+ esac
fi
# Setting image type
@@ -357,7 +500,15 @@ Set_defaults ()
# Setting iso volume
if [ -z "${LIVE_ISO_VOLUME}" ]
then
- LIVE_ISO_VOLUME="Debian Live \`date +%Y%m%d\`"
+ case "${LH_MODE}" in
+ debian)
+ LIVE_ISO_VOLUME="Debian Live \`date +%Y%m%d\`"
+ ;;
+
+ ubuntu)
+ LIVE_ISO_VOLUME="Ubuntu Live \`date +%Y%m%d\`"
+ ;;
+ esac
fi
# Setting netboot server address
@@ -369,7 +520,15 @@ Set_defaults ()
# Setting netboot server path
if [ -z "${LIVE_SERVER_PATH}" ]
then
- LIVE_SERVER_PATH="/srv/debian-live"
+ case "${LH_MODE}" in
+ debian)
+ LIVE_SERVER_PATH="/srv/debian-live"
+ ;;
+
+ ubuntu)
+ LIVE_SERVER_PATH="/srv/ubuntu-live"
+ ;;
+ esac
fi
# Setting source option
diff --git a/functions/echo.sh b/functions/echo.sh
index 89d2d6b..71800ad 100755
--- a/functions/echo.sh
+++ b/functions/echo.sh
@@ -11,7 +11,7 @@ set -e
Echo_debug ()
{
- if [ "${DEBUG}" = "true" ]
+ if [ "${LH_DEBUG}" = "enabled" ]
then
echo "D: ${@}"
fi
@@ -24,7 +24,7 @@ Echo_error ()
Echo_message ()
{
- if [ "${QUIET}" != "true" ]
+ if [ "${LH_QUIET}" != "enabled" ]
then
echo "P: ${@}"
fi
@@ -32,7 +32,7 @@ Echo_message ()
Echo_verbose ()
{
- if [ "${VERBOSE}" = "true" ]
+ if [ "${LH_VERBOSE}" = "enabled" ]
then
echo "I: ${@}"
fi
diff --git a/functions/lockfile.sh b/functions/lockfile.sh
index 3b44e54..efb478a 100755
--- a/functions/lockfile.sh
+++ b/functions/lockfile.sh
@@ -33,7 +33,7 @@ Create_lockfile ()
fi
# Creating lock trap
- trap "test -f ${FILE} && rm -f ${FILE}; exit 0" 0 2 15
+ trap "test -f ${FILE} && rm -f ${FILE}; exit 0" 0 1 2 3 9 15
# Creating lock file
touch "${FILE}"
diff --git a/functions/stagefile.sh b/functions/stagefile.sh
index a5879f5..6a41cda 100755
--- a/functions/stagefile.sh
+++ b/functions/stagefile.sh
@@ -17,7 +17,7 @@ Check_stagefile ()
# Checking stage file
if [ -f "${FILE}" ]
then
- if [ "${FORCE}" = "true" ]
+ if [ "${LH_FORCE}" = "enabled" ]
then
# Forcing execution
rm -f "${FILE}"