live-build/functions/defaults.sh

604 lines
11 KiB
Bash
Raw Normal View History

2007-09-23 08:04:46 +00:00
#!/bin/sh
# defaults.sh - handle default values
2007-09-23 08:04:48 +00:00
# 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.
2007-09-23 08:04:46 +00:00
set -e
Set_defaults ()
{
## config/common
2007-09-23 08:04:49 +00:00
# Setting mode
if [ -z "${LH_MODE}" ]
then
2007-09-23 08:04:50 +00:00
if [ -f /usr/bin/lsb_release ]
then
case "`lsb_release --short --id`" in
Debian)
LH_MODE="debian"
;;
Ubuntu)
LH_MODE="ubuntu"
;;
esac
else
LH_MODE="debian"
fi
2007-09-23 08:04:49 +00:00
fi
2007-09-23 08:04:46 +00:00
# Setting package manager
if [ -z "${LH_APT}" ]
then
LH_APT="aptitude"
fi
# Setting apt ftp proxy
if [ -z "${LH_APT_FTPPROXY}" ] && [ -n "${ftp_proxy}" ]
then
LH_APT_FTPPROXY="${ftp_proxy}"
else
if [ -n "${LH_APT_FTPPROXY}" ] && [ "${LH_APT_FTPRPOXY}" != "${ftp_proxy}" ]
then
ftp_proxy="${LH_APT_FTPRPOXY}"
fi
fi
# Setting apt http proxy
if [ -z "${LH_APT_HTTPPROXY}" ] && [ -n "${http_proxy}" ]
then
LH_APT_HTTPPROXY="${http_proxy}"
else
if [ -n "${LH_APT_HTTPPROXY}" ] && [ "${LH_APT_HTTPRPOXY}" != "${http_proxy}" ]
then
http_proxy="${LH_APT_HTTPPROXY}"
fi
fi
# Setting apt indices
if [ -z "${LH_APT_GENERIC}" ]
then
LH_APT_GENERIC="enabled"
fi
# Setting apt pdiffs
if [ -z "${LH_APT_PDIFFS}" ]
then
LH_APT_PDIFFS="enabled"
fi
# Setting apt recommends
if [ -z "${LH_APT_RECOMMENDS}" ]
then
LH_APT_RECOMMENDS="enabled"
fi
2007-09-23 08:04:48 +00:00
# Setting apt secure
if [ -z "${LH_APT_SECURE}" ]
then
LH_APT_SECURE="enabled"
fi
2007-09-23 08:04:46 +00:00
# Setting bootstrap program
2007-09-23 08:04:47 +00:00
if [ -z "${LH_BOOTSTRAP}" ] || [ ! -x "${LH_BOOTSTRAP}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:49 +00:00
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
2007-09-23 08:04:46 +00:00
fi
# Setting cache option
if [ -z "${LH_CACHE}" ]
then
LH_CACHE="enabled"
fi
# Setting debconf frontend
if [ -z "${LH_DEBCONF_FRONTEND}" ]
then
LH_DEBCONF_FRONTEND="noninteractive"
fi
if [ -z "${LH_DEBCONF_PRIORITY}" ]
then
LH_DEBCONF_PRIORITY="critical"
fi
2007-09-23 08:04:50 +00:00
if [ -z "${LH_DEBCONF_NOWARNINGS}" ]
then
LH_DEBCONF_NOWARNINGS="yes"
fi
2007-09-23 08:04:46 +00:00
# Setting genisoimage
2007-09-23 08:04:48 +00:00
if [ -z "${LH_GENISOIMAGE}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:50 +00:00
case "${LH_MODE}" in
debian)
LH_GENISOIMAGE="genisoimage"
;;
ubuntu)
LH_GENISOIMAGE="mkisofs"
;;
esac
2007-09-23 08:04:46 +00:00
fi
2007-09-23 08:04:47 +00:00
# Setting losetup
if [ -z "${LH_LOSETUP}" ] || [ ! -x "${LH_LOSETUP}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:47 +00:00
# Check for loop-aes-utils divertion
if [ -x /sbin/losetup.orig ]
then
LH_LOSETUP="losetup.orig"
elif [ -x /sbin/losetup ]
then
LH_LOSETUP="losetup"
else
echo "E: Can't process file /sbin/losetup (FIXME)"
fi
2007-09-23 08:04:46 +00:00
fi
2007-09-23 08:04:47 +00:00
# Setting root directory
if [ -z "${LIVE_ROOT}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:49 +00:00
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"
2007-09-23 08:04:46 +00:00
fi
## config/bootstrap
2007-09-23 08:04:47 +00:00
# Setting architecture value
2007-09-23 08:04:46 +00:00
if [ -z "${LIVE_ARCHITECTURE}" ]
then
if [ -x "/usr/bin/dpkg" ]
then
LIVE_ARCHITECTURE="`dpkg --print-architecture`"
else
echo "E: Can't process file /usr/bin/dpkg (FIXME)"
fi
fi
2007-09-23 08:04:47 +00:00
# Setting distribution value
2007-09-23 08:04:46 +00:00
if [ -z "${LIVE_DISTRIBUTION}" ]
then
2007-09-23 08:04:49 +00:00
case "${LH_MODE}" in
debian)
2007-09-23 08:04:50 +00:00
LIVE_DISTRIBUTION="etch"
2007-09-23 08:04:49 +00:00
;;
ubuntu)
LIVE_DISTRIBUTION="feisty"
;;
esac
2007-09-23 08:04:46 +00:00
fi
2007-09-23 08:04:47 +00:00
# Setting distribution configuration value
2007-09-23 08:04:49 +00:00
# LIVE_BOOTSTRAP_CONFIG
2007-09-23 08:04:46 +00:00
2007-09-23 08:04:47 +00:00
# Setting flavour value
2007-09-23 08:04:48 +00:00
if [ -z "${LIVE_BOOTSTRAP_FLAVOUR}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:48 +00:00
LIVE_BOOTSTRAP_FLAVOUR="standard"
2007-09-23 08:04:46 +00:00
fi
2007-09-23 08:04:48 +00:00
# Setting mirror to fetch packages from
if [ -z "${LIVE_MIRROR_BUILD}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:49 +00:00
case "${LH_MODE}" in
debian)
LIVE_MIRROR_BUILD="http://ftp.debian.org/debian/"
;;
ubuntu)
LIVE_MIRROR_BUILD="http://archive.ubuntu.com/ubuntu/"
;;
esac
2007-09-23 08:04:46 +00:00
fi
2007-09-23 08:04:48 +00:00
# Setting security mirror to fetch packages from
if [ -z "${LIVE_MIRROR_BUILD_SECURITY}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:49 +00:00
case "${LH_MODE}" in
debian)
LIVE_MIRROR_BUILD_SECURITY="http://security.debian.org/"
;;
ubuntu)
LIVE_MIRROR_BUILD_SECURITY="http://security.ubuntu.org/ubuntu/"
;;
esac
2007-09-23 08:04:46 +00:00
fi
2007-09-23 08:04:48 +00:00
# Setting mirror which ends up in the image
if [ -z "${LIVE_MIRROR_IMAGE}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:49 +00:00
case "${LH_MODE}" in
debian)
LIVE_MIRROR_IMAGE="http://ftp.debian.org/debian/"
;;
ubuntu)
LIVE_MIRROR_IMAGE="http://archive.ubuntu.com/ubuntu/"
;;
esac
2007-09-23 08:04:46 +00:00
fi
2007-09-23 08:04:48 +00:00
# Setting security mirror which ends up in the image
if [ -z "${LIVE_MIRROR_IMAGE_SECURITY}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:49 +00:00
case "${LH_MODE}" in
debian)
LIVE_MIRROR_IMAGE_SECURITY="http://security.debian.org/"
;;
ubuntu)
LIVE_MIRROR_IMAGE_SECURITY="http://security.ubuntu.com/ubuntu/"
;;
esac
2007-09-23 08:04:46 +00:00
fi
2007-09-23 08:04:47 +00:00
# Setting sections value
2007-09-23 08:04:46 +00:00
if [ -z "${LIVE_SECTIONS}" ]
then
LIVE_SECTIONS="main"
fi
## config/chroot
2007-09-23 08:04:48 +00:00
# Setting interactive shell/X11/Xnest
if [ -z "${LIVE_INTERACTIVE}" ]
then
LIVE_INTERACTIVE="disabled"
fi
2007-09-23 08:04:46 +00:00
# Setting kernel flavour string
2007-09-23 08:04:48 +00:00
if [ -z "${LIVE_KERNEL_FLAVOUR}" ]
2007-09-23 08:04:46 +00:00
then
case "${LIVE_ARCHITECTURE}" in
alpha)
2007-09-23 08:04:48 +00:00
LIVE_KERNEL_FLAVOUR="alpha-generic"
2007-09-23 08:04:46 +00:00
;;
amd64)
2007-09-23 08:04:49 +00:00
case "${LH_MODE}" in
debian)
LIVE_KERNEL_FLAVOUR="amd64"
;;
ubuntu)
LIVE_KERNEL_FLAVOUR="amd64-generic"
;;
esac
2007-09-23 08:04:46 +00:00
;;
arm)
echo "E: You need to specify the linux kernel flavour manually on arm (FIXME)."
exit 1
;;
hppa)
2007-09-23 08:04:48 +00:00
LIVE_KERNEL_FLAVOUR="parisc"
2007-09-23 08:04:46 +00:00
;;
i386)
2007-09-23 08:04:49 +00:00
case "${LH_MODE}" in
debian)
LIVE_KERNEL_FLAVOUR="486"
;;
ubuntu)
LIVE_KERNEL_FLAVOUR="386"
;;
esac
2007-09-23 08:04:46 +00:00
;;
ia64)
2007-09-23 08:04:48 +00:00
LIVE_KERNEL_FLAVOUR="itanium"
2007-09-23 08:04:46 +00:00
;;
m68k)
2007-09-23 08:04:48 +00:00
LIVE_KERNEL_FLAVOUR="E: You need to specify the linux kernel flavour manually on m68k."
2007-09-23 08:04:46 +00:00
exit 1
;;
powerpc)
2007-09-23 08:04:48 +00:00
LIVE_KERNEL_FLAVOUR="powerpc"
2007-09-23 08:04:46 +00:00
;;
s390)
2007-09-23 08:04:48 +00:00
LIVE_KERNEL_FLAVOUR="s390"
2007-09-23 08:04:46 +00:00
;;
sparc)
2007-09-23 08:04:49 +00:00
case "${LH_MODE}" in
debian)
LIVE_KERNEL_FLAVOUR="sparc32"
;;
ubuntu)
LIVE_KERNEL_FLAVOUR="sparc64"
;;
esac
2007-09-23 08:04:46 +00:00
;;
*)
echo "E: Architecture notyet supported (FIXME)"
;;
esac
fi
# Set kernel packages
if [ -z "${LIVE_KERNEL_PACKAGES}" ]
then
2007-09-23 08:04:49 +00:00
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
2007-09-23 08:04:46 +00:00
if [ -n "${LIVE_ENCRYPTION}" ]
then
2007-09-23 08:04:48 +00:00
LIVE_KERNEL_PACKAGES="${LIVE_KERNEL_PACKAGES} loop-aes-modules-2.6"
2007-09-23 08:04:46 +00:00
fi
fi
2007-09-23 08:04:49 +00:00
# Setting keyring packages
# LIVE_KEYRING_PACKAGES
2007-09-23 08:04:46 +00:00
# Setting language string
# LIVE_LANGUAGE
# Setting tasks
# LIVE_TASKS
# Setting packages string
# LIVE_PACKAGES
# Setting packages list string
2007-09-23 08:04:48 +00:00
if [ -z "${LIVE_PACKAGES_LISTS}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:48 +00:00
LIVE_PACKAGES_LISTS="standard"
2007-09-23 08:04:46 +00:00
fi
# Setting tasks string
2007-09-23 08:04:48 +00:00
for LIST in ${LIVE_PACKAGES_LISTS}
2007-09-23 08:04:46 +00:00
do
case "${LIST}" in
2007-09-23 08:04:50 +00:00
mini|minimal)
LH_APT="apt-get"
;;
2007-09-23 08:04:46 +00:00
gnome-desktop)
2007-09-23 08:04:48 +00:00
LIVE_PACKAGES_LISTS="`echo ${LIVE_PACKAGES_LISTS} | sed -e 's/gnome-desktop//'` standard-x11"
2007-09-23 08:04:50 +00:00
LIVE_TASKS="`echo ${LIVE_TASKS} | sed -e 's/standard//' -e 's/laptop//' -e 's/gnome-desktop//' -e 's/desktop//'` standard laptop gnome-desktop desktop"
2007-09-23 08:04:46 +00:00
;;
kde-desktop)
2007-09-23 08:04:48 +00:00
LIVE_PACKAGES_LISTS="`echo ${LIVE_PACKAGES_LISTS} | sed -e 's/kde-desktop//'` standard-x11"
2007-09-23 08:04:50 +00:00
LIVE_TASKS="`echo ${LIVE_TASKS} | sed -e 's/standard//' -e 's/laptop//' -e 's/kde-desktop//' -e 's/desktop//'` standard laptop kde-desktop desktop"
2007-09-23 08:04:46 +00:00
;;
xfce-desktop)
2007-09-23 08:04:48 +00:00
LIVE_PACKAGES_LISTS="`echo ${LIVE_PACKAGES_LISTS} | sed -e 's/xfce-desktop//'` standard-x11"
2007-09-23 08:04:50 +00:00
LIVE_TASKS="`echo ${LIVE_TASKS} | sed -e 's/standard//' -e 's/laptop//' -e 's/xfce-desktop//' -e 's/desktop//'` standard laptop xfce-desktop desktop"
2007-09-23 08:04:46 +00:00
;;
esac
done
2007-09-23 08:04:48 +00:00
LIVE_PACKAGES_LISTS="`echo ${LIVE_PACKAGES_LISTS} | sed -e 's/ //g'`"
LIVE_TASKS="`echo ${LIVE_TASKS} | sed -e 's/ //g'`"
2007-09-23 08:04:50 +00:00
# LIVE_HOOKS
2007-09-23 08:04:46 +00:00
# Setting security updates option
if [ -z "${LIVE_SECURITY}" ]
then
LIVE_SECURITY="enabled"
fi
# Setting symlink convertion option
if [ -z "${LIVE_SYMLINKS}" ]
then
LIVE_SYMLINKS="disabled"
fi
# Setting sysvinit option
2007-09-23 08:04:46 +00:00
if [ -z "${LIVE_SYSVINIT}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:48 +00:00
LIVE_SYSVINIT="disabled"
2007-09-23 08:04:46 +00:00
fi
## config/image
# Setting boot parameters
# LIVE_BOOTAPPEND
# Setting encryption
# LIVE_ENCRYPTION
2007-09-23 08:04:48 +00:00
# Setting username
if [ -z "${LIVE_USERNAME}" ]
then
LIVE_USERNAME="user"
fi
# Setting hostname
if [ -z "${LIVE_HOSTNAME}" ]
then
2007-09-23 08:04:49 +00:00
case "${LH_MODE}" in
debian)
LIVE_HOSTNAME="debian"
;;
ubuntu)
LIVE_HOSTNAME="ubuntu"
;;
esac
2007-09-23 08:04:48 +00:00
fi
2007-09-23 08:04:46 +00:00
# Setting image type
if [ -z "${LIVE_BINARY_IMAGE}" ]
then
LIVE_BINARY_IMAGE="iso"
fi
# Setting image type
if [ -z "${LIVE_SOURCE_IMAGE}" ]
then
2007-09-23 08:04:49 +00:00
LIVE_SOURCE_IMAGE="generic"
2007-09-23 08:04:46 +00:00
fi
# Setting filesystem
2007-09-23 08:04:49 +00:00
if [ -z "${LIVE_FILESYSTEM}" ]
2007-09-23 08:04:46 +00:00
then
LIVE_FILESYSTEM="squashfs"
fi
2007-09-23 08:04:50 +00:00
# Setting memtest option
if [ -z "${LIVE_MEMTEST}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:50 +00:00
LIVE_MEMTEST="memtest86+"
2007-09-23 08:04:46 +00:00
fi
# Setting iso volume
if [ -z "${LIVE_ISO_VOLUME}" ]
then
2007-09-23 08:04:49 +00:00
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
2007-09-23 08:04:46 +00:00
fi
# Setting netboot server address
if [ -z "${LIVE_SERVER_ADDRESS}" ]
then
LIVE_SERVER_ADDRESS="192.168.1.1"
fi
# Setting netboot server path
if [ -z "${LIVE_SERVER_PATH}" ]
then
2007-09-23 08:04:49 +00:00
case "${LH_MODE}" in
debian)
LIVE_SERVER_PATH="/srv/debian-live"
;;
ubuntu)
LIVE_SERVER_PATH="/srv/ubuntu-live"
;;
esac
2007-09-23 08:04:46 +00:00
fi
# Setting source option
if [ -z "${LIVE_SOURCE}" ]
then
LIVE_SOURCE="disabled"
fi
2007-09-23 08:04:49 +00:00
# Setting grub
if [ -z "${LIVE_BOOTLOADER}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:50 +00:00
case "${LIVE_ARCHITECTURE}" in
i386)
LIVE_BOOTLOADER="syslinux"
;;
powerpc)
LIVE_BOOTLOADER="yaboot"
;;
esac
2007-09-23 08:04:46 +00:00
fi
2007-09-23 08:04:49 +00:00
# Setting grub splash
# LIVE_GRUB_SPLASH
2007-09-23 08:04:46 +00:00
# Setting syslinux splash
# LIVE_SYSLINUX_SPLASH
2007-09-23 08:04:48 +00:00
# Setting includes
if [ -z "${LIVE_INCLUDES}" ]
then
LIVE_INCLUDES="/usr/share/live-helper/includes"
fi
2007-09-23 08:04:46 +00:00
# Setting templates
if [ -z "${LIVE_TEMPLATES}" ]
then
LIVE_TEMPLATES="/usr/share/live-helper/templates"
fi
}