michael@480: ## michael@480: ## pam.spec -- OpenPKG RPM Package Specification michael@480: ## Copyright (c) 2000-2011 OpenPKG Foundation e.V. michael@480: ## michael@480: ## Permission to use, copy, modify, and distribute this software for michael@480: ## any purpose with or without fee is hereby granted, provided that michael@480: ## the above copyright notice and this permission notice appear in all michael@480: ## copies. michael@480: ## michael@480: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@480: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@480: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@480: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@480: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@480: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@480: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@480: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@480: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@480: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@480: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@480: ## SUCH DAMAGE. michael@480: ## michael@480: michael@480: # package information michael@480: Name: pam michael@480: Summary: Information Resource for PAM michael@480: URL: - michael@480: Vendor: The OpenPKG Project michael@480: Packager: OpenPKG Foundation e.V. michael@480: Distribution: OpenPKG Community michael@480: Class: BASE michael@480: Group: Meta michael@480: License: PD michael@480: Version: 0 michael@481: Release: 20120800 michael@480: michael@480: # list of sources michael@480: Source0: pamtool michael@480: Source1: rc.pam michael@480: michael@480: # build information michael@480: BuildPreReq: OpenPKG, openpkg >= 20100101 michael@480: PreReq: OpenPKG, openpkg >= 20100101 michael@480: Provides: PAM michael@480: michael@480: %description michael@480: This is the information resource package for PAM. michael@480: michael@480: %track michael@480: michael@480: %prep michael@480: michael@480: %build michael@480: michael@480: %install michael@480: michael@480: pam_cfgloc="" michael@480: pam_modpfx="" michael@480: pam_incdir="" michael@480: pam_libdir="" michael@480: michael@480: # search for configuration location michael@480: for cfgloc in \ michael@481: /etc/pam.d/other \ michael@480: /etc/pam.d \ michael@480: /etc/pam.conf \ michael@480: ; do michael@480: if [ -f $cfgloc -o -d $cfgloc ]; then michael@480: pam_cfgloc="$cfgloc" michael@480: break michael@480: fi michael@480: done michael@480: michael@480: # search for module prefix michael@480: if [ -d $pam_cfgloc ]; then michael@480: mod=`cat $pam_cfgloc/* 2>/dev/null | grep -i '^#*[ ]*other' | head -1 | awk '{ print $3; }'` michael@480: elif [ -f $pam_cfgloc ]; then michael@480: mod=`cat $pam_cfgloc 2>/dev/null | grep -i '^#*[ ]*other' | head -1 | awk '{ print $4; }'` michael@481: if [ ".$mod" = . ]; then \ michael@481: mod=`cat $pam_cfgloc 2>/dev/null | grep -i '^#*[ ]*auth' | head -1 | awk '{ print $3; }'` michael@481: fi michael@480: else michael@480: mod="" michael@480: fi michael@480: case $mod in michael@480: pam_* ) pam_modpfx="" ;; michael@480: /*/pam_* ) pam_modpfx=`echo $mod | sed 's;^\(/.*/\)pam_[^/]*$;\1;'` ;; michael@480: esac michael@480: michael@480: # search for include directory michael@480: for incdir in \ michael@480: /usr/include \ michael@480: /usr/local/include \ michael@480: /opt/include \ michael@480: ; do michael@480: if [ -f "$incdir/security/pam_appl.h" ]; then michael@480: pam_incdir="$incdir" michael@480: break michael@480: fi michael@480: done michael@480: michael@480: # search for library directory michael@480: for libdir in \ michael@480: /lib \ michael@481: /lib64 \ michael@480: /usr/lib \ michael@481: /usr/lib64 \ michael@480: /usr/local/lib \ michael@481: /usr/local/lib64 \ michael@480: /opt/lib \ michael@481: /opt/lib64 \ michael@480: ; do michael@480: for ext in a so sl so.0; do michael@480: if [ -f "$libdir/libpam.$ext" ]; then michael@480: pam_libdir="$libdir" michael@480: break michael@480: fi michael@480: done michael@480: if [ ".$pam_libdir" != . ]; then michael@480: break michael@480: fi michael@480: done michael@480: michael@480: # make sure everything was found michael@480: if [ ".$pam_cfgloc" = . ] ||\ michael@480: [ ".$pam_incdir" = . ] ||\ michael@480: [ ".$pam_libdir" = . ]; then michael@480: set +x michael@480: ( echo "************************************************************" michael@480: echo "** ERROR: SOME PAM INFORMATION COULD NOT BE DETERMINED!!" michael@480: echo "** ERROR: SOME PAM INFORMATION COULD NOT BE DETERMINED!!" michael@480: echo "**" michael@480: echo "** We found out:" michael@480: echo "** PAM Config Location: \"${pam_cfgloc}\"" michael@480: echo "** PAM Module Prefix: \"${pam_modpfx}\"" michael@480: echo "** PAM Include Directory: \"${pam_incdir}\"" michael@480: echo "** PAM Library Directory: \"${pam_libdir}\"" michael@480: echo "**" michael@480: echo "** Unfortunately, some information is missing here." michael@480: echo "**" michael@480: echo "** Be sure to have all system PAM components installed" michael@480: echo "** in standard locations before building this package!" michael@480: echo "**" michael@480: echo "** ERROR: SOME PAM INFORMATION COULD NOT BE DETERMINED!!" michael@480: echo "** ERROR: SOME PAM INFORMATION COULD NOT BE DETERMINED!!" michael@480: echo "************************************************************" michael@480: ) | %{l_rpmtool} msg -b -t error michael@480: exit 1 michael@480: fi michael@480: michael@480: # install PAM tool michael@480: %{l_shtool} mkdir -f -p -m 755 \ michael@480: $RPM_BUILD_ROOT%{l_prefix}/sbin michael@480: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@480: -e 's;@l_platform@;%{l_platform -t};g' \ michael@480: %{SOURCE pamtool} $RPM_BUILD_ROOT%{l_prefix}/sbin/ michael@480: michael@480: # install rc file michael@480: %{l_shtool} mkdir -f -p -m 755 \ michael@480: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d michael@480: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@480: -e "s;@pam_cfgloc@;${pam_cfgloc};g" \ michael@480: -e "s;@pam_modpfx@;${pam_modpfx};g" \ michael@480: -e "s;@pam_incdir@;${pam_incdir};g" \ michael@480: -e "s;@pam_libdir@;${pam_libdir};g" \ michael@480: %{SOURCE rc.pam} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@480: michael@480: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} michael@480: michael@480: %files -f files michael@480: michael@480: %clean michael@480: