Bug 1172005 - .postinstall
Summary: .postinstall
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss Web Server 3
Classification: Retired
Component: unspecified
Version: 3.0.0
Hardware: Unspecified
OS: Linux
unspecified
urgent
Target Milestone: Beta
: 3.0.0
Assignee: Weinan Li
QA Contact: Libor Fuka
URL:
Whiteboard:
Depends On:
Blocks: 1178630
TreeView+ depends on / blocked
 
Reported: 2014-12-09 08:19 UTC by Libor Fuka
Modified: 2020-03-27 18:37 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2020-03-27 18:37:23 UTC
Embargoed:


Attachments (Terms of Use)

Description Libor Fuka 2014-12-09 08:19:26 UTC
Description of problem:
There are lines of code in .postinstall which are for ews 2.1 version. Please check all code in .postinstall in jws-3.0
for example:
sed -i -e "s:/var/www:jboss-ews-2.1/httpd/www:g" -e "s:/etc/httpd:jboss-ews-2.1/httpd:g" www/error/noindex.html
mod_snmp module is also not in jws-30. The lines of code shoudl be removed.

Version-Release number of selected component (if applicable):
jws-httpd-3.0.0-DR0-RHEL*.zip

Comment 1 Weinan Li 2014-12-11 08:27:20 UTC
Fix:

[weli@dhcp-66-78-87 jws-compose]$ git diff
diff --git a/jws-compose.spec b/jws-compose.spec
index 9403a02..e0eb852 100644
--- a/jws-compose.spec
+++ b/jws-compose.spec
@@ -224,6 +224,8 @@ unzip -q %{_javadir}/jbossas-fordev/httpd-%{httpdversion}.zip
 cp -pr %{_docdir}/%{httpd}-%{httpdversion}/{ABOUT_APACHE,README,CHANGES,LICENSE,VERSIONING,NOTICE} httpd/

 cp %{SOURCE4} httpd/.postinstall
+sed -i -e 's/${pkgdir}/%{zipname}-%{ews_major}.%{ews_minor}/g' httpd/.postinstall
+
 chmod 755 httpd/.postinstall httpd/sbin/*
 sed -i -e '/# Source ..\/conf\/httpd.conf/,/fi/d' httpd/sbin/apachectl
 sed -i -e 's:my $installbuilddir = $libdir . "/%{httpd}/build";:my $installbuilddir = "$ENV{EWS_HOME}/httpd/lib/build";:' \
diff --git a/postinstall b/postinstall
index 23eab74..a3b9560 100644
--- a/postinstall
+++ b/postinstall
@@ -42,15 +42,8 @@ if [ -f 'conf.d/mod_cluster.conf' ]; then
     sed -i -e "s:MemManagerFile cache/mod_cluster:MemManagerFile $currentDir/cache/mod_cluster:" conf.d/mod_cluster.conf
 fi

-#JBPAPP-9746
-if [ -f 'conf.d/mod_snmp.conf.sample' ]; then
-    mkdir -p $currentDir/var/cache/mod_snmp
-    sed -i -e "s:SNMPVar /var/cache/mod_snmp:SNMPVar $currentDir/var/cache/mod_snmp:" conf.d/mod_snmp.conf.sample
-    sed -i -e "s:SNMPConf /etc/httpd/conf.d/snmpd:SNMPConf $currentDir/conf.d/snmpd:" conf.d/mod_snmp.conf.sample
-fi
-
 #JBPAPP-9381
-sed -i -e "s:/var/www:jboss-ews-2.1/httpd/www:g" -e "s:/etc/httpd:jboss-ews-2.1/httpd:g" www/error/noindex.html
+sed -i -e "s:/var/www:${pkgdir}/httpd/www:g" -e "s:/etc/httpd:${pkgdir}/httpd:g" www/error/noindex.html

 #JBPAPP-9446
 sed -i -e "s:LoadModule proxy_balancer_module:#LoadModule proxy_balancer_module:" conf/httpd.conf

Comment 2 Weinan Li 2014-12-11 08:27:48 UTC
Verified locally:

[weli@dhcp-66-78-87 x86_64]$ unzip -l ./usr/share/java/jbossas-fordev/jws-httpd-3.0.0-RHEL6-x86_64.zip | grep postinstall
     1594  12-11-2014 16:23   jws-3.0/httpd/.postinstall
[weli@dhcp-66-78-87 x86_64]$ unzip ./usr/share/java/jbossas-fordev/jws-httpd-3.0.0-RHEL6-x86_64.zip jws-3.0/httpd/.postinstall
Archive:  ./usr/share/java/jbossas-fordev/jws-httpd-3.0.0-RHEL6-x86_64.zip
  inflating: jws-3.0/httpd/.postinstall
[weli@dhcp-66-78-87 x86_64]$ cat jws-3.0/httpd/.postinstall
#!/bin/sh
#
umask 077

if [ ! -f /etc/pki/tls/private/localhost.key ] ; then
openssl genrsa -rand /proc/apm:/proc/cpuinfo:/proc/dma:/proc/filesystems:/proc/interrupts:/proc/ioports:/proc/pci:/proc/rtc:/proc/uptime 1024 > /etc/pki/tls/private/localhost.key 2> /dev/null
fi

FQDN=`hostname`
if [ "x${FQDN}" = "x" ]; then
   FQDN=localhost.localdomain
fi

if [ ! -f /etc/pki/tls/certs/localhost.crt ] ; then
cat << EOF | openssl req -new -key /etc/pki/tls/private/localhost.key \
         -x509 -days 365 -set_serial $RANDOM \
         -out /etc/pki/tls/certs/localhost.crt 2>/dev/null
--
SomeState
SomeCity
SomeOrganization
SomeOrganizationalUnit
${FQDN}
root@${FQDN}
EOF
fi


currentDir=`pwd`
sed -i -e "s: modules/: $currentDir/modules/:g" -e "s:/var/www:$currentDir/www:g" -e "s:ServerRoot \"/etc/httpd\":ServerRoot \"$currentDir\":" conf/httpd.conf
cat > .tmppostinstallfile << EOF
# the options for httpd command
OPTIONS="-f $currentDir/conf/httpd.conf -E $currentDir/logs/httpd.log"
# the library path
export LD_LIBRARY_PATH=$currentDir/lib
EOF
sed -i -e "s:HTTPD='./httpd':HTTPD='$currentDir/sbin/httpd':g" -e "/HTTPD=/r .tmppostinstallfile" sbin/apachectl
rm -f .tmppostinstallfile

#JBPAPP-9446
if [ -f 'conf.d/mod_cluster.conf' ]; then
    sed -i -e "s:MemManagerFile cache/mod_cluster:MemManagerFile $currentDir/cache/mod_cluster:" conf.d/mod_cluster.conf
fi

#JBPAPP-9381
sed -i -e "s:/var/www:jws-3.0/httpd/www:g" -e "s:/etc/httpd:jws-3.0/httpd:g" www/error/noindex.html

#JBPAPP-9446
sed -i -e "s:LoadModule proxy_balancer_module:#LoadModule proxy_balancer_module:" conf/httpd.conf

Comment 3 Libor Fuka 2015-01-08 09:52:54 UTC
Verified with DR0.1 RHEL6 and RHEL7


Note You need to log in before you can comment on or make changes to this bug.