summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2007-09-23 10:04:47 +0200
committerDaniel Baumann <daniel@debian.org>2011-03-09 18:18:28 +0100
commit677415f6d7efc1e5b888570d70af311d2900c69c (patch)
tree32fe7ced768666c229fff913fe12cbbf2fdd34e4 /functions
parent811ff0532fcb3305ebefcd1d61e4eb6c260902eb (diff)
downloadvyos-live-build-677415f6d7efc1e5b888570d70af311d2900c69c.tar.gz
vyos-live-build-677415f6d7efc1e5b888570d70af311d2900c69c.zip
Adding live-helper 1.0~a2-1.
Diffstat (limited to 'functions')
-rwxr-xr-xfunctions/chroot.sh2
-rwxr-xr-xfunctions/conffile.sh9
-rwxr-xr-xfunctions/defaults.sh70
-rwxr-xr-xfunctions/help.sh18
-rwxr-xr-xfunctions/lockfile.sh6
-rwxr-xr-xfunctions/usage.sh16
-rwxr-xr-xfunctions/version.sh32
7 files changed, 116 insertions, 37 deletions
diff --git a/functions/chroot.sh b/functions/chroot.sh
index 60de2ddd0..0dc0215b8 100755
--- a/functions/chroot.sh
+++ b/functions/chroot.sh
@@ -9,5 +9,5 @@ Chroot ()
COMMANDS="${1}"
# Executing commands in chroot
- chroot "${LIVE_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}
+ 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/conffile.sh b/functions/conffile.sh
index 5df00d3c5..0cd8d2934 100755
--- a/functions/conffile.sh
+++ b/functions/conffile.sh
@@ -9,8 +9,13 @@ Read_conffile ()
CONFFILE="${1}"
# Reading configuration file
- if [ -r "${CONFFILE}" ]
+ if [ -f "${CONFFILE}" ]
then
- . "${CONFFILE}"
+ if [ -r "${CONFFILE}" ]
+ then
+ . "${CONFFILE}"
+ else
+ echo "W: failed to read ${CONFFILE}"
+ fi
fi
}
diff --git a/functions/defaults.sh b/functions/defaults.sh
index 9463ad66a..9ada89eb4 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -55,7 +55,7 @@ Set_defaults ()
fi
# Setting bootstrap program
- if [ -z "${LH_BOOTSTRAP}" ]
+ if [ -z "${LH_BOOTSTRAP}" ] || [ ! -x "${LH_BOOTSTRAP}" ]
then
if [ -x "/usr/bin/cdebootstrap" ]
then
@@ -87,32 +87,44 @@ Set_defaults ()
fi
# Setting genisoimage
- if [ -x /usr/bin/genisoimage ]
+ if [ -z "${LH_GENISOIMAGE}" ] || [ ! -x "${LH_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
+ 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
fi
- # Setting root directory
- if [ -z "${LIVE_ROOT}" ]
+ # Setting losetup
+ if [ -z "${LH_LOSETUP}" ] || [ ! -x "${LH_LOSETUP}" ]
then
- LIVE_ROOT="`pwd`/debian-live"
+ # 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
fi
- # Setting chroot directory
- if [ -z "${LIVE_CHROOT}" ]
+ # Setting root directory
+ if [ -z "${LIVE_ROOT}" ]
then
- LIVE_CHROOT="${LIVE_ROOT}/chroot"
+ LIVE_ROOT="debian-live"
fi
## config/bootstrap
- # Setting architecture string
+ # Setting architecture value
if [ -z "${LIVE_ARCHITECTURE}" ]
then
if [ -x "/usr/bin/dpkg" ]
@@ -123,46 +135,46 @@ Set_defaults ()
fi
fi
- # Setting distribution string
+ # Setting distribution value
if [ -z "${LIVE_DISTRIBUTION}" ]
then
LIVE_DISTRIBUTION="sid"
fi
- # Setting distribution configuration string
+ # Setting distribution configuration value
# LIVE_DISTRIBUTION_CONFIG
- # Setting flavour string
+ # Setting flavour value
if [ -z "${LIVE_FLAVOUR}" ]
then
LIVE_FLAVOUR="standard"
fi
- # Setting mirror string
- if [ -z "${LIVE_MIRROR}" ]
+ # Setting local mirror value
+ if [ -z "${LIVE_MIRROR_LOCAL}" ]
then
- LIVE_MIRROR="http://ftp.debian.org/debian/"
+ LIVE_MIRROR_LOCAL="http://ftp.debian.org/debian/"
fi
- # Setting security mirror string
- if [ -z "${LIVE_MIRROR_SECURITY}" ]
+ # Setting local security mirror value
+ if [ -z "${LIVE_MIRROR_LOCAL_SECURITY}" ]
then
- LIVE_MIRROR_SECURITY="http://security.debian.org/"
+ LIVE_MIRROR_LOCAL_SECURITY="http://security.debian.org/"
fi
- # Setting mirror string
+ # Setting generic mirror value
if [ -z "${LIVE_MIRROR_GENERIC}" ]
then
LIVE_MIRROR_GENERIC="http://ftp.debian.org/debian/"
fi
- # Setting security mirror string
+ # Setting generic security mirror value
if [ -z "${LIVE_MIRROR_GENERIC_SECURITY}" ]
then
LIVE_MIRROR_GENERIC_SECURITY="http://security.debian.org/"
fi
- # Setting sections string
+ # Setting sections value
if [ -z "${LIVE_SECTIONS}" ]
then
LIVE_SECTIONS="main"
@@ -349,7 +361,7 @@ Set_defaults ()
# Setting iso volume
if [ -z "${LIVE_ISO_VOLUME}" ]
then
- LIVE_ISO_VOLUME='Debian Live ${DATE}'
+ LIVE_ISO_VOLUME="Debian Live \`date +%Y%m%d\`"
fi
# Setting netboot server address
diff --git a/functions/help.sh b/functions/help.sh
new file mode 100755
index 000000000..7a6311a3c
--- /dev/null
+++ b/functions/help.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# help.sh - handle help information
+
+Help ()
+{
+ echo "${PROGRAM} - ${DESCRIPTION}"
+ echo
+ echo "${USAGE}"
+ echo "Usage: ${PROGRAM} [-h|--help]"
+ echo "Usage: ${PROGRAM} [-u|--usage]"
+ echo "Usage: ${PROGRAM} [-v|--version]"
+ echo
+ echo "${HELP}"
+ echo
+ 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 9eb2f9b12..02cf18bd5 100755
--- a/functions/lockfile.sh
+++ b/functions/lockfile.sh
@@ -27,9 +27,9 @@ Create_lockfile ()
mkdir -p "${LOCKDIRECTORY}"
fi
- # Creating lock file
- trap "test -f ${LOCKFILE} && \
- rm -f ${LOCKFILE}; exit 0" 0 2 15
+ # Creating lock trap
+ trap "test -f ${LOCKFILE} && rm -f ${LOCKFILE}; exit 0" 0 2 15
+ # Creating lock file
touch "${LOCKFILE}"
}
diff --git a/functions/usage.sh b/functions/usage.sh
new file mode 100755
index 000000000..7f8d69489
--- /dev/null
+++ b/functions/usage.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# usage.sh - handle usage information
+
+Usage ()
+{
+ echo "${PROGRAM} - ${DESCRIPTION}"
+ echo
+ echo "${USAGE}"
+ echo "Usage: ${PROGRAM} [-h|--help]"
+ echo "Usage: ${PROGRAM} [-u|--usage]"
+ echo "Usage: ${PROGRAM} [-v|--version]"
+ echo
+ echo "Try \"${PROGRAM} --help\" for more information."
+ exit 1
+}
diff --git a/functions/version.sh b/functions/version.sh
index 2d5ff20f3..ebca430a0 100755
--- a/functions/version.sh
+++ b/functions/version.sh
@@ -2,5 +2,33 @@
# version.sh - handle version information
-DATE="`date +%Y%m%d`"
-VERSION="1.0~a1"
+VERSION="1.0~a2"
+
+Version ()
+{
+ echo "${PROGRAM}, version ${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"
+ echo "the Free Software Foundation; either version 2 of the License, or"
+ echo "(at your option) any later version."
+ echo
+ echo "This program is distributed in the hope that it will be useful,"
+ echo "but WITHOUT ANY WARRANTY; without even the implied warranty of"
+ echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
+ echo "GNU General Public License for more details."
+ echo
+ echo "You should have received a copy of the GNU General Public License"
+ echo "along with this program; if not, write to the Free Software"
+ echo "Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA"
+ echo
+ echo "On Debian systems, the complete text of the GNU General Public License"
+ echo "can be found in /usr/share/common-licenses/GPL file."
+ echo
+ echo "Homepage: <http://debian-live.alioth.debian.org/>"
+ exit 0
+}