File tree 2 files changed +54
-33
lines changed
2 files changed +54
-33
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Shared functions for various supporting scripts of compton
4
+ # Mostly copied from Gentoo gentoo-functions
5
+
6
+ GOOD=$' \e [32;01m'
7
+ WARN=$' \e [33;01m'
8
+ BAD=$' \e [31;01m'
9
+ HILITE=$' \e [36;01m'
10
+ BRACKET=$' \e [34;01m'
11
+ NORMAL=$' \e [0m'
12
+
13
+ # @FUNCTION: eerror
14
+ # @USAGE: [message]
15
+ # @DESCRIPTION:
16
+ # Show an error message.
17
+ eerror () {
18
+ echo -e " $@ " | while read -r ; do
19
+ echo " $BAD *$NORMAL $REPLY " >&2
20
+ done
21
+ return 0
22
+ }
23
+
24
+ # @FUNCTION: einfo
25
+ # @USAGE: [message]
26
+ # @DESCRIPTION:
27
+ # Show a message.
28
+ einfo () {
29
+ echo -e " $@ " | while read -r ; do
30
+ echo " $GOOD *$NORMAL $REPLY "
31
+ done
32
+ return 0
33
+ }
34
+
35
+ # @FUNCTION: die
36
+ # @USAGE:
37
+ # @DESCRIPTION:
38
+ # Print the call stack and the working directory, then quit the shell.
39
+ die () {
40
+ eerror " Call stack:"
41
+ (( n = ${# FUNCNAME[@]} - 1 ))
42
+ while (( n > 0 )) ; do
43
+ funcname=${FUNCNAME[$((n - 1))]}
44
+ sourcefile=$( basename ${BASH_SOURCE[${n}]} )
45
+ lineno=${BASH_LINENO[$((n - 1))]}
46
+ eerror " ${sourcefile} :${lineno} - Called ${funcname} ()"
47
+ (( n-- ))
48
+ done
49
+ eerror " Working directory: '$( pwd) '"
50
+ exit 1
51
+ }
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- GOOD=$' \e [32;01m'
4
- WARN=$' \e [33;01m'
5
- BAD=$' \e [31;01m'
6
- HILITE=$' \e [36;01m'
7
- BRACKET=$' \e [34;01m'
8
- NORMAL=$' \e [0m'
3
+ # Make a release source tarball containing pre-built documentation
9
4
10
- eerror () {
11
- echo -e " $@ " | while read -r ; do
12
- echo " $BAD *$NORMAL $RC_INDENTATION$REPLY " >&2
13
- done
14
- return 0
15
- }
16
-
17
- einfo () {
18
- echo -e " $@ " | while read -r ; do
19
- echo " $GOOD *$NORMAL $REPLY "
20
- done
21
- return 0
22
- }
23
-
24
- die () {
25
- eerror " Call stack:"
26
- (( n = ${# FUNCNAME[@]} - 1 ))
27
- while (( n > 0 )) ; do
28
- funcname=${FUNCNAME[$((n - 1))]}
29
- sourcefile=$( basename ${BASH_SOURCE[${n}]} )
30
- lineno=${BASH_LINENO[$((n - 1))]}
31
- eerror " ${sourcefile} :${lineno} - Called ${funcname} ()"
32
- (( n-- ))
33
- done
34
- eerror " Working directory: '$( pwd) '"
35
- exit 1
36
- }
5
+ BASE_DIR=$( dirname " $0 " )
6
+ . " ${BASE_DIR} /functions.sh"
37
7
38
8
main () {
39
9
TMP=/tmp
You can’t perform that action at this time.
0 commit comments