From: Christian Hofstaedtler Date: Tue, 26 Jul 2011 08:36:25 +0000 (+0200) Subject: Don't depend on grml-etc-core X-Git-Tag: v0.47~10 X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=commitdiff_plain;h=c87dc4ae138c4ad36070bbfa40cb2c848f01ffb2 Don't depend on grml-etc-core Internalized some functions from lsb-functions, script-functions in simplified versions. --- diff --git a/debian/control b/debian/control index e89e3b0..7b8ea8f 100644 --- a/debian/control +++ b/debian/control @@ -12,7 +12,7 @@ Vcs-Browser: http://git.grml.org/?p=grml-debootstrap.git Package: grml-debootstrap Architecture: all -Depends: ${shlibs:Depends}, ${misc:Depends}, debootstrap (>= 0.3.3.3) | cdebootstrap (>= 0.3.16), grml-etc-core +Depends: ${shlibs:Depends}, ${misc:Depends}, debootstrap (>= 0.3.3.3) | cdebootstrap (>= 0.3.16) Recommends: kpartx, mksh, parted, qemu-utils Description: wrapper around debootstrap for installing plain Debian via Grml This package provides a wrapper suite around deboostrap and diff --git a/grml-debootstrap b/grml-debootstrap index d456bce..5964d55 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -28,11 +28,6 @@ export LC_ALL=C INTERACTIVE='' # }}} -# source core functions {{{ -. /etc/grml/lsb-functions -. /etc/grml/script-functions -# }}} - # help text {{{ usage() { echo "$PN - wrapper around debootstrap for installing Debian @@ -103,6 +98,60 @@ if [ "$1" = '-h' ] || [ "$1" = '-help' ] || [ "$1" = "--help" ] ; then fi # }}} +# {{{ +GOOD='' +WARN='' +BAD='' +NORMAL='' +HILITE='' +BRACKET='' + +einfo() { + einfon "$1\n" + return 0 +} + +einfon() { + [ "${RC_ENDCOL}" != "yes" ] && [ "${LAST_E_CMD}" = "ebegin" ] && echo + printf " ${GOOD}*${NORMAL} $*" + LAST_E_CMD=einfon + return 0 +} + +eerror() { + [ "${RC_ENDCOL}" != "yes" ] && [ "${LAST_E_CMD}" = "ebegin" ] && echo + printf " ${BAD}*${NORMAL} $*\n" + LAST_E_CMD=eerror + return 0 +} + +eend() { + local retval="${1:-0}" + shift + if [ $retval -gt 0 ]; then + printf " ${BAD}-> Failed (rc=${retval})${NORMAL}\n" + fi +} + +check4root(){ + if [ "$(id -u 2>/dev/null)" != 0 ] ; then + echo 1>&2 "Error: please run this script with uid 0 (root)." ; return 1 + fi +} + +check4progs(){ + local RC='' + for arg in $* ; do + which $arg >/dev/null 2>&1 || RC="$arg" + done + if [ -n "$RC" ] ; then + echo "$RC not installed" + return 1 + fi +} + +# }}} + # make sure we have what we need {{{ check4progs debootstrap dialog || exit 1 # }}} @@ -742,9 +791,7 @@ stage() { return 0 elif grep -q done "${STAGES}/${1}" 2>/dev/null ; then ewarn "Notice: stage $1 has been executed already, skipping execution therefore." ; eend 0 - eindent - ewarn "To reexecute it clean up the according directory inside $STAGES" ; eend 0 - eoutdent + ewarn " To reexecute it clean up the according directory inside $STAGES" ; eend 0 return 1 fi }