Commit eb6bcf34792ee765707007d71e47a5f1c3097115

Authored by David Silva
1 parent ed2e857d
Exists in spec_refactor

Adds noosfero_libdir macro. Points to /usr/lib/noosfero

Showing 1 changed file with 20 additions and 18 deletions   Show diff stats
src/pkg-rpm/noosfero/noosfero.spec
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 %define cache_dirs javascripts/cache stylesheets/cache 2 %define cache_dirs javascripts/cache stylesheets/cache
3 3
4 %global noosfero_etcdir /etc/noosfero 4 %global noosfero_etcdir /etc/noosfero
  5 +
5 # Using this intead of %{_libdir}, because noosfero it's noarch 6 # Using this intead of %{_libdir}, because noosfero it's noarch
6 %global noosfero_libdir /usr/lib/noosfero 7 %global noosfero_libdir /usr/lib/noosfero
7 %global _initdir /etc/init.d 8 %global _initdir /etc/init.d
@@ -37,10 +38,10 @@ participate and contribute to this free software project! @@ -37,10 +38,10 @@ participate and contribute to this free software project!
37 38
38 %build 39 %build
39 40
40 -ln -sf /usr/lib/noosfero/Gemfile .  
41 -ln -sf /usr/lib/noosfero/Gemfile.lock .  
42 -ln -sf /usr/lib/noosfero/.bundle .  
43 -ln -sfT /usr/lib/noosfero/vendor/bundle vendor/bundle 41 +ln -sf %{noosfero_libdir}/Gemfile .
  42 +ln -sf %{noosfero_libdir}/Gemfile.lock .
  43 +ln -sf %{noosfero_libdir}/.bundle .
  44 +ln -sfT %{noosfero_libdir}/vendor/bundle vendor/bundle
44 bundle exec rake -f Rakefile.release noosfero:translations:compile > build.log 2>&1 || (cat build.log; exit 1) 45 bundle exec rake -f Rakefile.release noosfero:translations:compile > build.log 2>&1 || (cat build.log; exit 1)
45 rm -f build.log Gemfile Gemfile.lock .bundle vendor/bundle 46 rm -f build.log Gemfile Gemfile.lock .bundle vendor/bundle
46 rm -rf tmp log 47 rm -rf tmp log
@@ -49,12 +50,12 @@ rm -rf tmp log @@ -49,12 +50,12 @@ rm -rf tmp log
49 mkdir -p %{buildroot}%{noosfero_libdir} 50 mkdir -p %{buildroot}%{noosfero_libdir}
50 51
51 # install noosfero tree 52 # install noosfero tree
52 -cp -r * %{buildroot}/usr/lib/noosfero/  
53 -rm %{buildroot}/usr/lib/noosfero/{COPY*,Vagrantfile,*.md,gitignore.example,public/dispatch.fcgi,public/dispatch.cgi,public/dispatch.rb} 53 +cp -r * %{buildroot}%{noosfero_libdir}/
  54 +rm %{buildroot}%{noosfero_libdir}/{COPY*,Vagrantfile,*.md,gitignore.example,public/dispatch.fcgi,public/dispatch.cgi,public/dispatch.rb}
54 # no point in installing debian/ as part of the RPM 55 # no point in installing debian/ as part of the RPM
55 -rm -rf %{buildroot}/usr/lib/noosfero/debian 56 +rm -rf %{buildroot}%{noosfero_libdir}/debian
56 # installed plugins should be in /etc 57 # installed plugins should be in /etc
57 -rm -rf %{buildroot}/usr/lib/noosfero/config/plugins 58 +rm -rf %{buildroot}%{noosfero_libdir}/config/plugins
58 59
59 # install config files 60 # install config files
60 mkdir -p %{buildroot}%{_initdir} 61 mkdir -p %{buildroot}%{_initdir}
@@ -68,18 +69,18 @@ ln -sfT %{noosfero_etcdir}/plugins %{buildroot}%{noosfero_libdir}/config/plugins @@ -68,18 +69,18 @@ ln -sfT %{noosfero_etcdir}/plugins %{buildroot}%{noosfero_libdir}/config/plugins
68 69
69 # symlink needed bits in public/ 70 # symlink needed bits in public/
70 for dir in %{writable_dirs}; do 71 for dir in %{writable_dirs}; do
71 - ln -sfT /var/lib/noosfero/public/$dir %{buildroot}/usr/lib/noosfero/public/$dir 72 + ln -sfT /var/lib/noosfero/public/$dir %{buildroot}%{noosfero_libdir}/public/$dir
72 done 73 done
73 # symlink needed to cache 74 # symlink needed to cache
74 for dir in %{cache_dirs}; do 75 for dir in %{cache_dirs}; do
75 - ln -sfT /var/lib/noosfero/cache %{buildroot}/usr/lib/noosfero/public/$dir 76 + ln -sfT /var/lib/noosfero/cache %{buildroot}%{noosfero_libdir}/public/$dir
76 done 77 done
77 -ln -sfT /var/tmp/noosfero %{buildroot}/usr/lib/noosfero/tmp  
78 -ln -sfT /var/log/noosfero %{buildroot}/usr/lib/noosfero/log 78 +ln -sfT /var/tmp/noosfero %{buildroot}%{noosfero_libdir}/tmp
  79 +ln -sfT /var/log/noosfero %{buildroot}%{noosfero_libdir}/log
79 80
80 # default themes 81 # default themes
81 -ln -sfT noosfero %{buildroot}/usr/lib/noosfero/public/designs/themes/default  
82 -ln -sfT tango %{buildroot}/usr/lib/noosfero/public/designs/icons/default 82 +ln -sfT noosfero %{buildroot}%{noosfero_libdir}/public/designs/themes/default
  83 +ln -sfT tango %{buildroot}%{noosfero_libdir}/public/designs/icons/default
83 84
84 85
85 cat > %{buildroot}/etc/noosfero/unicorn.rb <<EOF 86 cat > %{buildroot}/etc/noosfero/unicorn.rb <<EOF
@@ -100,7 +101,7 @@ EOF @@ -100,7 +101,7 @@ EOF
100 101
101 mkdir -p %{buildroot}/etc/default 102 mkdir -p %{buildroot}/etc/default
102 cat > %{buildroot}/etc/default/noosfero <<EOF 103 cat > %{buildroot}/etc/default/noosfero <<EOF
103 -NOOSFERO_DIR="/usr/lib/noosfero" 104 +NOOSFERO_DIR="%{noosfero_libdir}"
104 NOOSFERO_USER="noosfero" 105 NOOSFERO_USER="noosfero"
105 NOOSFERO_DATA_DIR="/var/lib/noosfero" 106 NOOSFERO_DATA_DIR="/var/lib/noosfero"
106 EOF 107 EOF
@@ -114,7 +115,7 @@ fi @@ -114,7 +115,7 @@ fi
114 %post 115 %post
115 groupadd noosfero || true 116 groupadd noosfero || true
116 if ! id noosfero; then 117 if ! id noosfero; then
117 - adduser noosfero --system -g noosfero --shell /bin/sh --home-dir /usr/lib/noosfero 118 + adduser noosfero --system -g noosfero --shell /bin/sh --home-dir %{noosfero_libdir}
118 fi 119 fi
119 120
120 for dir in %{writable_dirs}; do 121 for dir in %{writable_dirs}; do
@@ -126,7 +127,7 @@ chown -R noosfero:noosfero /var/lib/noosfero @@ -126,7 +127,7 @@ chown -R noosfero:noosfero /var/lib/noosfero
126 127
127 %{_initdir}/noosfero setup 128 %{_initdir}/noosfero setup
128 129
129 -cd /usr/lib/noosfero/ 130 +cd %{noosfero_libdir}
130 131
131 if [ -x /usr/bin/postgres ]; then 132 if [ -x /usr/bin/postgres ]; then
132 if [ `systemctl is-active postgresql`!="active" ]; then 133 if [ `systemctl is-active postgresql`!="active" ]; then
@@ -137,7 +138,8 @@ if [ -x /usr/bin/postgres ]; then @@ -137,7 +138,8 @@ if [ -x /usr/bin/postgres ]; then
137 su postgres -c "createuser noosfero -S -d -R" 138 su postgres -c "createuser noosfero -S -d -R"
138 su noosfero -c "createdb noosfero_production" 139 su noosfero -c "createdb noosfero_production"
139 140
140 - cd /usr/lib/noosfero/ 141 + cd %{noosfero_libdir}
  142 +
141 su noosfero -c "RAILS_ENV=production bundle exec rake db:schema:load" 143 su noosfero -c "RAILS_ENV=production bundle exec rake db:schema:load"
142 su noosfero -c "RAILS_ENV=production SCHEMA=/dev/null bundle exec rake db:migrate" 144 su noosfero -c "RAILS_ENV=production SCHEMA=/dev/null bundle exec rake db:migrate"
143 su noosfero -c "RAILS_ENV=production bundle exec rake db:data:minimal" 145 su noosfero -c "RAILS_ENV=production bundle exec rake db:data:minimal"