|
1 ## |
|
2 ## pam.spec -- OpenPKG RPM Package Specification |
|
3 ## Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/> |
|
4 ## |
|
5 ## Permission to use, copy, modify, and distribute this software for |
|
6 ## any purpose with or without fee is hereby granted, provided that |
|
7 ## the above copyright notice and this permission notice appear in all |
|
8 ## copies. |
|
9 ## |
|
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
|
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
|
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
|
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
21 ## SUCH DAMAGE. |
|
22 ## |
|
23 |
|
24 # package information |
|
25 Name: pam |
|
26 Summary: Information Resource for PAM |
|
27 URL: - |
|
28 Vendor: The OpenPKG Project |
|
29 Packager: OpenPKG Foundation e.V. |
|
30 Distribution: OpenPKG Community |
|
31 Class: BASE |
|
32 Group: Meta |
|
33 License: PD |
|
34 Version: 0 |
|
35 Release: 20110219 |
|
36 |
|
37 # list of sources |
|
38 Source0: pamtool |
|
39 Source1: rc.pam |
|
40 |
|
41 # build information |
|
42 BuildPreReq: OpenPKG, openpkg >= 20100101 |
|
43 PreReq: OpenPKG, openpkg >= 20100101 |
|
44 Provides: PAM |
|
45 |
|
46 %description |
|
47 This is the information resource package for PAM. |
|
48 |
|
49 %track |
|
50 |
|
51 %prep |
|
52 |
|
53 %build |
|
54 |
|
55 %install |
|
56 |
|
57 pam_cfgloc="" |
|
58 pam_modpfx="" |
|
59 pam_incdir="" |
|
60 pam_libdir="" |
|
61 |
|
62 # search for configuration location |
|
63 for cfgloc in \ |
|
64 /etc/pam.d \ |
|
65 /etc/pam.conf \ |
|
66 ; do |
|
67 if [ -f $cfgloc -o -d $cfgloc ]; then |
|
68 pam_cfgloc="$cfgloc" |
|
69 break |
|
70 fi |
|
71 done |
|
72 |
|
73 # search for module prefix |
|
74 if [ -d $pam_cfgloc ]; then |
|
75 mod=`cat $pam_cfgloc/* 2>/dev/null | grep -i '^#*[ ]*other' | head -1 | awk '{ print $3; }'` |
|
76 elif [ -f $pam_cfgloc ]; then |
|
77 mod=`cat $pam_cfgloc 2>/dev/null | grep -i '^#*[ ]*other' | head -1 | awk '{ print $4; }'` |
|
78 else |
|
79 mod="" |
|
80 fi |
|
81 case $mod in |
|
82 pam_* ) pam_modpfx="" ;; |
|
83 /*/pam_* ) pam_modpfx=`echo $mod | sed 's;^\(/.*/\)pam_[^/]*$;\1;'` ;; |
|
84 esac |
|
85 |
|
86 # search for include directory |
|
87 for incdir in \ |
|
88 /usr/include \ |
|
89 /usr/local/include \ |
|
90 /opt/include \ |
|
91 ; do |
|
92 if [ -f "$incdir/security/pam_appl.h" ]; then |
|
93 pam_incdir="$incdir" |
|
94 break |
|
95 fi |
|
96 done |
|
97 |
|
98 # search for library directory |
|
99 for libdir in \ |
|
100 /lib \ |
|
101 /usr/lib \ |
|
102 /usr/local/lib \ |
|
103 /opt/lib \ |
|
104 ; do |
|
105 for ext in a so sl so.0; do |
|
106 if [ -f "$libdir/libpam.$ext" ]; then |
|
107 pam_libdir="$libdir" |
|
108 break |
|
109 fi |
|
110 done |
|
111 if [ ".$pam_libdir" != . ]; then |
|
112 break |
|
113 fi |
|
114 done |
|
115 |
|
116 # make sure everything was found |
|
117 if [ ".$pam_cfgloc" = . ] ||\ |
|
118 [ ".$pam_incdir" = . ] ||\ |
|
119 [ ".$pam_libdir" = . ]; then |
|
120 set +x |
|
121 ( echo "************************************************************" |
|
122 echo "** ERROR: SOME PAM INFORMATION COULD NOT BE DETERMINED!!" |
|
123 echo "** ERROR: SOME PAM INFORMATION COULD NOT BE DETERMINED!!" |
|
124 echo "**" |
|
125 echo "** We found out:" |
|
126 echo "** PAM Config Location: \"${pam_cfgloc}\"" |
|
127 echo "** PAM Module Prefix: \"${pam_modpfx}\"" |
|
128 echo "** PAM Include Directory: \"${pam_incdir}\"" |
|
129 echo "** PAM Library Directory: \"${pam_libdir}\"" |
|
130 echo "**" |
|
131 echo "** Unfortunately, some information is missing here." |
|
132 echo "**" |
|
133 echo "** Be sure to have all system PAM components installed" |
|
134 echo "** in standard locations before building this package!" |
|
135 echo "**" |
|
136 echo "** ERROR: SOME PAM INFORMATION COULD NOT BE DETERMINED!!" |
|
137 echo "** ERROR: SOME PAM INFORMATION COULD NOT BE DETERMINED!!" |
|
138 echo "************************************************************" |
|
139 ) | %{l_rpmtool} msg -b -t error |
|
140 exit 1 |
|
141 fi |
|
142 |
|
143 # install PAM tool |
|
144 %{l_shtool} mkdir -f -p -m 755 \ |
|
145 $RPM_BUILD_ROOT%{l_prefix}/sbin |
|
146 %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
|
147 -e 's;@l_platform@;%{l_platform -t};g' \ |
|
148 %{SOURCE pamtool} $RPM_BUILD_ROOT%{l_prefix}/sbin/ |
|
149 |
|
150 # install rc file |
|
151 %{l_shtool} mkdir -f -p -m 755 \ |
|
152 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d |
|
153 %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
|
154 -e "s;@pam_cfgloc@;${pam_cfgloc};g" \ |
|
155 -e "s;@pam_modpfx@;${pam_modpfx};g" \ |
|
156 -e "s;@pam_incdir@;${pam_incdir};g" \ |
|
157 -e "s;@pam_libdir@;${pam_libdir};g" \ |
|
158 %{SOURCE rc.pam} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
|
159 |
|
160 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} |
|
161 |
|
162 %files -f files |
|
163 |
|
164 %clean |
|
165 |