live-build/functions/defaults.sh

873 lines
20 KiB
Bash
Raw Normal View History

2007-09-23 08:04:46 +00:00
#!/bin/sh
# defaults.sh - handle default values
# Copyright (C) 2006-2009 Daniel Baumann <daniel@debian.org>
2007-09-23 08:04:48 +00:00
#
# 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_defaults ()
{
## config/common
2007-09-23 08:04:49 +00:00
# Setting mode
if [ -z "${LH_MODE}" ]
then
2007-10-19 10:45:57 +00:00
LH_MODE="debian"
2007-09-23 08:04:49 +00:00
fi
2007-09-23 08:05:13 +00:00
# Setting distribution name
2007-09-23 08:05:17 +00:00
if [ -z "${LH_DISTRIBUTION}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:05:11 +00:00
case "${LH_MODE}" in
2009-02-08 09:10:07 -01:00
debian|debian-release)
2007-09-23 12:05:11 +00:00
LH_DISTRIBUTION="lenny"
;;
2008-12-08 10:24:11 -01:00
emdebian)
LH_DISTRIBUTION="sid"
;;
2007-09-23 08:05:11 +00:00
esac
2007-09-23 08:04:46 +00:00
fi
2007-09-23 08:05:11 +00:00
# Setting package manager
if [ "${LH_DISTRIBUTION}" = "etch" ]
then
LH_APT="${LH_APT:-aptitude}"
else
LH_APT="${LH_APT:-apt}"
fi
2007-09-23 08:05:11 +00:00
2007-09-23 08:04:46 +00:00
# Setting apt ftp proxy
2007-09-23 08:05:17 +00:00
if [ -z "${LH_APT_FTP_PROXY}" ] && [ -n "${ftp_proxy}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:05:17 +00:00
LH_APT_FTP_PROXY="${ftp_proxy}"
2007-09-23 08:04:46 +00:00
else
2007-09-23 08:05:17 +00:00
if [ -n "${LH_APT_FTP_PROXY}" ] && [ "${LH_APT_FTP_PROXY}" != "${ftp_proxy}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:05:17 +00:00
ftp_proxy="${LH_APT_FTP_PROXY}"
2007-09-23 08:04:46 +00:00
fi
fi
# Setting apt http proxy
2007-09-23 08:05:17 +00:00
if [ -z "${LH_APT_HTTP_PROXY}" ] && [ -n "${http_proxy}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:05:17 +00:00
LH_APT_HTTP_PROXY="${http_proxy}"
2007-09-23 08:04:46 +00:00
else
2007-09-23 08:05:17 +00:00
if [ -n "${LH_APT_HTTP_PROXY}" ] && [ "${LH_APT_HTT_PROXY}" != "${http_proxy}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:05:17 +00:00
http_proxy="${LH_APT_HTTP_PROXY}"
2007-09-23 08:04:46 +00:00
fi
fi
# Setting apt pdiffs
2007-09-23 08:05:11 +00:00
LH_APT_PDIFFS="${LH_APT_PDIFFS:-enabled}"
# Setting apt pipeline
# LH_APT_PIPELINE
2007-09-23 08:04:46 +00:00
APT_OPTIONS="${APT_OPTIONS:---yes}"
APTITUDE_OPTIONS="${APTITUDE_OPTIONS:---assume-yes}"
2007-09-23 08:04:46 +00:00
# Setting apt recommends
2007-09-23 08:05:17 +00:00
case "${LH_MODE}" in
2009-02-08 09:10:07 -01:00
debian|debian-release)
2007-09-23 08:05:17 +00:00
LH_APT_RECOMMENDS="${LH_APT_RECOMMENDS:-enabled}"
;;
2008-12-08 10:24:11 -01:00
emdebian)
LH_APT_RECOMMENDS="${LH_APT_RECOMMENDS:-disabled}"
;;
2007-09-23 08:05:17 +00:00
esac
2007-09-23 08:04:46 +00:00
2007-09-23 08:04:48 +00:00
# Setting apt secure
2007-09-23 08:05:11 +00:00
LH_APT_SECURE="${LH_APT_SECURE:-enabled}"
2007-09-23 08:04:48 +00:00
2007-09-23 08:04:46 +00:00
# Setting bootstrap program
if [ -z "${LH_BOOTSTRAP}" ] || ( [ ! -x "${LH_BOOTSTRAP}" ] && [ "${LH_BOOTSTRAP}" != "copy" ] )
2007-09-23 08:04:46 +00:00
then
2007-10-19 10:45:57 +00:00
if [ -x "/usr/sbin/debootstrap" ]
then
LH_BOOTSTRAP="debootstrap"
elif [ -x "/usr/bin/cdebootstrap" ]
then
LH_BOOTSTRAP="cdebootstrap"
else
Echo_error "Cannot find /usr/sbin/debootstrap or /usr/bin/cdebootstrap. Please install debootstrap or cdebootstrap, or specify an alternative bootstrapping utility."
2007-10-19 10:45:57 +00:00
exit 1
fi
2007-09-23 08:04:46 +00:00
fi
# Setting cache option
2007-09-23 08:05:17 +00:00
LH_CACHE="${LH_CACHE:-enabled}"
2007-09-23 08:05:11 +00:00
LH_CACHE_INDICES="${LH_CACHE_INDICES:-disabled}"
LH_CACHE_PACKAGES="${LH_CACHE_PACKAGES:-enabled}"
LH_CACHE_STAGES="${LH_CACHE_STAGES:-bootstrap}"
2007-09-23 08:04:46 +00:00
# Setting debconf frontend
2007-09-23 08:05:11 +00:00
LH_DEBCONF_FRONTEND="${LH_DEBCONF_FRONTEND:-noninteractive}"
LH_DEBCONF_NOWARNINGS="${LH_DEBCONF_NOWARNINGS:-yes}"
LH_DEBCONF_PRIORITY="${LH_DEBCONF_PRIORITY:-critical}"
2007-09-23 08:04:50 +00:00
2007-09-23 08:05:14 +00:00
case "${LH_DEBCONF_NOWARNINGS}" in
enabled)
LH_DEBCONF_NOWARNINGS="yes"
;;
disabled)
LH_DEBCONF_NOWARNINGS="no"
;;
esac
2007-09-23 08:05:10 +00:00
# Setting initramfs hook
if [ -z "${LH_INITRAMFS}" ]
then
2007-09-23 08:05:17 +00:00
LH_INITRAMFS="auto"
else
if [ "${LH_INITRAMFS}" = "auto" ]
2007-09-23 08:05:10 +00:00
then
2007-09-23 08:05:17 +00:00
case "${LH_MODE}" in
2009-02-08 09:10:07 -01:00
debian|debian-release)
2007-09-23 08:05:17 +00:00
if [ "${LH_DISTRIBUTION}" = "etch" ]
then
LH_INITRAMFS="casper"
else
LH_INITRAMFS="live-initramfs"
fi
;;
2008-12-08 10:24:11 -01:00
*)
LH_INITRAMFS="live-initramfs"
;;
2007-09-23 08:05:17 +00:00
esac
2007-09-23 08:05:10 +00:00
fi
fi
# Setting fdisk
if [ -z "${LH_FDISK}" ] || [ ! -x "${LH_FDISK}" ]
then
# Workaround for gnu-fdisk divertion
# (gnu-fdisk is buggy, #445304).
if [ -x /sbin/fdisk.distrib ]
then
LH_FDISK="fdisk.distrib"
elif [ -x /sbin/fdisk ]
then
LH_FDISK="fdisk"
else
Echo_error "Can't process file /sbin/fdisk"
fi
fi
2007-09-23 08:04:47 +00:00
# Setting losetup
if [ -z "${LH_LOSETUP}" ] || [ "${LH_LOSETUP}" != "/sbin/losetup.orig" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:05:10 +00:00
# Workaround for loop-aes-utils divertion
# (loop-aes-utils' losetup lacks features).
2007-09-23 08:04:47 +00:00
if [ -x /sbin/losetup.orig ]
then
LH_LOSETUP="losetup.orig"
elif [ -x /sbin/losetup ]
then
LH_LOSETUP="losetup"
else
Echo_error "Can't process file /sbin/losetup"
2007-09-23 08:04:47 +00:00
fi
2007-09-23 08:04:46 +00:00
fi
if [ "$(id -u)" = "0" ]
2007-09-23 08:04:51 +00:00
then
2007-09-23 08:05:11 +00:00
# If we are root, disable root command
2007-09-23 08:05:17 +00:00
LH_ROOT_COMMAND=""
2007-09-23 08:05:11 +00:00
else
if [ -x /usr/bin/sudo ]
then
# FIXME: this is disabled until considered safe
2007-09-23 08:05:17 +00:00
#LH_ROOT_COMMAND="sudo"
LH_ROOT_COMMAND=""
2007-09-23 08:05:11 +00:00
fi
2007-09-23 08:04:51 +00:00
fi
2007-09-23 08:05:10 +00:00
# Setting tasksel
LH_TASKSEL="${LH_TASKSEL:-tasksel}"
2007-09-23 08:04:52 +00:00
2007-09-23 08:04:47 +00:00
# Setting root directory
2007-09-23 08:05:17 +00:00
if [ -z "${LH_ROOT}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:49 +00:00
case "${LH_MODE}" in
2009-02-08 09:10:07 -01:00
debian|debian-release)
2007-09-23 08:05:17 +00:00
LH_ROOT="debian-live"
;;
2008-12-08 10:24:11 -01:00
emdebian)
LH_ROOT="emdebian-live"
;;
2007-09-23 08:04:49 +00:00
esac
fi
2007-09-23 08:04:52 +00:00
# Setting includes
2007-09-23 08:05:17 +00:00
if [ -z "${LH_INCLUDES}" ]
2007-09-23 08:04:52 +00:00
then
2007-09-23 08:05:17 +00:00
LH_INCLUDES="${LH_BASE:-/usr/share/live-helper}/includes"
2007-09-23 08:04:52 +00:00
fi
# Setting templates
2007-09-23 08:05:17 +00:00
if [ -z "${LH_TEMPLATES}" ]
2007-09-23 08:04:52 +00:00
then
2007-09-23 08:05:17 +00:00
LH_TEMPLATES="${LH_BASE:-/usr/share/live-helper}/templates"
2007-09-23 08:04:52 +00:00
fi
2007-09-23 08:04:49 +00:00
# Setting live helper options
_BREAKPOINTS="${_BREAKPOINTS:-disabled}"
_COLOR="${_COLOR:-false}"
_DEBUG="${_DEBUG:-disabled}"
_FORCE="${_FORCE:-disabled}"
_QUIET="${_QUIET:-disabled}"
_VERBOSE="${_VERBOSE:-disabled}"
2007-09-23 08:04:46 +00:00
## config/bootstrap
2007-09-23 08:04:47 +00:00
# Setting architecture value
2007-09-23 08:05:17 +00:00
if [ -z "${LH_ARCHITECTURE}" ]
2007-09-23 08:04:46 +00:00
then
if [ -x "/usr/bin/dpkg" ]
then
LH_ARCHITECTURE="$(dpkg --print-architecture)"
2007-09-23 08:04:46 +00:00
else
2008-08-31 22:46:38 +00:00
case "$(uname -m)" in
sparc|powerpc)
LH_ARCHITECTURE="$(uname -m)"
;;
x86_64)
LH_ARCHITECTURE="amd64"
;;
*)
Echo_warning "Can't determine architecture, assuming i386"
LH_ARCHITECTURE="i386"
;;
esac
2007-09-23 08:04:46 +00:00
fi
fi
# Include packages on base
# LH_BOOTSTRAP_INCLUDE
# Exclude packages on base
# LH_BOOTSTRAP_EXCLUDE
2007-09-23 08:04:47 +00:00
# Setting distribution configuration value
2007-09-23 08:05:17 +00:00
# LH_BOOTSTRAP_CONFIG
2007-09-23 08:04:46 +00:00
2007-09-23 08:04:47 +00:00
# Setting flavour value
case "${LH_BOOTSTRAP}" in
cdebootstrap)
LH_BOOTSTRAP_FLAVOUR="${LH_BOOTSTRAP_FLAVOUR:-standard}"
;;
esac
2007-09-23 08:05:11 +00:00
# Setting bootstrap keyring
2007-09-23 08:05:17 +00:00
# LH_BOOTSTRAP_KEYRING
2007-09-23 08:04:46 +00:00
2007-09-23 08:04:48 +00:00
# Setting mirror to fetch packages from
2007-09-23 08:05:17 +00:00
if [ -z "${LH_MIRROR_BOOTSTRAP}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:49 +00:00
case "${LH_MODE}" in
2009-02-08 09:10:07 -01:00
debian|debian-release)
2007-09-23 08:05:17 +00:00
case "${LH_ARCHITECTURE}" in
2007-09-23 08:05:14 +00:00
amd64|i386)
LH_MIRROR_BOOTSTRAP="http://ftp.us.debian.org/debian/"
2007-09-23 08:05:14 +00:00
;;
*)
2007-09-23 08:05:17 +00:00
LH_MIRROR_BOOTSTRAP="http://ftp.de.debian.org/debian/"
2007-09-23 08:05:14 +00:00
;;
esac
2007-09-23 08:04:49 +00:00
;;
2008-12-08 10:24:11 -01:00
emdebian)
LH_MIRROR_BOOTSTRAP="http://buildd.emdebian.org/grip/"
;;
2007-09-23 08:04:49 +00:00
esac
2007-09-23 08:04:46 +00:00
fi
LH_MIRROR_CHROOT="${LH_MIRROR_CHROOT:-${LH_MIRROR_BOOTSTRAP}}"
2007-09-23 08:04:48 +00:00
# Setting security mirror to fetch packages from
if [ -z "${LH_MIRROR_CHROOT_SECURITY}" ]
2007-09-23 08:04:46 +00:00
then
2008-12-08 10:24:11 -01:00
case "${LH_MODE}" in
2009-02-08 09:10:07 -01:00
debian|debian-release)
2008-12-08 10:24:11 -01:00
LH_MIRROR_CHROOT_SECURITY="http://security.debian.org/"
;;
emdebian)
LH_MIRROR_CHROOT_SECURITY="none"
;;
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
2007-09-23 08:05:17 +00:00
if [ -z "${LH_MIRROR_BINARY}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:49 +00:00
case "${LH_MODE}" in
2009-02-08 09:10:07 -01:00
debian|debian-release)
2007-09-23 08:05:17 +00:00
case "${LH_ARCHITECTURE}" in
2007-09-23 08:05:14 +00:00
amd64|i386)
LH_MIRROR_BINARY="http://ftp.us.debian.org/debian/"
2007-09-23 08:05:14 +00:00
;;
*)
2007-09-23 08:05:17 +00:00
LH_MIRROR_BINARY="http://ftp.de.debian.org/debian/"
2007-09-23 08:05:14 +00:00
;;
esac
2007-09-23 08:04:49 +00:00
;;
2008-12-08 10:24:11 -01:00
emdebian)
LH_MIRROR_BINARY="http://buildd.emdebian.org/grip/"
;;
2007-09-23 08:04:49 +00:00
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
2007-09-23 08:05:17 +00:00
if [ -z "${LH_MIRROR_BINARY_SECURITY}" ]
2007-09-23 08:04:46 +00:00
then
2008-12-08 10:24:11 -01:00
case "${LH_MODE}" in
2009-02-08 09:10:07 -01:00
debian|debian-release)
2008-12-08 10:24:11 -01:00
LH_MIRROR_BINARY_SECURITY="http://security.debian.org/"
;;
emdebian)
LH_MIRROR_BINARY_SECURITY="none"
;;
esac
2007-09-23 08:04:46 +00:00
fi
# Setting categories value
if [ -z "${LH_CATEGORIES}" ]
2007-09-23 08:04:46 +00:00
then
LH_CATEGORIES="main"
2007-09-23 08:04:46 +00:00
fi
## config/chroot
2007-09-23 08:05:10 +00:00
# Setting chroot filesystem
2007-09-23 08:05:17 +00:00
LH_CHROOT_FILESYSTEM="${LH_CHROOT_FILESYSTEM:-squashfs}"
2007-09-23 08:05:10 +00:00
# Setting whether to expose root filesystem as read only
LH_EXPOSED_ROOT="${LH_EXPOSED_ROOT:-disabled}"
2007-09-23 08:05:13 +00:00
# Setting union filesystem
if [ -z "${LH_UNION_FILESYSTEM}" ]
then
if [ "${LH_DISTRIBUTION}" = "etch" ]
then
LH_UNION_FILESYSTEM="unionfs"
else
LH_UNION_FILESYSTEM="aufs"
fi
fi
2007-09-23 08:05:13 +00:00
2007-09-23 08:05:17 +00:00
# LH_HOOKS
2007-09-23 08:05:10 +00:00
2007-09-23 08:04:48 +00:00
# Setting interactive shell/X11/Xnest
2007-09-23 08:05:17 +00:00
LH_INTERACTIVE="${LH_INTERACTIVE:-disabled}"
2007-09-23 08:04:48 +00:00
2007-09-23 08:05:10 +00:00
# Setting keyring packages
2007-09-23 08:05:17 +00:00
case "${LH_MODE}" in
2009-02-08 09:10:07 -01:00
debian|debian-release)
LH_KEYRING_PACKAGES="debian-archive-keyring"
2007-09-23 08:05:17 +00:00
;;
2008-12-08 10:24:11 -01:00
emdebian)
LH_KEYRING_PACKAGES="debian-archive-keyring"
;;
2007-09-23 08:05:17 +00:00
esac
2007-09-23 08:05:10 +00:00
# Setting language string
2007-09-23 12:05:09 +00:00
LH_LANGUAGE="${LH_LANGUAGE:-en}"
2007-09-23 08:05:10 +00:00
# Setting linux flavour string
2007-09-23 08:05:17 +00:00
if [ -z "${LH_LINUX_FLAVOURS}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:05:17 +00:00
case "${LH_ARCHITECTURE}" in
2007-09-23 08:04:46 +00:00
alpha)
2007-09-23 08:05:17 +00:00
LH_LINUX_FLAVOURS="alpha-generic"
2007-09-23 08:04:46 +00:00
;;
amd64)
2007-10-19 10:45:57 +00:00
LH_LINUX_FLAVOURS="amd64"
2007-09-23 08:04:46 +00:00
;;
hppa)
2007-09-23 08:05:17 +00:00
LH_LINUX_FLAVOURS="parisc"
2007-09-23 08:04:46 +00:00
;;
i386)
case "${LIST}" in
stripped|minimal)
LH_LINUX_FLAVOURS="486"
;;
*)
LH_LINUX_FLAVOURS="486 686"
;;
esac
2007-09-23 08:04:46 +00:00
;;
ia64)
2007-09-23 08:05:17 +00:00
LH_LINUX_FLAVOURS="itanium"
2007-09-23 08:04:46 +00:00
;;
powerpc)
case "${LIST}" in
stripped|minimal)
LH_LINUX_FLAVOURS="powerpc"
;;
*)
LH_LINUX_FLAVOURS="powerpc powerpc64"
;;
esac
2007-09-23 08:04:46 +00:00
;;
s390)
2007-09-23 08:05:17 +00:00
LH_LINUX_FLAVOURS="s390"
2007-09-23 08:04:46 +00:00
;;
sparc)
2007-10-19 10:45:57 +00:00
if [ "${LH_DISTRIBUTION}" = "etch" ]
then
LH_LINUX_FLAVOURS="sparc32"
else
LH_LINUX_FLAVOURS="sparc64"
fi
2007-09-23 08:04:46 +00:00
;;
arm|armel|m68k)
Echo_error "You need to specify the linux kernel flavour manually on ${LH_ARCHITECTURE} (FIXME)."
exit 1
;;
2007-09-23 08:04:46 +00:00
*)
Echo_error "Architecture not yet supported (FIXME)"
2007-09-23 08:04:46 +00:00
;;
esac
fi
2007-09-23 08:05:10 +00:00
# Set linux packages
2007-09-23 08:05:17 +00:00
if [ -z "${LH_LINUX_PACKAGES}" ]
2007-09-23 08:04:46 +00:00
then
2007-10-19 10:45:57 +00:00
LH_LINUX_PACKAGES="linux-image-2.6 \${LH_UNION_FILESYSTEM}-modules-2.6"
2007-09-23 08:04:49 +00:00
2007-10-19 10:45:57 +00:00
if [ "${LH_CHROOT_FILESYSTEM}" = "squashfs" ]
then
LH_LINUX_PACKAGES="${LH_LINUX_PACKAGES} squashfs-modules-2.6"
fi
2007-09-23 08:04:46 +00:00
case "${LH_ENCRYPTION}" in
""|disabled)
;;
*)
LH_LINUX_PACKAGES="${LH_LINUX_PACKAGES} loop-aes-modules-2.6"
;;
esac
2007-09-23 08:04:46 +00:00
fi
# Setting packages string
2007-09-23 08:05:17 +00:00
# LH_PACKAGES
case "${LH_ENCRYPTION}" in
""|disabled)
;;
*)
if ! In_list loop-aes-utils "${LH_PACKAGES}"
then
LH_PACKAGES="${LH_PACKAGES} loop-aes-utils"
fi
;;
esac
2007-09-23 08:04:46 +00:00
# Setting packages list string
2007-09-23 08:05:17 +00:00
LH_PACKAGES_LISTS="${LH_PACKAGES_LISTS:-standard}"
2007-09-23 08:04:46 +00:00
# Setting tasks string
2007-09-23 08:05:17 +00:00
for LIST in ${LH_PACKAGES_LISTS}
2007-09-23 08:04:46 +00:00
do
case "${LIST}" in
stripped|minimal)
2007-09-23 08:04:50 +00:00
LH_APT="apt-get"
;;
2007-09-23 08:04:46 +00:00
gnome-desktop)
LH_PACKAGES_LISTS="$(echo ${LH_PACKAGES_LISTS} | sed -e 's|gnome-desktop||') standard-x11"
LH_TASKS="$(echo ${LH_TASKS} | sed -e 's|standard||' -e 's|gnome-desktop||' -e 's|desktop||') standard gnome-desktop desktop"
2007-09-23 08:04:46 +00:00
;;
kde-desktop)
LH_PACKAGES_LISTS="$(echo ${LH_PACKAGES_LISTS} | sed -e 's|kde-desktop||') standard-x11"
LH_TASKS="$(echo ${LH_TASKS} | sed -e 's|standard||' -e 's|kde-desktop||' -e 's|desktop||') standard kde-desktop desktop"
2007-09-23 08:04:46 +00:00
;;
2008-11-30 09:37:06 -01:00
lxde-desktop)
LH_PACKAGES_LISTS="$(echo ${LH_PACKAGES_LISTS} | sed -e 's|lxde-desktop||') standard-x11"
LH_TASKS="$(echo ${LH_TASKS} | sed -e 's|standard||' -e 's|lxde-desktop||' -e 's|desktop||') standard lxde-desktop desktop"
2008-11-30 09:37:06 -01:00
;;
2007-09-23 08:04:46 +00:00
xfce-desktop)
LH_PACKAGES_LISTS="$(echo ${LH_PACKAGES_LISTS} | sed -e 's|xfce-desktop||') standard-x11"
LH_TASKS="$(echo ${LH_TASKS} | sed -e 's|standard||' -e 's|xfce-desktop||' -e 's|desktop||') standard xfce-desktop desktop"
2007-09-23 08:04:46 +00:00
;;
esac
done
LH_PACKAGES_LISTS="$(echo ${LH_PACKAGES_LISTS} | sed -e 's| ||g')"
LH_TASKS="$(echo ${LH_TASKS} | sed -e 's| ||g')"
2007-09-23 08:04:48 +00:00
2007-09-23 08:05:10 +00:00
# Setting tasks
2007-09-23 08:05:17 +00:00
# LH_TASKS
2007-09-23 08:04:50 +00:00
2007-09-23 08:04:46 +00:00
# Setting security updates option
if [ "${LH_MIRROR_CHROOT_SECURITY}" = "none" ] || [ "${LH_MIRROR_BINARY_SECURITY}" = "none" ]
2007-09-23 08:05:14 +00:00
then
2007-09-23 08:05:17 +00:00
LH_SECURITY="disabled"
2007-09-23 08:05:14 +00:00
fi
2007-09-23 08:05:17 +00:00
LH_SECURITY="${LH_SECURITY:-enabled}"
2007-09-23 08:04:46 +00:00
# Setting symlink convertion option
2007-09-23 08:05:17 +00:00
LH_SYMLINKS="${LH_SYMLINKS:-disabled}"
2007-09-23 08:04:46 +00:00
# Setting sysvinit option
2007-09-23 08:05:17 +00:00
LH_SYSVINIT="${LH_SYSVINIT:-disabled}"
2007-09-23 08:04:46 +00:00
2007-09-23 08:05:10 +00:00
## config/binary
# Setting image filesystem
case "${LH_ARCHITECTURE}" in
sparc)
LH_BINARY_FILESYSTEM="${LH_BINARY_FILESYSTEM:-ext2}"
;;
*)
LH_BINARY_FILESYSTEM="${LH_BINARY_FILESYSTEM:-fat16}"
;;
esac
2007-09-23 08:05:10 +00:00
# Setting image type
2007-09-23 08:05:17 +00:00
LH_BINARY_IMAGES="${LH_BINARY_IMAGES:-iso}"
2007-09-23 08:05:10 +00:00
# Setting apt indices
if echo ${LH_PACKAGES_LISTS} | grep -qs -E "(stripped|minimal)\b"
then
LH_BINARY_INDICES="${LH_BINARY_INDICES:-none}"
else
LH_BINARY_INDICES="${LH_BINARY_INDICES:-enabled}"
fi
2007-09-23 08:04:46 +00:00
2007-09-23 08:05:10 +00:00
# Setting bootloader
2007-09-23 08:05:17 +00:00
if [ -z "${LH_BOOTLOADER}" ]
2007-09-23 08:05:10 +00:00
then
2007-09-23 08:05:17 +00:00
case "${LH_ARCHITECTURE}" in
2007-09-23 08:05:10 +00:00
amd64|i386)
2007-09-23 08:05:17 +00:00
LH_BOOTLOADER="syslinux"
2007-09-23 08:05:10 +00:00
;;
2007-09-23 08:04:46 +00:00
2007-09-23 08:05:10 +00:00
powerpc)
2007-09-23 08:05:17 +00:00
LH_BOOTLOADER="yaboot"
2007-09-23 08:05:10 +00:00
;;
sparc)
LH_BOOTLOADER="silo"
;;
2007-09-23 08:05:10 +00:00
esac
fi
# Setting checksums
LH_CHECKSUMS="${LH_CHECKSUMS:-enabled}"
2007-09-23 08:05:15 +00:00
# Setting chroot option
2007-09-23 08:05:17 +00:00
LH_CHROOT_BUILD="${LH_CHROOT_BUILD:-enabled}"
2007-09-23 08:05:15 +00:00
2007-09-23 08:05:10 +00:00
# Setting debian-installer option
2007-09-23 08:05:17 +00:00
LH_DEBIAN_INSTALLER="${LH_DEBIAN_INSTALLER:-disabled}"
2007-09-23 08:04:48 +00:00
# Setting debian-installer distribution
LH_DEBIAN_INSTALLER_DISTRIBUTION="${LH_DEBIAN_INSTALLER_DISTRIBUTION:-${LH_DISTRIBUTION}}"
# Setting debian-installer preseed filename
if [ -z "${LH_DEBIAN_INSTALLER_PRESEEDFILE}" ]
then
if Find_files config/binary_debian-installer/preseed.cfg
then
LH_DEBIAN_INSTALLER_PRESEEDFILE="/preseed.cfg"
fi
if Find_files config/binary_debian-installer/*.cfg && [ ! -e config/binary_debian-installer/preseed.cfg ]
then
Echo_warning "You have placed some preseeding files into config/binary_debian-installer but you didn't specify the default preseeding file through LH_DEBIAN_INSTALLER_PRESEEDFILE. This means that debian-installer will not take up a preseeding file by default."
fi
fi
# Setting boot parameters
# LH_BOOTAPPEND_LIVE
if [ -n "${LH_DEBIAN_INSTALLER_PRESEEDFILE}" ]
then
case "${LH_BINARY_IMAGES}" in
iso)
_LH_BOOTAPPEND_PRESEED="file=/cdrom/install/${LH_DEBIAN_INSTALLER_PRESEEDFILE}"
;;
usb-hdd)
_LH_BOOTAPPEND_PRESEED="file=/hd-media/install/${LH_DEBIAN_INSTALLER_PRESEEDFILE}"
;;
net)
2008-08-12 20:21:40 +00:00
case "${LH_DEBIAN_INSTALLER_PRESEEDFILE}" in
*://*)
_LH_BOOTAPPEND_PRESEED="file=${LH_DEBIAN_INSTALLER_PRESEEDFILE}"
2008-08-12 20:21:40 +00:00
;;
*)
_LH_BOOTAPPEND_PRESEED="file=/${LH_DEBIAN_INSTALLER_PRESEEDFILE}"
2008-08-12 20:21:40 +00:00
;;
esac
;;
esac
fi
if [ -z "${LH_BOOTAPPEND_INSTALL}" ]
then
if [ -n ${_LH_BOOTAPPEND_PRESEED} ]
then
LH_BOOTAPPEND_INSTALL="${_LH_BOOTAPPEND_PRESEED} -- \${LH_BOOTAPPEND_LIVE}"
else
LH_BOOTAPPEND_INSTALL=" -- \${LH_BOOTAPPEND_LIVE}"
fi
fi
2007-09-23 08:05:10 +00:00
# Setting encryption
LH_ENCRYPTION="${LH_ENCRYPTION:-disabled}"
2007-09-23 08:05:10 +00:00
# Setting grub splash
2007-09-23 08:05:17 +00:00
# LH_GRUB_SPLASH
2007-09-23 08:05:10 +00:00
2007-09-23 08:04:48 +00:00
# Setting hostname
2007-09-23 08:05:17 +00:00
if [ -z "${LH_HOSTNAME}" ]
2007-09-23 08:04:48 +00:00
then
2007-10-19 10:45:57 +00:00
LH_HOSTNAME="debian"
2007-09-23 08:04:48 +00:00
fi
2007-09-23 08:05:10 +00:00
# Setting iso author
2007-09-23 08:05:17 +00:00
if [ -z "${LH_ISO_APPLICATION}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:05:10 +00:00
case "${LH_MODE}" in
2009-02-08 09:10:07 -01:00
debian|debian-release)
2007-09-23 08:05:17 +00:00
LH_ISO_APPLICATION="Debian Live"
;;
2008-12-08 10:24:11 -01:00
emdebian)
LH_ISO_APPLICATION="Emdebian Live"
;;
2007-09-23 08:05:10 +00:00
esac
2007-09-23 08:04:46 +00:00
fi
2007-09-23 08:05:10 +00:00
# Set iso preparer
LH_ISO_PREPARER="${LH_ISO_PREPARER:-live-helper \$VERSION; http://packages.qa.debian.org/live-helper}"
2007-09-23 08:04:46 +00:00
2007-09-23 08:05:10 +00:00
# Set iso publisher
LH_ISO_PUBLISHER="${LH_ISO_PUBLISHER:-Debian Live project; http://debian-live.alioth.debian.org/; debian-live@lists.debian.org}"
2007-09-23 08:04:52 +00:00
2007-09-23 08:04:46 +00:00
# Setting iso volume
2007-09-23 08:05:17 +00:00
if [ -z "${LH_ISO_VOLUME}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:49 +00:00
case "${LH_MODE}" in
debian)
LH_ISO_VOLUME="Debian ${LH_DISTRIBUTION} \$(date +%Y%m%d-%H:%M)"
2007-09-23 08:05:17 +00:00
;;
2008-12-08 10:24:11 -01:00
debian-release)
eval VERSION="$`echo RELEASE_${LH_DISTRIBUTION}`"
2009-02-08 09:22:58 -01:00
LH_ISO_VOLUME="Debian ${VERSION} ${LH_ARCHITECTURE} live"
;;
2008-12-08 10:24:11 -01:00
emdebian)
LH_ISO_VOLUME="Emdebian ${LH_DISTRIBUTION} \$(date +%Y%m%d-%H:%M)"
2008-12-08 10:24:11 -01:00
;;
2007-09-23 08:04:49 +00:00
esac
2007-09-23 08:04:46 +00:00
fi
2007-09-23 08:05:10 +00:00
# Setting memtest option
2007-09-23 08:05:17 +00:00
LH_MEMTEST="${LH_MEMTEST:-memtest86+}"
2007-09-23 08:04:46 +00:00
# Setting win32-loader option
case "${LH_ARCHITECTURE}" in
amd64|i386)
if [ "${LH_DEBIAN_INSTALLER}" != "disabled" ]
then
LH_WIN32_LOADER="${LH_WIN32_LOADER:-enabled}"
else
LH_WIN32_LOADER="${LH_WIN32_LOADER:-disabled}"
fi
;;
*)
LH_WIN32_LOADER="${LH_WIN32_LOADER:-disabled}"
;;
esac
2007-09-23 08:05:14 +00:00
# Setting netboot filesystem
LH_NET_ROOT_FILESYSTEM="${LH_NET_ROOT_FILESYSTEM:-nfs}"
2007-09-23 08:05:14 +00:00
2007-09-23 08:04:46 +00:00
# Setting netboot server path
if [ -z "${LH_NET_ROOT_PATH}" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:49 +00:00
case "${LH_MODE}" in
2009-02-08 09:10:07 -01:00
debian|debian-release)
LH_NET_ROOT_PATH="/srv/debian-live"
2007-09-23 08:05:17 +00:00
;;
2008-12-08 10:24:11 -01:00
emdebian)
LH_NET_ROOT_PATH="/srv/emdebian-live"
;;
2007-09-23 08:04:49 +00:00
esac
2007-09-23 08:04:46 +00:00
fi
2007-09-23 08:05:10 +00:00
# Setting netboot server address
LH_NET_ROOT_SERVER="${LH_NET_ROOT_SERVER:-192.168.1.1}"
# Setting net cow filesystem
LH_NET_COW_FILESYSTEM="${LH_NET_COW_FILESYSTEM:-nfs}"
2007-09-23 08:05:10 +00:00
# Setting net tarball
LH_NET_TARBALL="${LH_NET_TARBALL:-gzip}"
# Setting syslinux configuration file
# LH_SYSLINUX_CFG
2007-09-23 08:05:10 +00:00
# Setting syslinux splash
2007-09-23 08:05:17 +00:00
# LH_SYSLINUX_SPLASH
LH_SYSLINUX_TIMEOUT="${LH_SYSLINUX_TIMEOUT:-0}"
2007-09-23 08:05:10 +00:00
# Setting syslinux menu
2009-02-14 09:07:17 -01:00
case "${LH_DISTRIBUTION}" in
etch)
LH_SYSLINUX_MENU="${LH_SYSLINUX_MENU:-disabled}"
;;
*)
LH_SYSLINUX_MENU="${LH_SYSLINUX_MENU:-enabled}"
;;
esac
# Setting syslinux menu live entries
2009-02-14 09:07:17 -01:00
case "${LH_MODE}" in
debian|debian-release)
LH_SYSLINUX_MENU_LIVE_ENTRY="${LH_SYSLINUX_MENU_LIVE_ENTRY:-Live}"
LH_SYSLINUX_MENU_LIVE_ENTRY_FAILSAFE="${LH_SYSLINUX_MENU_LIVE_ENTRY_FAILSAFE:-${LH_SYSLINUX_MENU_LIVE_ENTRY} (failsafe)}"
;;
*)
LH_SYSLINUX_MENU_LIVE_ENTRY="${LH_SYSLINUX_MENU_LIVE_ENTRY:-Start ${LH_ISO_APPLICATION}}"
LH_SYSLINUX_MENU_LIVE_ENTRY_FAILSAFE="${LH_SYSLINUX_MENU_LIVE_ENTRY_FAILSAFE:-${LH_SYSLINUX_MENU_LIVE_ENTRY} (failsafe)}"
;;
esac
# Settings memtest menu entry
LH_SYSLINUX_MENU_MEMTEST_ENTRY="${LH_SYSLINUX_MENU_MEMTEST_ENTRY:-Memory test}"
2007-09-23 08:05:10 +00:00
# Setting username
2007-09-23 08:05:17 +00:00
LH_USERNAME="${LH_USERNAME:-user}"
2007-09-23 08:05:10 +00:00
## config/source
2007-09-23 08:04:46 +00:00
# Setting source option
2007-09-23 08:05:17 +00:00
LH_SOURCE="${LH_SOURCE:-disabled}"
2007-09-23 08:04:46 +00:00
2007-09-23 08:05:10 +00:00
# Setting image type
2007-09-23 08:05:17 +00:00
LH_SOURCE_IMAGES="${LH_SOURCE_IMAGES:-tar}"
# Setting fakeroot/fakechroot
LH_USE_FAKEROOT="${LH_USE_FAKEROOT:-disabled}"
2007-09-23 08:04:46 +00:00
}
Check_defaults ()
{
if [ "${LH_DISTRIBUTION}" = "etch" ]
then
# etch + live-initramfs
if [ "${LH_INITRAMFS}" = "live-initramfs" ]
then
Echo_warning "You selected LH_DISTRIBUTION='etch' and LH_INITRAMFS='live-initramfs' This is a possible unsafe configuration as live-initramfs is not part of the etch distribution. Either make sure that live-initramfs is installable (e.g. through setting up etch-backports repository as third-party source or putting a valid live-initramfs deb into config/chroot_local-packages) or switch change your config to etch default (casper)."
fi
# etch + aufs
if [ "${LH_UNION_FILESYSTEM}" = "aufs" ]
then
Echo_warning "You selected LH_DISTRIBUTION='etch' and LH_UNION_FILESYSTEM='aufs' This is a possible unsafe configuration as aufs is not part of the etch distribution. Either make sure that aufs modules for your kernel are installable (e.g. through setting up etch-backports repository as third-party source or putting a valid aufs-modules deb into config/chroot_local-packages) or switch change your config to etch default (unionfs)."
2008-02-24 11:41:50 -01:00
fi
fi
if echo ${LH_PACKAGES_LISTS} | grep -qs -E "(stripped|minimal)\b"
then
# aptitude + stripped|minimal
if [ "${LH_APT}" = "aptitude" ]
then
Echo_warning "You selected LH_PACKAGES_LISTS='%s' and LH_APT='aptitude'" "${LH_PACKAGES_LIST}. This is a possible unsafe configuration as aptitude is not used in the stripped/minimal package lists."
fi
fi
if [ "${LH_DEBIAN_INSTALLER}" != "disabled" ]
then
# d-i enabled, no caching
if ! echo ${LH_CACHE_STAGES} | grep -qs "bootstrap\b" || [ "${LH_CACHE}" != "enabled" ] || [ "${LH_CACHE_PACKAGES}" != "enabled" ]
then
Echo_warning "You have selected values of LH_CACHE, LH_CACHE_PACKAGES, LH_CACHE_STAGES an dLH_DEBIAN_INSTALLER which will result in 'bootstrap' packages not being cached. This is a possible unsafe configuration as the bootstrap packages are re-used when integrating the Debian Installer."
fi
fi
if [ "${LH_BOOTLOADER}" = "syslinux" ]
then
# syslinux + fat
case "${LH_BINARY_FILESYSTEM}" in
fat*)
;;
*)
Echo_warning "You have selected values of LH_BOOTLOADER and LH_BINARY_FILESYSTEM which are incompatible - syslinux only supports FAT filesystems."
;;
esac
fi
if [ "${LH_BINARY_IMAGES}" = "usb-hdd" ]
then
# grub or yaboot + usb-hdd
case "${LH_BOOTLOADER}" in
grub|yaboot)
Echo_error "You have selected a combination of bootloader and image type that is currently not supported by live-helper. Please use either another bootloader or a different image type."
exit 1
;;
esac
fi
if [ "$(echo ${LH_ISO_APPLICATION} | wc -c)" -ge 129 ]
then
Echo_warning "You have specified a too long string for iso application, the maximum lenght is 128 characters."
fi
if [ "$(echo ${LH_ISO_PREPARER} | wc -c)" -ge 129 ]
then
Echo_warning "You have specified a too long string for iso preparer, the maximum lenght is 128 characters."
fi
if [ "$(echo ${LH_ISO_PUBLISHER} | wc -c)" -ge 129 ]
then
Echo_warning "You have specified a too long string for iso publisher, the maximum lenght is 128 characters."
fi
if [ "$(echo ${LH_ISO_VOLUME} | wc -c)" -ge 33 ]
then
Echo_warning "You have specified a too long string for iso volume, the maximum lenght is 32 characters."
fi
}