File: lib

package info (click to toggle)
openldap-guide 19991007-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 128 kB
  • ctags: 13
  • sloc: makefile: 127; sh: 114; perl: 63
file content (44 lines) | stat: -rw-r--r-- 735 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
lib_START=foo
fetchmsg() {
	local msg
	msg=$1;shift
	eval echo $(sed -ne "s/^$(BASENAME):$msg://p" debian/scripts/messages)
}
START() {
	echo -n "$(fetchmsg START "$@") "
}
OK() {
	fetchmsg OK "$@"
}
FAILED() {
	fetchmsg FAILED "$@"
}
ALREADY_DONE() {
	fetchmsg ALREADY_DONE "$@"
}

BASENAME() {
	local base
	base=${0##*/}
	if [ x$base = x ];then
		echo "Danger, Will Robinson, Danger!" 1>&2
		echo "Bash is very confused." 1>&2
		exit 1
	fi
	if [ x$base = xlib ];then
		echo "You can't call this directly." 1>&2
		echo "This is a library that should be sourced." 1>&2
		exit 1
	fi
	echo $base
}
file2cat() {
	case "$1" in
		*.gz|*.Z)	cmd=zcat;;
		*.bz)		cmd=bzcat;;
		*.bz2)		cmd=bz2cat;;
		*)		cmd=cat;;
	esac
	$cmd $1
}