summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2007-09-23 10:04:51 +0200
committerDaniel Baumann <daniel@debian.org>2011-03-09 18:18:29 +0100
commit8a4a50fdb6b206fbff62fd3043ed388f25a0ffb1 (patch)
tree621dc56a00a65ab0eb1fd4e7d42ad4e45d718741 /functions
parent4739146fc6c4de8b16418517bb882312c475195c (diff)
downloadvyos-live-build-8a4a50fdb6b206fbff62fd3043ed388f25a0ffb1.tar.gz
vyos-live-build-8a4a50fdb6b206fbff62fd3043ed388f25a0ffb1.zip
Adding live-helper 1.0~a7-1.
Diffstat (limited to 'functions')
-rwxr-xr-xfunctions/arguments.sh10
-rwxr-xr-xfunctions/breakpoints.sh6
-rwxr-xr-xfunctions/chroot.sh2
-rwxr-xr-xfunctions/common.sh2
-rwxr-xr-xfunctions/defaults.sh22
-rwxr-xr-xfunctions/echo.sh20
-rwxr-xr-xfunctions/exit.sh1
-rwxr-xr-xfunctions/package.sh53
-rwxr-xr-xfunctions/stagefile.sh9
9 files changed, 109 insertions, 16 deletions
diff --git a/functions/arguments.sh b/functions/arguments.sh
index 8405dcbc9..0bb6441f0 100755
--- a/functions/arguments.sh
+++ b/functions/arguments.sh
@@ -11,7 +11,7 @@ set -e
Arguments ()
{
- ARGUMENTS="`getopt --longoptions breakpoints,conffile:,debug,force,help,logfile:,quiet,usage,verbose,version --name=${PROGRAM} --options huv --shell sh -- "${@}"`"
+ ARGUMENTS="`getopt --longoptions breakpoints,conffile:,debug,force,help,logfile:,trace,root-command:,quiet,usage,verbose,version --name=${PROGRAM} --options huv --shell sh -- "${@}"`"
if [ "${?}" != "0" ]
then
@@ -48,6 +48,14 @@ Arguments ()
LH_LOGFILE="${2}"; shift 2
;;
+ --trace)
+ LH_TRACE="enabled"; shift
+ ;;
+
+ --root-command)
+ LH_ROOT_COMMAND="${2}"; shift
+ ;;
+
--quiet)
LH_QUIET="enabled"; shift
;;
diff --git a/functions/breakpoints.sh b/functions/breakpoints.sh
index 70e473818..09b41e865 100755
--- a/functions/breakpoints.sh
+++ b/functions/breakpoints.sh
@@ -9,11 +9,11 @@
Breakpoint ()
{
+ NAME="${1}"
+
if [ "${LH_BREAKPOINTS}" = "enabled" ]
then
- BREAKPOINT="${1}"
-
- Echo_message "Waiting at ${BREAKPOINT}"
+ Echo_message "Waiting at ${NAME}"
read
fi
}
diff --git a/functions/chroot.sh b/functions/chroot.sh
index c463f66c1..77232a170 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/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" TERM="${TERM}" ftp_proxy="${LH_APT_FTPPROXY}" http_proxy="${LH_APT_HTTPPROXY}" DEBIAN_FRONTEND="${LH_DEBCONF_FRONTEND}" DEBIAN_PRIORITY="${LH_DEBCONF_PRIORITY}" DEBCONF_NOWARNINGS="${LH_DEBCONF_NOWARNINGS}" ${COMMANDS}
+ ${LH_ROOT_COMMAND} 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_HTTPPROXY}" DEBIAN_FRONTEND="${LH_DEBCONF_FRONTEND}" DEBIAN_PRIORITY="${LH_DEBCONF_PRIORITY}" DEBCONF_NOWARNINGS="${LH_DEBCONF_NOWARNINGS}" ${COMMANDS}
}
diff --git a/functions/common.sh b/functions/common.sh
index a6e475f71..a56863859 100755
--- a/functions/common.sh
+++ b/functions/common.sh
@@ -10,4 +10,4 @@
set -e
PROGRAM="`basename ${0}`"
-VERSION="1.0~a6"
+VERSION="1.0~a7"
diff --git a/functions/defaults.sh b/functions/defaults.sh
index 5deaa54a2..433360870 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -170,6 +170,12 @@ Set_defaults ()
fi
fi
+ # Setting tasksel
+ if [ -z "${LH_TASKSEL}" ]
+ then
+ LH_TASKSEL="aptitude"
+ fi
+
# Setting root directory
if [ -z "${LIVE_ROOT}" ]
then
@@ -210,6 +216,12 @@ Set_defaults ()
LH_VERBOSE="disabled"
fi
+ # If we are root, disable root command
+ if [ "`id -u`" = "0" ]
+ then
+ LIVE_ROOT_COMMAND=""
+ fi
+
## config/bootstrap
# Setting architecture value
@@ -305,7 +317,15 @@ Set_defaults ()
# Setting sections value
if [ -z "${LIVE_SECTIONS}" ]
then
- LIVE_SECTIONS="main"
+ case "${LH_MODE}" in
+ debian)
+ LIVE_SECTIONS="main"
+ ;;
+
+ ubuntu)
+ LIVE_SECTIONS="main restricted"
+ ;;
+ esac
fi
## config/chroot
diff --git a/functions/echo.sh b/functions/echo.sh
index 71800ade1..f28879c61 100755
--- a/functions/echo.sh
+++ b/functions/echo.sh
@@ -11,34 +11,44 @@ set -e
Echo_debug ()
{
+ STRING="${1}"
+
if [ "${LH_DEBUG}" = "enabled" ]
then
- echo "D: ${@}"
+ echo "D: ${STRING}"
fi
}
Echo_error ()
{
- echo "E: ${@}"
+ STRING="${1}"
+
+ echo "E: ${STRING}"
}
Echo_message ()
{
+ STRING="${1}"
+
if [ "${LH_QUIET}" != "enabled" ]
then
- echo "P: ${@}"
+ echo "P: ${STRING}"
fi
}
Echo_verbose ()
{
+ STRING="${1}"
+
if [ "${LH_VERBOSE}" = "enabled" ]
then
- echo "I: ${@}"
+ echo "I: ${STRING}"
fi
}
Echo_warning ()
{
- echo "W: ${@}"
+ STRING="${1}"
+
+ echo "W: ${STRING}"
}
diff --git a/functions/exit.sh b/functions/exit.sh
index ff76c3680..3de897c11 100755
--- a/functions/exit.sh
+++ b/functions/exit.sh
@@ -13,6 +13,7 @@ Exit ()
{
if [ "${LH_DEBUG}" = "enabled" ]
then
+ # Dump variables
set | grep -e ^LH -e ^LIVE
fi
diff --git a/functions/package.sh b/functions/package.sh
new file mode 100755
index 000000000..3d11873c2
--- /dev/null
+++ b/functions/package.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# packages.sh - handle packages installation
+# 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
+
+Check_package ()
+{
+ FILE="${1}"
+ PACKAGE="${2}"
+
+ if [ ! -f "${FILE}" ]
+ then
+ PACKAGES="${PACKAGES} ${PACKAGE}"
+ fi
+}
+
+Install_package ()
+{
+ if [ -n "${PACKAGES}" ]
+ then
+ case "${LH_APT}" in
+ apt|apt-get)
+ Chroot "apt-get install --yes ${PACKAGES}"
+ ;;
+
+ aptitude)
+ Chroot "aptitude install --assume-yes ${PACKAGES}"
+ ;;
+ esac
+ fi
+}
+
+Remove_package ()
+{
+ if [ -n "${PACKAGES}" ]
+ then
+ case "${LH_APT}" in
+ apt|apt-get)
+ Chroot "apt-get remove --purge --yes ${PACKAGES}"
+ ;;
+
+ aptitude)
+ Chroot "aptitude purge --assume-yes ${PACKAGES}"
+ ;;
+ esac
+ fi
+}
diff --git a/functions/stagefile.sh b/functions/stagefile.sh
index 6a41cda85..a570ea261 100755
--- a/functions/stagefile.sh
+++ b/functions/stagefile.sh
@@ -17,14 +17,15 @@ Check_stagefile ()
# Checking stage file
if [ -f "${FILE}" ]
then
- if [ "${LH_FORCE}" = "enabled" ]
+ if [ "${LH_FORCE}" != "enabled" ]
then
- # Forcing execution
- rm -f "${FILE}"
- else
# Skipping execution
Echo_warning "skipping ${NAME}"
exit 0
+ else
+ # Forcing execution
+ Echo_message "forcing ${NAME}"
+ rm -f "${FILE}"
fi
fi
}