summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
Diffstat (limited to 'functions')
-rwxr-xr-xfunctions/arguments.sh75
-rwxr-xr-xfunctions/cache.sh50
-rwxr-xr-xfunctions/chroot.sh7
-rwxr-xr-xfunctions/conffile.sh6
-rwxr-xr-xfunctions/defaults.sh133
-rwxr-xr-xfunctions/help.sh32
-rwxr-xr-xfunctions/lockfile.sh5
-rwxr-xr-xfunctions/stagefile.sh16
-rwxr-xr-xfunctions/usage.sh26
-rwxr-xr-xfunctions/version.sh13
10 files changed, 289 insertions, 74 deletions
diff --git a/functions/arguments.sh b/functions/arguments.sh
new file mode 100755
index 000000000..4f60ae294
--- /dev/null
+++ b/functions/arguments.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+# arguments.sh - handle common arguments
+# 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.
+
+set -e
+
+PROGRAM="`basename ${0}`"
+
+Arguments ()
+{
+ ARGUMENTS="`getopt --longoptions force,help,usage,version --name=${PROGRAM} --options huv --shell sh -- "${@}"`"
+
+ if [ "${?}" != "0" ]
+ then
+ echo "terminating" >&2
+ exit 1
+ fi
+
+ eval set -- "${ARGUMENTS}"
+
+ while true
+ do
+ case "${1}" in
+ --conffile)
+ CONFFILE="FIXME"; shift
+ ;;
+
+ --debug)
+ DEBUG="FIXME"; shift
+ ;;
+
+ --force)
+ FORCE="true"; shift
+ ;;
+
+ -h|--help)
+ Help; shift
+ ;;
+
+ --logfile)
+ LOGFILE="FIXME"; shift
+ ;;
+
+ --quiet)
+ QUIET="FIXME"; shift
+ ;;
+
+ -u|--usage)
+ Usage; shift
+ ;;
+
+ --verbose)
+ VERBOSE="FIXME"; shift
+ ;;
+
+ -v|--version)
+ Version; shift
+ ;;
+
+ --)
+ shift; break
+ ;;
+
+ *)
+ echo "internal error"
+ exit 1
+ ;;
+ esac
+ done
+}
diff --git a/functions/cache.sh b/functions/cache.sh
new file mode 100755
index 000000000..bffe1a3d4
--- /dev/null
+++ b/functions/cache.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# cache.sh - manage package cache
+# 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.
+
+set -e
+
+Restore_cache ()
+{
+ CACHEDIRECTORY="${1}"
+
+ if [ "${LH_CACHE}" = "enabled" ]
+ then
+ if [ -d "${CACHEDIRECTORY}" ]
+ then
+ # Restore old cache
+ cp "${CACHEDIRECTORY}"/*.deb chroot/var/cache/apt/archives
+ fi
+ fi
+}
+
+Save_cache ()
+{
+ CACHEDIRECTORY="${1}"
+
+ if [ "${LH_CACHE}" = "enabled" ]
+ then
+ # Cleaning current cache
+ Chroot "apt-get autoclean"
+
+ if ls chroot/var/cache/apt/archives/*.deb &> /dev/null
+ then
+ # Creating cache directory
+ if [ ! -d "${CACHEDIRECTORY}" ]
+ then
+ mkdir -p "${CACHEDIRECTORY}"
+ fi
+
+ # Saving new cache
+ mv -f chroot/var/cache/apt/archives/*.deb "${CACHEDIRECTORY}"
+ fi
+ else
+ # Purging current cache
+ rm -f chroot/var/cache/apt/archives/*.deb
+ fi
+}
diff --git a/functions/chroot.sh b/functions/chroot.sh
index 0dc0215b8..34efa0bcd 100755
--- a/functions/chroot.sh
+++ b/functions/chroot.sh
@@ -1,6 +1,11 @@
#!/bin/sh
-# chroot.sh - chroot wrapper
+# chroot.sh - /usr/sbin/chroot wrapper script
+# 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.
set -e
diff --git a/functions/conffile.sh b/functions/conffile.sh
index 0cd8d2934..fab8dc1c4 100755
--- a/functions/conffile.sh
+++ b/functions/conffile.sh
@@ -1,6 +1,11 @@
#!/bin/sh
# conffile.sh - handle configuration files
+# 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.
set -e
@@ -13,6 +18,7 @@ Read_conffile ()
then
if [ -r "${CONFFILE}" ]
then
+ # Sourcing configurationfile
. "${CONFFILE}"
else
echo "W: failed to read ${CONFFILE}"
diff --git a/functions/defaults.sh b/functions/defaults.sh
index 9ada89eb4..4774c0739 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -1,6 +1,11 @@
#!/bin/sh
# defaults.sh - handle default values
+# 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.
set -e
@@ -54,6 +59,12 @@ Set_defaults ()
LH_APT_RECOMMENDS="enabled"
fi
+ # Setting apt secure
+ if [ -z "${LH_APT_SECURE}" ]
+ then
+ LH_APT_SECURE="enabled"
+ fi
+
# Setting bootstrap program
if [ -z "${LH_BOOTSTRAP}" ] || [ ! -x "${LH_BOOTSTRAP}" ]
then
@@ -87,18 +98,9 @@ Set_defaults ()
fi
# Setting genisoimage
- if [ -z "${LH_GENISOIMAGE}" ] || [ ! -x "${LH_GENISOIMAGE}" ]
+ if [ -z "${LH_GENISOIMAGE}" ]
then
- if [ -x /usr/bin/genisoimage ]
- then
- LH_GENISOIMAGE="genisoimage"
- elif [ -x /usr/bin/mkisofs ]
- then
- LH_GENISOIMAGE="mkisofs"
- else
- echo "E: cannot find genisoimage nor mkisofs (FIXME)."
- exit 1
- fi
+ LH_GENISOIMAGE="genisoimage"
fi
# Setting losetup
@@ -145,33 +147,33 @@ Set_defaults ()
# LIVE_DISTRIBUTION_CONFIG
# Setting flavour value
- if [ -z "${LIVE_FLAVOUR}" ]
+ if [ -z "${LIVE_BOOTSTRAP_FLAVOUR}" ]
then
- LIVE_FLAVOUR="standard"
+ LIVE_BOOTSTRAP_FLAVOUR="standard"
fi
- # Setting local mirror value
- if [ -z "${LIVE_MIRROR_LOCAL}" ]
+ # Setting mirror to fetch packages from
+ if [ -z "${LIVE_MIRROR_BUILD}" ]
then
- LIVE_MIRROR_LOCAL="http://ftp.debian.org/debian/"
+ LIVE_MIRROR_BUILD="http://ftp.debian.org/debian/"
fi
- # Setting local security mirror value
- if [ -z "${LIVE_MIRROR_LOCAL_SECURITY}" ]
+ # Setting security mirror to fetch packages from
+ if [ -z "${LIVE_MIRROR_BUILD_SECURITY}" ]
then
- LIVE_MIRROR_LOCAL_SECURITY="http://security.debian.org/"
+ LIVE_MIRROR_BUILD_SECURITY="http://security.debian.org/"
fi
- # Setting generic mirror value
- if [ -z "${LIVE_MIRROR_GENERIC}" ]
+ # Setting mirror which ends up in the image
+ if [ -z "${LIVE_MIRROR_IMAGE}" ]
then
- LIVE_MIRROR_GENERIC="http://ftp.debian.org/debian/"
+ LIVE_MIRROR_IMAGE="http://ftp.debian.org/debian/"
fi
- # Setting generic security mirror value
- if [ -z "${LIVE_MIRROR_GENERIC_SECURITY}" ]
+ # Setting security mirror which ends up in the image
+ if [ -z "${LIVE_MIRROR_IMAGE_SECURITY}" ]
then
- LIVE_MIRROR_GENERIC_SECURITY="http://security.debian.org/"
+ LIVE_MIRROR_IMAGE_SECURITY="http://security.debian.org/"
fi
# Setting sections value
@@ -182,16 +184,22 @@ Set_defaults ()
## config/chroot
+ # Setting interactive shell/X11/Xnest
+ if [ -z "${LIVE_INTERACTIVE}" ]
+ then
+ LIVE_INTERACTIVE="disabled"
+ fi
+
# Setting kernel flavour string
- if [ -z "${LIVE_KERNEL}" ]
+ if [ -z "${LIVE_KERNEL_FLAVOUR}" ]
then
case "${LIVE_ARCHITECTURE}" in
alpha)
- LIVE_KERNEL="alpha-generic"
+ LIVE_KERNEL_FLAVOUR="alpha-generic"
;;
amd64)
- LIVE_KERNEL="amd64"
+ LIVE_KERNEL_FLAVOUR="amd64"
;;
arm)
@@ -200,32 +208,32 @@ Set_defaults ()
;;
hppa)
- LIVE_KERNEL="parisc"
+ LIVE_KERNEL_FLAVOUR="parisc"
;;
i386)
- LIVE_KERNEL="486"
+ LIVE_KERNEL_FLAVOUR="486"
;;
ia64)
- LIVE_KERNEL="itanium"
+ LIVE_KERNEL_FLAVOUR="itanium"
;;
m68k)
- LIVE_KERNEL="E: You need to specify the linux kernel flavour manually on m68k."
+ LIVE_KERNEL_FLAVOUR="E: You need to specify the linux kernel flavour manually on m68k."
exit 1
;;
powerpc)
- LIVE_KERNEL="powerpc"
+ LIVE_KERNEL_FLAVOUR="powerpc"
;;
s390)
- LIVE_KERNEL="s390"
+ LIVE_KERNEL_FLAVOUR="s390"
;;
sparc)
- LIVE_KERNEL="sparc32"
+ LIVE_KERNEL_FLAVOUR="sparc32"
;;
*)
@@ -237,11 +245,11 @@ Set_defaults ()
# Set kernel packages
if [ -z "${LIVE_KERNEL_PACKAGES}" ]
then
- LIVE_KERNEL_PACKAGES="linux-image-2.6-${LIVE_KERNEL} squashfs-modules-2.6-${LIVE_KERNEL} unionfs-modules-2.6-${LIVE_KERNEL} casper"
+ LIVE_KERNEL_PACKAGES="linux-image-2.6 squashfs-modules-2.6 unionfs-modules-2.6"
if [ -n "${LIVE_ENCRYPTION}" ]
then
- LIVE_KERNEL_PACKAGES="${LIVE_KERNEL_PACKAGES} loop-aes-modules-2.6-${LIVE_KERNEL} loop-aes-utils"
+ LIVE_KERNEL_PACKAGES="${LIVE_KERNEL_PACKAGES} loop-aes-modules-2.6"
fi
fi
@@ -255,37 +263,35 @@ Set_defaults ()
# LIVE_PACKAGES
# Setting packages list string
- if [ -z "${LIVE_PACKAGES_LIST}" ]
+ if [ -z "${LIVE_PACKAGES_LISTS}" ]
then
- if [ "${LIVE_FLAVOUR}" = "mini" ] || [ "${LIVE_FLAVOUR}" = "minimal" ]
- then
- LIVE_PACKAGES_LIST="minimal"
- else
- LIVE_PACKAGES_LIST="standard"
- fi
+ LIVE_PACKAGES_LISTS="standard"
fi
# Setting tasks string
- for LIST in ${LIVE_PACKAGES_LIST}
+ for LIST in ${LIVE_PACKAGES_LISTS}
do
case "${LIST}" in
gnome-desktop)
- LIVE_PACKAGES_LIST="`echo ${LIVE_PACKAGES_LIST} | sed -e 's/gnome-desktop//'` standard-x11"
- LIVE_TASKS="${LIVE_TASKS} standard laptop desktop gnome-desktop"
+ LIVE_PACKAGES_LISTS="`echo ${LIVE_PACKAGES_LISTS} | sed -e 's/gnome-desktop//'` standard-x11"
+ LIVE_TASKS="`echo ${LIVE_TASKS} | sed -e 's/standard//' -e 's/laptop//' -e 's/desktop//' -e 's/gnome-desktop//'` standard laptop desktop gnome-desktop"
;;
kde-desktop)
- LIVE_PACKAGES_LIST="`echo ${LIVE_PACKAGES_LIST} | sed -e 's/kde-desktop//'` standard-x11"
- LIVE_TASKS="${LIVE_TASKS} standard laptop desktop kde-desktop"
+ LIVE_PACKAGES_LISTS="`echo ${LIVE_PACKAGES_LISTS} | sed -e 's/kde-desktop//'` standard-x11"
+ LIVE_TASKS="`echo ${LIVE_TASKS} | sed -e 's/standard//' -e 's/laptop//' -e 's/desktop//' -e 's/kde-desktop//'` standard laptop desktop kde-desktop"
;;
xfce-desktop)
- LIVE_PACKAGES_LIST="`echo ${LIVE_PACKAGES_LIST} | sed -e 's/xfce-desktop//'` standard-x11"
- LIVE_TASKS="${LIVE_TASKS} standard laptop desktop xfce-desktop"
+ LIVE_PACKAGES_LISTS="`echo ${LIVE_PACKAGES_LISTS} | sed -e 's/xfce-desktop//'` standard-x11"
+ LIVE_TASKS="`echo ${LIVE_TASKS} | sed -e 's/standard//' -e 's/laptop//' -e 's/desktop//' -e 's/xfce-desktop//'` standard laptop desktop xfce-desktop"
;;
esac
done
+ LIVE_PACKAGES_LISTS="`echo ${LIVE_PACKAGES_LISTS} | sed -e 's/ //g'`"
+ LIVE_TASKS="`echo ${LIVE_TASKS} | sed -e 's/ //g'`"
+
# Setting security updates option
if [ -z "${LIVE_SECURITY}" ]
then
@@ -301,12 +307,7 @@ Set_defaults ()
# Setting sysvinit option
if [ -z "${LIVE_SYSVINIT}" ]
then
- if [ "${LIVE_FLAVOUR}" = "mini" ]
- then
- LIVE_SYSVINIT="enabled"
- else
- LIVE_SYSVINIT="disabled"
- fi
+ LIVE_SYSVINIT="disabled"
fi
## config/image
@@ -317,6 +318,18 @@ Set_defaults ()
# Setting encryption
# LIVE_ENCRYPTION
+ # Setting username
+ if [ -z "${LIVE_USERNAME}" ]
+ then
+ LIVE_USERNAME="user"
+ fi
+
+ # Setting hostname
+ if [ -z "${LIVE_HOSTNAME}" ]
+ then
+ LIVE_HOSTNAME="debian"
+ fi
+
# Setting image type
if [ -z "${LIVE_BINARY_IMAGE}" ]
then
@@ -391,6 +404,12 @@ Set_defaults ()
# Setting syslinux splash
# LIVE_SYSLINUX_SPLASH
+ # Setting includes
+ if [ -z "${LIVE_INCLUDES}" ]
+ then
+ LIVE_INCLUDES="/usr/share/live-helper/includes"
+ fi
+
# Setting templates
if [ -z "${LIVE_TEMPLATES}" ]
then
diff --git a/functions/help.sh b/functions/help.sh
index 7a6311a3c..6427639e7 100755
--- a/functions/help.sh
+++ b/functions/help.sh
@@ -1,18 +1,38 @@
#!/bin/sh
-# help.sh - handle help information
+# help.sh - print help information
+# 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.
+
+set -e
Help ()
{
echo "${PROGRAM} - ${DESCRIPTION}"
echo
- echo "${USAGE}"
- echo "Usage: ${PROGRAM} [-h|--help]"
- echo "Usage: ${PROGRAM} [-u|--usage]"
- echo "Usage: ${PROGRAM} [-v|--version]"
+ echo "Usage:"
echo
- echo "${HELP}"
+
+ if [ -n "${USAGE}" ]
+ then
+ echo " ${USAGE}"
+ echo
+ fi
+
+ echo " ${PROGRAM} [-h|--help]"
+ echo " ${PROGRAM} [-u|--usage]"
+ echo " ${PROGRAM} [-v|--version]"
echo
+
+ if [ -n "${HELP}" ]
+ then
+ echo "${HELP}"
+ echo
+ fi
+
echo "Report bugs to Debian Live project <http://debian-live.alioth.debian.org/>."
exit 0
}
diff --git a/functions/lockfile.sh b/functions/lockfile.sh
index 02cf18bd5..ee01889be 100755
--- a/functions/lockfile.sh
+++ b/functions/lockfile.sh
@@ -1,6 +1,11 @@
#!/bin/sh
# lockfile.sh - handle lock files
+# 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.
set -e
diff --git a/functions/stagefile.sh b/functions/stagefile.sh
index 23c3a3429..d9d650333 100755
--- a/functions/stagefile.sh
+++ b/functions/stagefile.sh
@@ -1,6 +1,11 @@
#!/bin/sh
# stagefile.sh - handle stage files
+# 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.
set -e
@@ -12,8 +17,15 @@ Check_stagefile ()
# Checking stage file
if [ -f "${STAGEFILE}" ]
then
- echo "W: skipping ${STAGENAME}"
- exit 0
+ if [ "${FORCE}" = "true" ]
+ then
+ # Forcing execution
+ rm -f "${STAGEFILE}"
+ else
+ # Skipping execution
+ echo "W: skipping ${STAGENAME}"
+ exit 0
+ fi
fi
}
diff --git a/functions/usage.sh b/functions/usage.sh
index 7f8d69489..8f70c469c 100755
--- a/functions/usage.sh
+++ b/functions/usage.sh
@@ -1,16 +1,32 @@
#!/bin/sh
-# usage.sh - handle usage information
+# usage.sh - print usage information
+# 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.
+
+set -e
Usage ()
{
echo "${PROGRAM} - ${DESCRIPTION}"
echo
- echo "${USAGE}"
- echo "Usage: ${PROGRAM} [-h|--help]"
- echo "Usage: ${PROGRAM} [-u|--usage]"
- echo "Usage: ${PROGRAM} [-v|--version]"
+ echo "Usage:"
+ echo
+
+ if [ -n "${USAGE}" ]
+ then
+ echo " ${USAGE}"
+ echo
+ fi
+
+ echo " ${PROGRAM} [-h|--help]"
+ echo " ${PROGRAM} [-u|--usage]"
+ echo " ${PROGRAM} [-v|--version]"
echo
echo "Try \"${PROGRAM} --help\" for more information."
+
exit 1
}
diff --git a/functions/version.sh b/functions/version.sh
index ebca430a0..111d5315a 100755
--- a/functions/version.sh
+++ b/functions/version.sh
@@ -1,8 +1,15 @@
#!/bin/sh
-# version.sh - handle version information
+# version.sh - print version information
+# 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.
-VERSION="1.0~a2"
+set -e
+
+VERSION="1.0~a3"
Version ()
{
@@ -10,7 +17,6 @@ Version ()
echo "This program is a part of live-helper."
echo
echo "Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org>"
- echo "Copyright (C) 2006-2007 Marco Amadori <marco.amadori@gmail.com>"
echo
echo "This program is free software; you can redistribute it and/or modify"
echo "it under the terms of the GNU General Public License as published by"
@@ -30,5 +36,6 @@ Version ()
echo "can be found in /usr/share/common-licenses/GPL file."
echo
echo "Homepage: <http://debian-live.alioth.debian.org/>"
+
exit 0
}