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