CASA/shsrc/lshsrc/mk-micasa-rpmpkg

380 lines
15 KiB
Plaintext
Raw Normal View History

#!/bin/bash
set -x
cd ../..
PR=`pwd`
cd $PR/make
MAJ_SSS_NO=`cat majver.txt`
MIN_SSS_NO=`cat minver.txt`
REV_SSS_NO=`cat revver.txt`
export BLD_NO=$MAJ_SSS_NO.$MIN_SSS_NO.$REV_SSS_NO
export PROD_NUM=$MAJ_SSS_NO
cd $PR/lib/lux/
BR=`pwd`
mkdir -p $BR/pkg
mkdir -p $BR/pkg/BUILD/
mkdir -p $BR/pkg/RPMS/
mkdir -p $BR/pkg/RPMS/i386/
mkdir -p $BR/pkg/casa_area/
# save the original .rpmmacros
if [ -f ~/.rpmmacros ]
then
mv ~/.rpmmacros ~/.rpmmacros.orig
fi
# append these to the .rpmmacros
echo "%_topdir $BR/pkg/" >> ~/.rpmmacros
echo "%version $BLD_NO" >> ~/.rpmmacros
echo "%release $MAJ_SSS_NO" >> ~/.rpmmacros
cp -f $PR/lib/lux/ndbg/libmicasa.so.$BLD_NO $BR/pkg/BUILD/
cp -f $PR/lib/lux/ndbg/libad_gk.so.$BLD_NO $BR/pkg/BUILD/
cp -f $PR/lib/lux/ndbg/libkwallets_rw.so.$BLD_NO $BR/pkg/BUILD/
cp -f $PR/lib/lux/ndbg/libjmicasa.so.$BLD_NO $BR/pkg/BUILD/
cp -f $PR/lib/lux/ndbg/Novell.CASA.miCASAWrapper.dll $BR/pkg/BUILD/
cp -f $PR/lib/lux/ndbg/Novell.CASA.Common.dll $BR/pkg/BUILD/
cp -f $PR/lib/lux/ndbg/Novell.CASA.A-D.dll $BR/pkg/BUILD/
cp -f $PR/lib/lux/ndbg/Novell.CASA.CASAPolicy.dll $BR/pkg/BUILD/
cp -f $PR/lib/lux/ndbg/Novell.CASA.DataEngines.GnomeKeyring.dll $BR/pkg/BUILD/
cp -f $PR/lib/lux/ndbg/Novell.CASA.DataEngines.KWallet.dll $BR/pkg/BUILD/
cp -f $PR/bin/lux/ndbg/micasad.exe $BR/pkg/BUILD/
cp -f $PR/bin/lux/ndbg/CASATrayApp.exe $BR/pkg/BUILD/
cp -f $PR/bin/lux/ndbg/CASAManager.exe $BR/pkg/BUILD/
cp -f $PR/c_gui/CASAManager.sh $BR/pkg/BUILD/
cp -f $PR/c_gui/images/* $BR/pkg/BUILD/
cp -f $PR/c_micasad/startup/micasad $BR/pkg/BUILD
cp -f $PR/c_micasad/startup/micasad.sh $BR/pkg/BUILD
cp -f $PR/lib/lux/ndbg/pam_micasa.so $BR/pkg/BUILD/
# create the direcories and set the rights on them
cd $BR/pkg/casa_area
install -m 755 -d opt/novell/CASA/
install -m 755 -d opt/novell/CASA/lib
install -m 755 -d opt/novell/CASA/bin
install -m 755 -d opt/novell/CASA/images
install -m 755 -d opt/novell/CASA/doc
install -m 755 -d opt/novell/CASA/pixmaps
install -m 755 -d opt/novell/CASA/startup
install -m 755 -d etc/init.d/
install -m 755 -d lib/security
# copy the files to the restpected directories and set the rights on them
cd $BR/pkg/BUILD
install -m 755 libmicasa.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 libad_gk.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 libkwallets_rw.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 libjmicasa.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 Novell.CASA.miCASAWrapper.dll $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 Novell.CASA.Common.dll $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 Novell.CASA.A-D.dll $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 Novell.CASA.CASAPolicy.dll $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 Novell.CASA.DataEngines.GnomeKeyring.dll $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 Novell.CASA.DataEngines.KWallet.dll $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 micasad.exe $BR/pkg/casa_area/opt/novell/CASA/bin
install -m 755 CASATrayApp.exe $BR/pkg/casa_area/opt/novell/CASA/bin
install -m 755 CASAManager.exe $BR/pkg/casa_area/opt/novell/CASA/bin
install -m 755 CASAManager.sh $BR/pkg/casa_area/opt/novell/CASA/bin
install -m 755 micasad.sh $BR/pkg/casa_area/opt/novell/CASA/bin
install -m 755 micasad $BR/pkg/casa_area/etc/init.d/
install -m 755 pam_micasa.so $BR/pkg/casa_area/lib/security
install -m 755 casa-1.5.glade $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 casa-1.5.gladep $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 firefox-logo.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 keyring-logo.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 kwallet-logo.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 casa-logo.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 micasa-logo.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 mozilla-logo.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 novell-logo.png $BR/pkg/casa_area/opt/novell/CASA/images
2005-10-14 19:20:19 +02:00
install -m 755 CASA_16.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 CASA_32.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 CASA_48.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 CASAicons.ico $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 CASAiconsLocked.ico $BR/pkg/casa_area/opt/novell/CASA/images
# -bb and --buildroot are rpmbuild (rpmb) options that should be included
# in /etc/popt, for rpm to work check "man rpm" and "man rpmbuild" search for -bb for
# instructions. --buildroot should be added separately.
#Create the rpm spec file on the fly
cat << E/O/F > $BR/pkg/novell-CASA.spec
Summary : Novell Client Authentication Service Adapter Identity Store (CASA)
Name : novell-CASA
Version : %version
Release : %release
Group : System/Cryptography
Copyright: 1998-2005 Novell, Inc. All Rights Reserved
Distribution : Novell
URL : http://www.novell.com/
Packager : Novell Inc.
AutoReqProv: no
Vendor : Novell Inc.
BuildArchitectures: i386 x86_64
2005-10-12 17:59:24 +02:00
requires: mono >= 1.1.8
%description
NOVELL Client Authentication Service Adapter (CASA).
%prep
%build
%install
install -m 755 -d $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 -d $BR/pkg/casa_area/opt/novell/CASA/bin
install -m 755 -d $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 -d $BR/pkg/casa_area/opt/novell/CASA/doc
install -m 755 -d $BR/pkg/casa_area/opt/novell/CASA/pixmaps
install -m 755 -d $BR/pkg/casa_area/opt/novell/CASA/startup
install -m 755 -d $BR/pkg/casa_area/etc/init.d/
install -m 755 -d $BR/pkg/casa_area/lib/security
install -m 755 libmicasa.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 libad_gk.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 libkwallets_rw.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 libjmicasa.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 Novell.CASA.miCASAWrapper.dll $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 Novell.CASA.Common.dll $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 Novell.CASA.A-D.dll $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 Novell.CASA.CASAPolicy.dll $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 Novell.CASA.DataEngines.GnomeKeyring.dll $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 Novell.CASA.DataEngines.KWallet.dll $BR/pkg/casa_area/opt/novell/CASA/lib
install -m 755 micasad.exe $BR/pkg/casa_area/opt/novell/CASA/bin
install -m 755 CASATrayApp.exe $BR/pkg/casa_area/opt/novell/CASA/bin
install -m 755 CASAManager.exe $BR/pkg/casa_area/opt/novell/CASA/bin
install -m 755 CASAManager.sh $BR/pkg/casa_area/opt/novell/CASA/bin
install -m 755 micasad.sh $BR/pkg/casa_area/opt/novell/CASA/bin
install -m 755 micasad $BR/pkg/casa_area/etc/init.d
install -m 755 pam_micasa.so $BR/pkg/casa_area/lib/security
install -m 755 casa-1.5.glade $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 casa-1.5.gladep $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 firefox-logo.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 keyring-logo.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 kwallet-logo.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 casa-logo.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 micasa-logo.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 mozilla-logo.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 novell-logo.png $BR/pkg/casa_area/opt/novell/CASA/images
2005-10-14 19:20:19 +02:00
install -m 755 CASA_16.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 CASA_32.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 CASA_48.png $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 CASAicons.ico $BR/pkg/casa_area/opt/novell/CASA/images
install -m 755 CASAiconsLocked.ico $BR/pkg/casa_area/opt/novell/CASA/images
ln -sf libmicasa.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib/libmicasa.so
ln -sf libmicasa.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib/libmicasa.so.$MAJ_SSS_NO
ln -sf libkwallets_rw.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib/libkwallets_rw.so
ln -sf libkwallets_rw.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib/libkwallets_rw.so.$MAJ_SSS_NO
ln -sf libad_gk.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib/libad_gk.so
ln -sf libad_gk.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib/libad_gk.so.$MAJ_SSS_NO
ln -sf libjmicasa.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib/libjmicasa.so
ln -sf libjmicasa.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib/libjmicasa.so.$MAJ_SSS_NO
#ln -sf libmicasawrapper.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib/libmicasawrapper.so
#ln -sf libmicasawrapper.so.$BLD_NO $BR/pkg/casa_area/opt/novell/CASA/lib/libmicasawrapper.so.$MAJ_SSS_NO
%post
insserv /etc/init.d/micasad
echo "/opt/novell/CASA/lib/" >> /etc/ld.so.conf
/sbin/ldconfig
perl -e '
my @fileList = ("/etc/pam.d/xdm", "/etc/pam.d/gdm", "/etc/pam.d/kdm", "/etc/pam.d/login", "/etc/pam.d/sshd");
for (my \$j = 0; \$j <= \$#fileList; \$j++)
{
my \$filename = \$fileList [\$j];
if (-e \$filename)
{
print "Adding PAM module to \$filename\n";
my \$auth_line_to_be_inserted = "auth required pam_micasa.so";
my \$session_line_to_be_inserted = "session required pam_micasa.so";
open (FILE, "<\$filename") || die ("Cannot open file reading");
my @data = <FILE>;
close (FILE);
my \$auth_index = 0;
my \$session_index = 0;
for (my \$i = 0; \$i <= \$#data; \$i++)
{
my \$line = \$data [\$i];
if (\$line =~ /^auth.*/)
{
\$auth_index = \$i;
}
if (\$line =~ /^session.*/)
{
\$session_index = \$i;
}
}
open (FILE, ">\$filename") || die ("Cannot open file for writing");
for (my \$i = 0; \$i <= \$#data; \$i++)
{
print FILE \$data [\$i];
if (\$i == \$auth_index)
{
print FILE \$auth_line_to_be_inserted."\n";
}
if (\$i == \$session_index)
{
print FILE \$session_line_to_be_inserted."\n";
}
}
}
}
'
%files
%attr(755,root,root)/opt/novell/CASA/lib/libmicasa.so.$BLD_NO
%attr(755,root,root)/opt/novell/CASA/lib/libmicasa.so.$MAJ_SSS_NO
%attr(755,root,root)/opt/novell/CASA/lib/libmicasa.so
%attr(755,root,root)/opt/novell/CASA/lib/libkwallets_rw.so.$BLD_NO
%attr(755,root,root)/opt/novell/CASA/lib/libkwallets_rw.so.$MAJ_SSS_NO
%attr(755,root,root)/opt/novell/CASA/lib/libkwallets_rw.so
%attr(755,root,root)/opt/novell/CASA/lib/libad_gk.so.$BLD_NO
%attr(755,root,root)/opt/novell/CASA/lib/libad_gk.so.$MAJ_SSS_NO
%attr(755,root,root)/opt/novell/CASA/lib/libad_gk.so
%attr(755,root,root)/opt/novell/CASA/lib/libjmicasa.so.$BLD_NO
%attr(755,root,root)/opt/novell/CASA/lib/libjmicasa.so.$MAJ_SSS_NO
%attr(755,root,root)/opt/novell/CASA/lib/libjmicasa.so
#%attr(755,root,root)/opt/novell/CASA/lib/libmicasawrapper.so.$BLD_NO
#%attr(755,root,root)/opt/novell/CASA/lib/libmicasawrapper.so.$MAJ_SSS_NO
#%attr(755,root,root)/opt/novell/CASA/lib/libmicasawrapper.so
%attr(755,root,root)/opt/novell/CASA/lib/Novell.CASA.miCASAWrapper.dll
%attr(755,root,root)/opt/novell/CASA/lib/Novell.CASA.Common.dll
%attr(755,root,root)/opt/novell/CASA/lib/Novell.CASA.A-D.dll
%attr(755,root,root)/opt/novell/CASA/lib/Novell.CASA.CASAPolicy.dll
%attr(755,root,root)/opt/novell/CASA/lib/Novell.CASA.DataEngines.GnomeKeyring.dll
%attr(755,root,root)/opt/novell/CASA/lib/Novell.CASA.DataEngines.KWallet.dll
%attr(755,root,root)/opt/novell/CASA/bin/micasad.exe
%attr(755,root,root)/opt/novell/CASA/bin/CASATrayApp.exe
%attr(755,root,root)/opt/novell/CASA/bin/CASAManager.exe
%attr(755,root,root)/opt/novell/CASA/bin/CASAManager.sh
%attr(755,root,root)/opt/novell/CASA/bin/micasad.sh
%attr(755,root,root)/etc/init.d/micasad
%attr(755,root,root)/lib/security/pam_micasa.so
%attr(755,root,root)/opt/novell/CASA/images/casa-1.5.glade
%attr(755,root,root)/opt/novell/CASA/images/casa-1.5.gladep
%attr(755,root,root)/opt/novell/CASA/images/firefox-logo.png
%attr(755,root,root)/opt/novell/CASA/images/keyring-logo.png
%attr(755,root,root)/opt/novell/CASA/images/kwallet-logo.png
%attr(755,root,root)/opt/novell/CASA/images/casa-logo.png
%attr(755,root,root)/opt/novell/CASA/images/micasa-logo.png
%attr(755,root,root)/opt/novell/CASA/images/mozilla-logo.png
%attr(755,root,root)/opt/novell/CASA/images/novell-logo.png
2005-10-14 19:20:19 +02:00
%attr(755,root,root)/opt/novell/CASA/images/CASA_16.png
%attr(755,root,root)/opt/novell/CASA/images/CASA_32.png
%attr(755,root,root)/opt/novell/CASA/images/CASA_48.png
%attr(755,root,root)/opt/novell/CASA/images/CASAicons.ico
%attr(755,root,root)/opt/novell/CASA/images/CASAiconsLocked.ico
%preun
perl -e '
my @fileList = ("/etc/pam.d/xdm", "/etc/pam.d/gdm", "/etc/pam.d/kdm", "/etc/pam.d/login", "/etc/pam.d/sshd" );
for (my \$j = 0; \$j <= \$#fileList; \$j++)
{
my \$filename = \$fileList [\$j];
if (-e \$filename)
{
print "Removing PAM module from \$filename\n";
open (FILE, "<\$filename") || die ("Cannot open file reading");
my @data = <FILE>;
close (FILE);
open (FILE, ">\$filename") || die ("Cannot open file for writing");
for (my \$i = 0; \$i <= \$#data; \$i++)
{
my \$line = \$data [\$i];
if (\$line =~ /pam_micasa.so/)
{
}
else
{
print FILE \$data [\$i];
}
}
close (FILE);
}
}
'
perl -e '
my \$filename = "/etc/ld.so.conf";
if (-e \$filename)
{
open (FILE, "<\$filename") || die ("Cannot open file reading");
my @data = <FILE>;
close (FILE);
open (FILE, ">\$filename") || die ("Cannot open file for writing");
for (my \$i = 0; \$i <= \$#data; \$i++)
{
my \$line = \$data [\$i];
if (\$line =~ /CASA/)
{
}
else
{
print FILE \$data [\$i];
}
}
close (FILE);
}
'
rm -rf /opt/novell/CASA
/sbin/ldconfig
insserv -r /etc/init.d/micasad
rm /etc/init.d/micasad
rm /lib/security/pam_micasa.so
E/O/F
(cd $BR/pkg/casa_area; pwd; rpmbuild -bb --buildroot $BR/pkg/casa_area ../novell-CASA.spec)
#restore the .rpmmacros file
if [ -f ~/.rpmmacros.orig ]
then
mv ~/.rpmmacros.orig ~/.rpmmacros
fi
if [ -r $BR/pkg/RPMS/i386/novell-CASA-*.rpm ]
then
echo Linux CASA-binary Package Done
cp -f $BR/pkg/RPMS/i386/novell-CASA-*.rpm $PR/products/install/lux
cd $BR/pkg
rm -rf *
exit 0
fi
if [ -r $BR/pkg/RPMS/x86_64/novell-CASA-*.rpm ]
then
echo Linux CASA-binary Package Done
cp -f $BR/pkg/RPMS/x86_64/novell-CASA-*.rpm $PR/products/install/lux
cd $BR/pkg
rm -rf *
exit 0
fi
echo Building Linux CASA-binary Package Failed
cd $BR/pkg
rm -rf *
exit 1