summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
Diffstat (limited to 'functions')
-rwxr-xr-xfunctions/arguments.sh18
-rwxr-xr-xfunctions/breakpoints.sh8
-rwxr-xr-xfunctions/cache.sh14
-rwxr-xr-xfunctions/chroot.sh1
-rwxr-xr-xfunctions/common.sh13
-rwxr-xr-xfunctions/conffile.sh13
-rwxr-xr-xfunctions/defaults.sh36
-rwxr-xr-xfunctions/echo.sh44
-rwxr-xr-xfunctions/lockfile.sh18
-rwxr-xr-xfunctions/stagefile.sh28
-rwxr-xr-xfunctions/version.sh2
11 files changed, 121 insertions, 74 deletions
diff --git a/functions/arguments.sh b/functions/arguments.sh
index 4f60ae2..b3db8ee 100755
--- a/functions/arguments.sh
+++ b/functions/arguments.sh
@@ -9,15 +9,13 @@
set -e
-PROGRAM="`basename ${0}`"
-
Arguments ()
{
- ARGUMENTS="`getopt --longoptions force,help,usage,version --name=${PROGRAM} --options huv --shell sh -- "${@}"`"
+ ARGUMENTS="`getopt --longoptions conffile:,debug,force,help,logfile:,quiet,usage,verbose,version --name=${PROGRAM} --options huv --shell sh -- "${@}"`"
if [ "${?}" != "0" ]
then
- echo "terminating" >&2
+ Echo_error "terminating" >&2
exit 1
fi
@@ -27,11 +25,11 @@ Arguments ()
do
case "${1}" in
--conffile)
- CONFFILE="FIXME"; shift
+ CONFFILE="${2}"; shift 2
;;
--debug)
- DEBUG="FIXME"; shift
+ DEBUG="true"; shift
;;
--force)
@@ -43,11 +41,11 @@ Arguments ()
;;
--logfile)
- LOGFILE="FIXME"; shift
+ LOGFILE="${2}"; shift 2
;;
--quiet)
- QUIET="FIXME"; shift
+ QUIET="true"; shift
;;
-u|--usage)
@@ -55,7 +53,7 @@ Arguments ()
;;
--verbose)
- VERBOSE="FIXME"; shift
+ VERBOSE="true"; shift
;;
-v|--version)
@@ -67,7 +65,7 @@ Arguments ()
;;
*)
- echo "internal error"
+ Echo_error "internal error"
exit 1
;;
esac
diff --git a/functions/breakpoints.sh b/functions/breakpoints.sh
new file mode 100755
index 0000000..7dfc24c
--- /dev/null
+++ b/functions/breakpoints.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# breakpoints.sh
+# 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.
diff --git a/functions/cache.sh b/functions/cache.sh
index bffe1a3..a80245a 100755
--- a/functions/cache.sh
+++ b/functions/cache.sh
@@ -11,21 +11,21 @@ set -e
Restore_cache ()
{
- CACHEDIRECTORY="${1}"
+ DIRECTORY="${1}"
if [ "${LH_CACHE}" = "enabled" ]
then
- if [ -d "${CACHEDIRECTORY}" ]
+ if [ -d "${DIRECTORY}" ]
then
# Restore old cache
- cp "${CACHEDIRECTORY}"/*.deb chroot/var/cache/apt/archives
+ cp "${DIRECTORY}"/*.deb chroot/var/cache/apt/archives
fi
fi
}
Save_cache ()
{
- CACHEDIRECTORY="${1}"
+ DIRECTORY="${1}"
if [ "${LH_CACHE}" = "enabled" ]
then
@@ -35,13 +35,13 @@ Save_cache ()
if ls chroot/var/cache/apt/archives/*.deb &> /dev/null
then
# Creating cache directory
- if [ ! -d "${CACHEDIRECTORY}" ]
+ if [ ! -d "${DIRECTORY}" ]
then
- mkdir -p "${CACHEDIRECTORY}"
+ mkdir -p "${DIRECTORY}"
fi
# Saving new cache
- mv -f chroot/var/cache/apt/archives/*.deb "${CACHEDIRECTORY}"
+ mv -f chroot/var/cache/apt/archives/*.deb "${DIRECTORY}"
fi
else
# Purging current cache
diff --git a/functions/chroot.sh b/functions/chroot.sh
index 34efa0b..c40c475 100755
--- a/functions/chroot.sh
+++ b/functions/chroot.sh
@@ -14,5 +14,6 @@ Chroot ()
COMMANDS="${1}"
# 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}
}
diff --git a/functions/common.sh b/functions/common.sh
new file mode 100755
index 0000000..15093cd
--- /dev/null
+++ b/functions/common.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# common.sh - common things for all live-helpers
+# 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}`"
+VERSION="1.0~a4"
diff --git a/functions/conffile.sh b/functions/conffile.sh
index fab8dc1..bd5547e 100755
--- a/functions/conffile.sh
+++ b/functions/conffile.sh
@@ -11,17 +11,16 @@ set -e
Read_conffile ()
{
- CONFFILE="${1}"
+ FILE="${1}"
- # Reading configuration file
- if [ -f "${CONFFILE}" ]
+ if [ -f "${FILE}" ]
then
- if [ -r "${CONFFILE}" ]
+ if [ -r "${FILE}" ]
then
- # Sourcing configurationfile
- . "${CONFFILE}"
+ Echo_debug "Reading configuration file ${FILE}"
+ . "${FILE}"
else
- echo "W: failed to read ${CONFFILE}"
+ Echo_warning "Failed to read configuration file ${FILE}"
fi
fi
}
diff --git a/functions/defaults.sh b/functions/defaults.sh
index 4774c07..001ef1c 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -274,17 +274,17 @@ Set_defaults ()
case "${LIST}" in
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"
+ LIVE_TASKS="`echo ${LIVE_TASKS} | sed -e 's/standard//' -e 's/laptop//' -e 's/gnome-desktop//' -e 's/desktop//'` standard laptop desktop gnome-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"
+ LIVE_TASKS="`echo ${LIVE_TASKS} | sed -e 's/standard//' -e 's/laptop//' -e 's/kde-desktop//' -e 's/desktop//'` standard laptop desktop kde-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"
+ LIVE_TASKS="`echo ${LIVE_TASKS} | sed -e 's/standard//' -e 's/laptop//' -e 's/xfce-desktop//' -e 's/desktop//'` standard laptop desktop xfce-desktop"
;;
esac
done
@@ -339,30 +339,13 @@ Set_defaults ()
# Setting image type
if [ -z "${LIVE_SOURCE_IMAGE}" ]
then
- if [ "${LIVE_BINARY_IMAGE}" = "iso" ]
- then
- LIVE_SOURCE_IMAGE="iso"
- elif [ "${LIVE_BINARY_IMAGE}" = "usb" ]
- then
- LIVE_SOURCE_IMAGE="usb"
- elif [ "${LIVE_BINARY_IMAGE}" = "net" ]
- then
- LIVE_SOURCE_IMAGE="net"
- fi
+ LIVE_SOURCE_IMAGE="generic"
fi
# Setting filesystem
- if [ -z "${LIVE_FILESYSTEM}" ] && [ "${LIVE_BINARY_IMAGE}" = "iso" ]
- then
- LIVE_FILESYSTEM="squashfs"
- elif [ -z "${LIVE_FILESYSTEM}" ] && [ "${LIVE_BINARY_IMAGE}" = "usb" ]
+ if [ -z "${LIVE_FILESYSTEM}" ]
then
LIVE_FILESYSTEM="squashfs"
- elif [ -z "${LIVE_FILESYSTEM}" ] && [ "${LIVE_BINARY_IMAGE}" = "net" ]
- then
- LIVE_FILESYSTEM="plain"
- else
- LIVE_FILESYSTEM="squashfs"
fi
# Setting memtest86 option
@@ -395,12 +378,15 @@ Set_defaults ()
LIVE_SOURCE="disabled"
fi
- # Setting syslinux
- if [ -z "${LIVE_SYSLINUX}" ]
+ # Setting grub
+ if [ -z "${LIVE_BOOTLOADER}" ]
then
- LIVE_SYSLINUX="enabled"
+ LIVE_BOOTLOADER="syslinux"
fi
+ # Setting grub splash
+ # LIVE_GRUB_SPLASH
+
# Setting syslinux splash
# LIVE_SYSLINUX_SPLASH
diff --git a/functions/echo.sh b/functions/echo.sh
new file mode 100755
index 0000000..89d2d6b
--- /dev/null
+++ b/functions/echo.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+# echo.sh - define output methods
+# 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
+
+Echo_debug ()
+{
+ if [ "${DEBUG}" = "true" ]
+ then
+ echo "D: ${@}"
+ fi
+}
+
+Echo_error ()
+{
+ echo "E: ${@}"
+}
+
+Echo_message ()
+{
+ if [ "${QUIET}" != "true" ]
+ then
+ echo "P: ${@}"
+ fi
+}
+
+Echo_verbose ()
+{
+ if [ "${VERBOSE}" = "true" ]
+ then
+ echo "I: ${@}"
+ fi
+}
+
+Echo_warning ()
+{
+ echo "W: ${@}"
+}
diff --git a/functions/lockfile.sh b/functions/lockfile.sh
index ee01889..3b44e54 100755
--- a/functions/lockfile.sh
+++ b/functions/lockfile.sh
@@ -11,30 +11,30 @@ set -e
Check_lockfile ()
{
- LOCKFILE="${1}"
+ FILE="${1}"
# Checking lock file
- if [ -f "${LOCKFILE}" ]
+ if [ -f "${FILE}" ]
then
- echo "E: system locked"
+ Echo_error "system locked"
exit 1
fi
}
Create_lockfile ()
{
- LOCKFILE="${1}"
- LOCKDIRECTORY="`dirname ${1}`"
+ FILE="${1}"
+ DIRECTORY="`dirname ${1}`"
# Creating lock directory
- if [ ! -d "${LOCKDIRECTORY}" ]
+ if [ ! -d "${DIRECTORY}" ]
then
- mkdir -p "${LOCKDIRECTORY}"
+ mkdir -p "${DIRECTORY}"
fi
# Creating lock trap
- trap "test -f ${LOCKFILE} && rm -f ${LOCKFILE}; exit 0" 0 2 15
+ trap "test -f ${FILE} && rm -f ${FILE}; exit 0" 0 2 15
# Creating lock file
- touch "${LOCKFILE}"
+ touch "${FILE}"
}
diff --git a/functions/stagefile.sh b/functions/stagefile.sh
index d9d6503..a5879f5 100755
--- a/functions/stagefile.sh
+++ b/functions/stagefile.sh
@@ -11,19 +11,19 @@ set -e
Check_stagefile ()
{
- STAGEFILE="${1}"
- STAGENAME="`basename ${1}`"
+ FILE="${1}"
+ NAME="`basename ${1}`"
# Checking stage file
- if [ -f "${STAGEFILE}" ]
+ if [ -f "${FILE}" ]
then
if [ "${FORCE}" = "true" ]
then
# Forcing execution
- rm -f "${STAGEFILE}"
+ rm -f "${FILE}"
else
# Skipping execution
- echo "W: skipping ${STAGENAME}"
+ Echo_warning "skipping ${NAME}"
exit 0
fi
fi
@@ -31,28 +31,28 @@ Check_stagefile ()
Create_stagefile ()
{
- STAGEFILE="${1}"
- STAGEDIRECTORY="`dirname ${1}`"
+ FILE="${1}"
+ DIRECTORY="`dirname ${1}`"
# Creating stage directory
- if [ ! -d "${STAGEDIRECTORY}" ]
+ if [ ! -d "${DIRECTORY}" ]
then
- mkdir -p "${STAGEDIRECTORY}"
+ mkdir -p "${DIRECTORY}"
fi
# Creating stage file
- touch "${STAGEFILE}"
+ touch "${FILE}"
}
Require_stagefile ()
{
- STAGEFILE="${1}"
- STAGENAME="`basename ${1}`"
+ FILE="${1}"
+ NAME="`basename ${1}`"
# Checking stage file
- if [ ! -f "${STAGEFILE}" ]
+ if [ ! -f "${FILE}" ]
then
- echo "E: ${STAGENAME} missing"
+ Echo_error "${NAME} missing"
exit 1
fi
}
diff --git a/functions/version.sh b/functions/version.sh
index 111d531..237531c 100755
--- a/functions/version.sh
+++ b/functions/version.sh
@@ -9,8 +9,6 @@
set -e
-VERSION="1.0~a3"
-
Version ()
{
echo "${PROGRAM}, version ${VERSION}"