-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathinstcmds
executable file
·85 lines (74 loc) · 1.73 KB
/
instcmds
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#! /bin/sh
# instcmds - extract shell commands from the Makefile
# Copyright 1999 Jochen Voss
version="0.3"
usage()
{
cat <<EOF
Usage: instcmds [options] ARGS
Extract (un-)installation commands from the Makefile.
This script may only be interesting to maintainers and
requires GNU make.
The options are
--help show this message
--install Show the install commands (default)
--type=TYPE One of "pre", "normal" (default), and "post"
--uninstall Show the uninstall commands
--version show the version information
The ARGS are passed directly to the make command.
Please report bugs to <[email protected]>.
EOF
exit $1
}
type=normal
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
-*) optarg= ;;
*) break ;;
esac
case "$1" in
--version)
cat <<EOF
Instcmds $version
Copyright (C) 1999 Jochen Voss
Instcmds comes with NO WARRANTY, to the extent permitted by law.
EOF
exit 0
;;
--help)
usage 0
;;
--install)
un=
UN=
;;
--uninstall)
un=un
UN=UN
;;
--type=*)
type=$optarg
;;
*)
usage 1
;;
esac
shift
done
unique=47272088
pre_label=$unique-ignore
normal_label=$unique-ignore
post_label=$unique-ignore
case "$type" in
pre) pre_label=$unique-fetch ;;
normal) normal_label=$unique-fetch ;;
post) post_label=$unique-fetch ;;
esac
make "$@" --no-print-directory -n ${un}install -o all \
PRE_${UN}INSTALL=$pre_label \
NORMAL_${UN}INSTALL=$normal_label \
POST_${UN}INSTALL=$post_label \
| sed -n -e "/^[ \t]*$unique-fetch[ \t]*\$/, /^[ \t]*$unique-ignore[ \t]*\$/! d" \
-e "/^[ \t]*$unique-\\(fetch\\|ignore\\)[ \t]*\$/ d" \
-e "p" -