[598] | 1 | #
|
---|
| 2 | # $Id$
|
---|
| 3 | #
|
---|
| 4 |
|
---|
| 5 | Name: PBREALPKG
|
---|
| 6 | Version: PBVER
|
---|
| 7 | Release: PBTAGPBSUF
|
---|
| 8 | License: PBLIC
|
---|
| 9 | Group: PBGRP
|
---|
| 10 | Url: PBURL
|
---|
| 11 | Source: PBREPO/PBSRC
|
---|
| 12 | #PBPATCHSRC
|
---|
| 13 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
|
---|
[694] | 14 | Requires: postgresql php php-pear php-pgsql libxml2 binutils bzip2 cpio mkisofs poppler-utils rpm tar unzip gzip httpd which PBDEP
|
---|
[616] | 15 | BuildRequires: postgresql-devel libxml2 gcc make perl PBBUILDDEP
|
---|
[606] | 16 | Summary: FOSSology is a licenses exploration tool
|
---|
| 17 | Summary(fr): FOSSology est un outil d'exploration de licenses
|
---|
[598] | 18 |
|
---|
[606] | 19 | %package devel
|
---|
| 20 | Summary: Devel part of FOSSology (a licenses exploration tool)
|
---|
| 21 | Summary(fr): Partie dedévelopment de FOSSology, outil d'exploration de licenses
|
---|
| 22 | Group: PBGRP
|
---|
| 23 |
|
---|
[598] | 24 | %description
|
---|
| 25 | PBDESC
|
---|
| 26 |
|
---|
| 27 | %description -l fr
|
---|
[599] | 28 | FOSSology est un outil d'exploration de licenses
|
---|
[598] | 29 |
|
---|
[606] | 30 | %description devel
|
---|
| 31 | Devel part.
|
---|
| 32 | PBDESC
|
---|
| 33 |
|
---|
| 34 | %description -l fr devel
|
---|
| 35 | Partie développement de FOSSology, outil d'exploration de licenses
|
---|
| 36 |
|
---|
[598] | 37 | %prep
|
---|
| 38 | %setup -q
|
---|
| 39 | #PBPATCHCMD
|
---|
| 40 |
|
---|
| 41 | %build
|
---|
[688] | 42 | make SYSCONFDIR=%{_sysconfdir}
|
---|
| 43 | #make %{?_smp_mflags} SYSCONFDIR=%{_sysconfdir}
|
---|
[598] | 44 |
|
---|
| 45 | %install
|
---|
| 46 | %{__rm} -rf $RPM_BUILD_ROOT
|
---|
[610] | 47 | make DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_usr} SYSCONFDIR=%{_sysconfdir} LOCALSTATEDIR=%{_var} LIBDIR=%{_libdir} install
|
---|
[605] | 48 | mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/httpd/conf.d
|
---|
[606] | 49 | cat > $RPM_BUILD_ROOT/%{_sysconfdir}/httpd/conf.d/PBPROJ.conf << EOF
|
---|
| 50 | Alias /repo/ /usr/share/PBPROJ/www/
|
---|
| 51 | <Directory "/usr/share/PBPROJ/www">
|
---|
[602] | 52 | AllowOverride None
|
---|
| 53 | Options FollowSymLinks MultiViews
|
---|
| 54 | Order allow,deny
|
---|
| 55 | Allow from all
|
---|
| 56 | # uncomment to turn on php error reporting
|
---|
| 57 | #php_flag display_errors on
|
---|
| 58 | #php_value error_reporting 2039
|
---|
| 59 | </Directory>
|
---|
| 60 | EOF
|
---|
[694] | 61 | cp utils/fo-cleanold $RPM_BUILD_ROOT/%{_usr}/lib/PBPROJ/
|
---|
[598] | 62 |
|
---|
[624] | 63 | #rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/default/PBPROJ
|
---|
[616] | 64 |
|
---|
[598] | 65 | %clean
|
---|
| 66 | %{__rm} -rf $RPM_BUILD_ROOT
|
---|
| 67 |
|
---|
| 68 | %files
|
---|
| 69 | %defattr(-,root,root)
|
---|
| 70 | %doc ChangeLog
|
---|
[603] | 71 | %doc COPYING COPYING.LGPL HACKING README INSTALL INSTALL.multi LICENSE
|
---|
| 72 | #AUTHORS NEWS
|
---|
[616] | 73 | %config(noreplace) %{_sysconfdir}/httpd/conf.d/*.conf
|
---|
| 74 | %config(noreplace) %{_sysconfdir}/cron.d/*
|
---|
| 75 | %config(noreplace) %{_sysconfdir}/PBPROJ/*
|
---|
[606] | 76 | %dir %{_sysconfdir}/PBPROJ
|
---|
[616] | 77 | %dir %{_usr}/lib/PBPROJ
|
---|
[606] | 78 | %dir %{_datadir}/PBPROJ
|
---|
[616] | 79 | %{_sysconfdir}/init.d/*
|
---|
[606] | 80 | %{_usr}/lib/PBPROJ/*
|
---|
| 81 | %{_datadir}/PBPROJ/*
|
---|
[603] | 82 | %{_bindir}/*
|
---|
| 83 | %{_mandir}/man1/*
|
---|
[598] | 84 |
|
---|
[606] | 85 | %files devel
|
---|
| 86 | %{_includedir}/*
|
---|
[610] | 87 | %{_libdir}/*.a
|
---|
[606] | 88 |
|
---|
[602] | 89 | %post
|
---|
| 90 | # Adjust the kernel shmmax (described in detail in section 2.1.3)
|
---|
| 91 | echo 512000000 > /proc/sys/kernel/shmmax
|
---|
| 92 | grep -q kernel.shmmax /etc/sysctl.conf
|
---|
| 93 | if [ $? -eq 0 ]; then
|
---|
| 94 | perl -pi -e "s/kernel.shmmax\s*=.*/kernel.shmmax=512000000/" /etc/sysctl.conf
|
---|
| 95 | else
|
---|
| 96 | echo "kernel.shmmax=512000000" >> /etc/sysctl.conf
|
---|
| 97 | fi
|
---|
| 98 |
|
---|
[694] | 99 | if [ ! -f /usr/share/pgsql/postgresql.conf ]; then
|
---|
| 100 | cp /usr/share/pgsql/postgresql.conf.sample /usr/share/pgsql/postgresql.conf
|
---|
| 101 |
|
---|
| 102 | # Adjust postgresql config (described in detail in section 2.1.4) for Fossology
|
---|
| 103 | cat >> /usr/share/pgsql/postgresql.conf << EOF
|
---|
| 104 | listen_addresses = '*'
|
---|
| 105 | max_connections = 50
|
---|
| 106 | shared_buffers = 32768
|
---|
| 107 | work_mem = 10240
|
---|
| 108 | max_fsm_pages = 100000 # min max_fsm_relations*16, 6 bytes each
|
---|
| 109 | fsync = off
|
---|
| 110 | full_page_writes = off # recover from partial page writes
|
---|
| 111 | commit_delay = 1000
|
---|
| 112 | effective_cache_size = 25000
|
---|
| 113 | log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements
|
---|
| 114 | log_line_prefix = '%t %h %c' # prepend a time stamp to all log entries
|
---|
| 115 | EOF
|
---|
| 116 | else
|
---|
| 117 | echo "Please check that your postgresql configuration is aligned with fossology recommendations at section 2.1.4 of /usr/share/doc/fossology*/INSTALL"
|
---|
| 118 | fi
|
---|
| 119 |
|
---|
| 120 | # Check postgresql is running
|
---|
| 121 | LANGUAGE=C /etc/init.d/postgresql status 2>&1 | grep -q stop
|
---|
| 122 | if [ $? -eq 0 ]; then
|
---|
| 123 | /etc/init.d/postgresql start
|
---|
| 124 | else
|
---|
| 125 | /etc/init.d/postgresql reload
|
---|
| 126 | fi
|
---|
| 127 |
|
---|
[602] | 128 | # Adjust PHP config (described in detail in section 2.1.5)
|
---|
[610] | 129 | grep -qw memory_limit PBPHPINI
|
---|
| 130 | if [ $? -eq 0 ]; then
|
---|
| 131 | perl -pi -e "s/memory_limit.*=.*/memory_limit = 702M/" PBPHPINI
|
---|
| 132 | else
|
---|
| 133 | echo "memory_limit = 702M" >> PBPHPINI
|
---|
| 134 | fi
|
---|
| 135 | grep -qw post_max_size PBPHPINI
|
---|
| 136 | if [ $? -eq 0 ]; then
|
---|
| 137 | perl -pi -e "s/post_max_size.*=.*/post_max_size = 702M/" PBPHPINI
|
---|
| 138 | else
|
---|
| 139 | echo "post_max_size = 702M" >> PBPHPINI
|
---|
| 140 | fi
|
---|
| 141 | grep -qw upload_max_filesize PBPHPINI
|
---|
| 142 | if [ $? -eq 0 ]; then
|
---|
| 143 | perl -pi -e "s/upload_max_filesize.*=.*/upload_max_filesize = 702M/" PBPHPINI
|
---|
| 144 | else
|
---|
| 145 | echo "upload_max_filesize = 702M" >> PBPHPINI
|
---|
| 146 | fi
|
---|
[602] | 147 |
|
---|
| 148 | # Add apache config for fossology (described in detail in section 2.1.6) - done in install
|
---|
[694] | 149 | LANGUAGE=C /etc/init.d/httpd status 2>&1 | grep -q stop
|
---|
| 150 | if [ $? -eq 0 ]; then
|
---|
| 151 | /etc/init.d/httpd start
|
---|
| 152 | else
|
---|
| 153 | /etc/init.d/httpd reload
|
---|
| 154 | fi
|
---|
[602] | 155 |
|
---|
| 156 | # Run the postinstall script
|
---|
[606] | 157 | /usr/lib/PBPROJ/fo-postinstall
|
---|
[602] | 158 |
|
---|
| 159 | # Test that things are installed correctly
|
---|
[606] | 160 | /usr/lib/PBPROJ/fossology-scheduler -t
|
---|
[602] | 161 | if [ $? -ne 0 ]; then
|
---|
| 162 | exit -1
|
---|
| 163 | fi
|
---|
| 164 |
|
---|
[606] | 165 | chkconfig --add PBPROJ
|
---|
| 166 | /etc/init.d/PBPROJ start
|
---|
[602] | 167 |
|
---|
[640] | 168 | %preun
|
---|
| 169 | # If FOSSology is running, stop it before removing.
|
---|
| 170 | /etc/init.d/PBPROJ stop
|
---|
| 171 | chkconfig --del PBPROJ 2>&1 > /dev/null
|
---|
| 172 |
|
---|
[694] | 173 | # We should do some cleanup here (fossy account ...)
|
---|
| 174 | /usr/lib/PBPROJ/fo-cleanold
|
---|
| 175 | userdel fossy
|
---|
| 176 | groupdel fossy
|
---|
| 177 |
|
---|
[598] | 178 | %changelog
|
---|
| 179 | PBLOG
|
---|