Changeset 700


Ignore:
Timestamp:
Feb 18, 2009, 11:30:15 PM (11 years ago)
Author:
Bruno Cornec
Message:

Except one remaining issue to fix with postgresql conf, this fossology setup creates a nice rpm for centos 5

Location:
projects/fossology/pbconf/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • projects/fossology/pbconf/trunk/fossology.pb

    r601 r700  
    121121# So the package name is indeed virtual
    122122#namingtype fossology = perl
     123#
     124# This project needs additional repository to be able to be built correctly
     125#
     126verepo centos-5-x86_64 = http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm,ftp://ftp.project-builder.org/centos/5/pb.repo
     127verepo centos-4-x86_64 = http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.x86_64.rpm,ftp://ftp.project-builder.org/centos/4/pb.repo
     128
  • projects/fossology/pbconf/trunk/fossology/rpm/fossology.spec

    r694 r700  
    9292grep -q kernel.shmmax /etc/sysctl.conf
    9393if [ $? -eq 0 ]; then
    94     perl -pi -e "s/kernel.shmmax\s*=.*/kernel.shmmax=512000000/" /etc/sysctl.conf
     94    perl -pi -e "s/^[#\s]*kernel.shmmax\s*=.*/kernel.shmmax=512000000/" /etc/sysctl.conf
    9595else
    9696    echo "kernel.shmmax=512000000" >> /etc/sysctl.conf
    9797fi
    9898
    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"
     99# Adjust postgresql config (described in detail in section 2.1.4) for Fossology
     100PGCONF=/var/lib/pgsql/data/postgresql.conf
     101if [ ! -f $PGCONF ]; then
     102    cp /usr/share/pgsql/postgresql.conf.sample $PGCONF
     103fi
     104grep -qw listen_addresses $PGCONF
     105if [ $? -eq 0 ]; then
     106    perl -pi -e "s/^[#\s]*listen_addresses.*=.*/listen_addresses = '*'/" $PGCONF
     107else
     108    echo "listen_addresses = '*'" >> $PGCONF
     109fi
     110grep -qw max_connections $PGCONF
     111if [ $? -eq 0 ]; then
     112    perl -pi -e "s/^[#\s]*max_connections.*=.*/max_connections = 50/" $PGCONF
     113else
     114    echo "max_connections = 50" >> $PGCONF
     115fi
     116grep -qw shared_buffers $PGCONF
     117if [ $? -eq 0 ]; then
     118    perl -pi -e "s/^[#\s]*shared_buffers.*=.*/shared_buffers = 32768/" $PGCONF
     119else
     120    echo "shared_buffers = 32768" >> $PGCONF
     121fi
     122grep -qw work_mem $PGCONF
     123if [ $? -eq 0 ]; then
     124    perl -pi -e "s/^[#\s]*work_mem.*=.*/work_mem = 10240/" $PGCONF
     125else
     126    echo "work_mem = 10240" >> $PGCONF
     127fi
     128# min max_fsm_relations*16, 6 bytes each
     129grep -qw max_fsm_pages $PGCONF
     130if [ $? -eq 0 ]; then
     131    perl -pi -e "s/^[#\s]*max_fsm_pages.*=.*/max_fsm_pages = 100000/" $PGCONF
     132else
     133    echo "max_fsm_pages = 100000" >> $PGCONF
     134fi
     135grep -qw fsync $PGCONF
     136if [ $? -eq 0 ]; then
     137    perl -pi -e "s/^[#\s]*fsync.*=.*/fsync = off/" $PGCONF
     138else
     139    echo "fsync = off" >> $PGCONF
     140fi
     141# recover from partial page writes
     142grep -qw full_page_writes $PGCONF
     143if [ $? -eq 0 ]; then
     144    perl -pi -e "s/^[#\s]*full_page_writes.*=.*/full_page_writes = off/" $PGCONF
     145else
     146    echo "full_page_writes = off" >> $PGCONF
     147fi
     148grep -qw commit_delay $PGCONF
     149if [ $? -eq 0 ]; then
     150    perl -pi -e "s/^[#\s]*commit_delay.*=.*/commit_delay = 1000/" $PGCONF
     151else
     152    echo "commit_delay = 1000" >> $PGCONF
     153fi
     154grep -qw effective_cache_size $PGCONF
     155if [ $? -eq 0 ]; then
     156    perl -pi -e "s/^[#\s]*effective_cache_size.*=.*/effective_cache_size = 25000/" $PGCONF
     157else
     158    echo "effective_cache_size = 25000" >> $PGCONF
     159fi
     160# -1 is disabled, 0 logs all statements
     161grep -qw log_min_duration_statement $PGCONF
     162if [ $? -eq 0 ]; then
     163    perl -pi -e "s/^[#\s]*log_min_duration_statement.*=.*/log_min_duration_statement = -1/" $PGCONF
     164else
     165    echo "log_min_duration_statement = -1" >> $PGCONF
     166fi
     167# prepend a time stamp to all log entries
     168grep -qw log_line_prefix $PGCONF
     169if [ $? -eq 0 ]; then
     170    perl -pi -e "s/^[#\s]*log_line_prefix.*=.*/log_line_prefix = '%t %h %c'/" $PGCONF
     171else
     172    echo "log_line_prefix = '%t %h %c'" >> $PGCONF
    118173fi
    119174
     
    122177if [ $? -eq 0 ]; then
    123178    /etc/init.d/postgresql start
    124 else
    125     /etc/init.d/postgresql reload
    126 fi
     179fi
     180chkconfig --add postgresql
     181
     182cat >> /var/lib/pgsql/data/pg_hba.conf << EOF
     183# Added for FOSSology connection
     184# Local connections
     185local   all         all                               md5
     186# IPv4 local connections:
     187host    all         all         127.0.0.1/32          md5
     188EOF
     189# reload doesn't seem to work here :-(
     190/etc/init.d/postgresql restart
    127191
    128192# Adjust PHP config (described in detail in section 2.1.5)
    129193grep -qw memory_limit PBPHPINI
    130194if [ $? -eq 0 ]; then
    131     perl -pi -e "s/memory_limit.*=.*/memory_limit = 702M/" PBPHPINI
     195    perl -pi -e "s/^[#\s]*memory_limit.*=.*/memory_limit = 702M/" PBPHPINI
    132196else
    133197    echo "memory_limit = 702M" >> PBPHPINI
     
    135199grep -qw post_max_size PBPHPINI
    136200if [ $? -eq 0 ]; then
    137     perl -pi -e "s/post_max_size.*=.*/post_max_size = 702M/" PBPHPINI
     201    perl -pi -e "s/^[#\s]*post_max_size.*=.*/post_max_size = 702M/" PBPHPINI
    138202else
    139203    echo "post_max_size = 702M" >> PBPHPINI
     
    141205grep -qw upload_max_filesize PBPHPINI
    142206if [ $? -eq 0 ]; then
    143     perl -pi -e "s/upload_max_filesize.*=.*/upload_max_filesize = 702M/" PBPHPINI
     207    perl -pi -e "s/^[#\s]*upload_max_filesize.*=.*/upload_max_filesize = 702M/" PBPHPINI
    144208else
    145209    echo "upload_max_filesize = 702M" >> PBPHPINI
    146210fi
     211grep -qw allow_call_time_pass_reference PBPHPINI
     212if [ $? -eq 0 ]; then
     213    perl -pi -e "s/^[#\s]*allow_call_time_pass_reference.*=.*/allow_call_time_pass_reference = On/" PBPHPINI
     214else
     215    echo "allow_call_time_pass_reference = On" >> PBPHPINI
     216fi
    147217
    148218# Add apache config for fossology (described in detail in section 2.1.6) - done in install
    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
    155 
    156219# Run the postinstall script
    157220/usr/lib/PBPROJ/fo-postinstall
     221
     222# Adds user httpd to fossy group
     223perl -pi -e 's/^fossy:x:([0-9]+):/fossy:x:$1:httpd/' /etc/group
     224
     225# httpd
     226LANGUAGE=C /etc/init.d/httpd status 2>&1 | grep -q stop
     227if [ $? -eq 0 ]; then
     228    /etc/init.d/httpd start
     229else
     230    /etc/init.d/httpd reload
     231fi
     232chkconfig --add httpd
    158233
    159234# Test that things are installed correctly
     
    173248# We should do some cleanup here (fossy account ...)
    174249/usr/lib/PBPROJ/fo-cleanold
    175 userdel fossy
    176 groupdel fossy
    177250
    178251%changelog
Note: See TracChangeset for help on using the changeset viewer.