diff --git a/Makefile b/Makefile new file mode 100644 index 00000000000..bb918efc370 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ + +install: + make -C dist install + make -C src/api install diff --git a/dist/Makefile b/dist/Makefile index 58ab21b5a3a..bc416ca68fa 100644 --- a/dist/Makefile +++ b/dist/Makefile @@ -1,11 +1,29 @@ -all: install +include ../Makefile.include -install: install_obsapisetup +INIT_SCRIPTS := obssrcserver obsrepserver obsscheduler obsworker obspublisher obsdispatcher obssigner obswarden obsapidelayed obsapisetup obsstoragesetup obsservice obsdodup +LOGROTATE_CONFIGS := obs-api obs-server +OBS_BIN_SCRIPTS := obs_productconvert +OBS_SBIN_SCRIPTS := obs_admin obs_serverstatus +install: install_obsapisetup install_apache install_initscripts install_project_update install_logrotate install_fillups install_slp install_obs_bin + +#install_overview + +install_obsapisetup: system_dirs + $(INSTALL) -m 755 obsapisetup $(DESTDIR)/etc/init.d/obsapisetup + $(INSTALL) -m 755 setup-appliance.sh $(DESTDIR)$(OBS_BACKEND_PREFIX)/setup-appliance.sh + +install_apache: + $(INSTALL) -d -m 755 $(DESTDIR)$(APACHE_CONIFGDIR_VHOST) + $(INSTALL) -m 644 $(APACHE_VHOST_CONF) $(DESTDIR)$(APACHE_CONIFGDIR_VHOST)/obs.conf + +install_initscripts: system_dirs + $(foreach script,$(INIT_SCRIPTS),$(shell $(INSTALL) -m 755 $(script) $(DESTDIR)/etc/init.d/$(script)) ) + $(foreach script,$(INIT_SCRIPTS),$(shell ln -sf /etc/init.d/$(script) $(DESTDIR)/usr/sbin/rc$(script)) ) + +install_project_update: system_dirs + $(INSTALL) -m 0755 obs_project_update $(DESTDIR)/usr/sbin/obs_project_update -install_obsapisetup: - install -m 755 obsapisetup $(DESTDIR)/etc/init.d/obsapisetup - install -m 755 setup-appliance.sh $(DESTDIR)$(OBS_BACKEND_DIR)/setup-appliance.sh install_logrotate: system_dirs $(foreach config,$(LOGROTATE_CONFIGS),$(shell $(INSTALL) -m 755 $(config).logrotate $(DESTDIR)/etc/logrotate.d/$(config)) ) @@ -18,11 +36,11 @@ install_slp: system_dirs $(INSTALL) -m 644 obs.repo_server.reg $(DESTDIR)/etc/slp.reg.d/ install_obs_bin: system_dirs - $(foreach script,$(OBS_SCRIPTS),$(shell $(INSTALL) -m 755 $(script) $(DESTDIR)/usr/bin/$(script)) ) + $(foreach script,$(OBS_BIN_SCRIPTS),$(shell $(INSTALL) -m 755 $(script) $(DESTDIR)/usr/bin/$(script)) ) + $(foreach script,$(OBS_SBIN_SCRIPTS),$(shell $(INSTALL) -m 755 $(script) $(DESTDIR)/usr/bin/$(script)) ) system_dirs: - $(INSTALL) -d -m 755 $(DESTDIR)$(OBS_BACKEND_DIR) - $(INSTALL) -d -m 755 $(DESTDIR)/$(CONTRIB_DIR) + $(INSTALL) -d -m 755 $(DESTDIR)$(OBS_BACKEND_PREFIX) $(INSTALL) -d -m 755 $(DESTDIR)/etc/init.d/ $(INSTALL) -d -m 755 $(DESTDIR)/etc/logrotate.d/ $(INSTALL) -d -m 755 $(DESTDIR)/etc/slp.reg.d/ @@ -31,18 +49,8 @@ system_dirs: $(INSTALL) -d -m 755 $(DESTDIR)/var/adm/fillup-templates -ta: test_all - -test_all: test_unit test_system - -t: test - -test: test_unit - test_unit: prove t/*.t -ts: test_system - test_system: prove t/*.ts diff --git a/dist/obs-server.spec b/dist/obs-server.spec index c15cd7adaa1..6a84db0c0aa 100644 --- a/dist/obs-server.spec +++ b/dist/obs-server.spec @@ -290,91 +290,22 @@ cd dist find -type f | xargs sed -i '1,$s/group www/group apache/g' %endif # configure apache web service +export DESTDIR=$RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/etc/apache2/vhosts.d/ %if 0%{?suse_version} < 1300 -install -m 0644 obs-apache2.conf $RPM_BUILD_ROOT/etc/apache2/vhosts.d/obs.conf -%else -install -m 0644 obs-apache24.conf $RPM_BUILD_ROOT/etc/apache2/vhosts.d/obs.conf +perl -p -i -e 's/^APACHE_VHOST_CONF=.*/APACHE_VHOST_CONF=obs-apache2.conf/' Makefile.include %endif + # install overview page template mkdir -p $RPM_BUILD_ROOT/srv/www/obs/overview install -m 0644 overview.html.TEMPLATE $RPM_BUILD_ROOT/srv/www/obs/overview/ -# install obs mirror script and obs copy script -install -d -m 755 $RPM_BUILD_ROOT/usr/sbin/ -install -m 0755 obs_project_update $RPM_BUILD_ROOT/usr/sbin/ -# install runlevel scripts -install -d -m 755 $RPM_BUILD_ROOT/etc/init.d/ -for i in obssrcserver obsrepserver obsscheduler obsworker obspublisher obsdispatcher \ - obssigner obswarden obsapidelayed obsapisetup obsstoragesetup \ - obsservice obsdodup ; do - install -m 0755 $i \ - $RPM_BUILD_ROOT/etc/init.d/ - ln -sf /etc/init.d/$i $RPM_BUILD_ROOT/usr/sbin/rc$i -done -# install logrotate -install -d -m 755 $RPM_BUILD_ROOT/etc/logrotate.d/ -for i in obs-api obs-server ; do - install -m 0644 ${i}.logrotate \ - $RPM_BUILD_ROOT/etc/logrotate.d/$i -done -# install fillups -FILLUP_DIR=$RPM_BUILD_ROOT/var/adm/fillup-templates -install -d -m 755 $FILLUP_DIR -install -m 0644 sysconfig.obs-server $FILLUP_DIR/ -# install SLP registration files -SLP_DIR=$RPM_BUILD_ROOT/etc/slp.reg.d/ -install -d -m 755 $SLP_DIR -install -m 644 obs.source_server.reg $SLP_DIR/ -install -m 644 obs.repo_server.reg $SLP_DIR/ -# create symlink for product converter -mkdir -p $RPM_BUILD_ROOT/usr/bin -cat > $RPM_BUILD_ROOT/usr/bin/obs_productconvert < $RPM_BUILD_ROOT/usr/sbin/obs_admin < $RPM_BUILD_ROOT/usr/sbin/obs_serverstatus <> $RPM_BUILD_ROOT/srv/www/obs/api/config/environment.rb -echo 'CONFIG["schema_location"] ||= File.expand_path("../docs/api/")' >> $RPM_BUILD_ROOT/srv/www/obs/api/config/environment.rb - # # Install all backend parts. # @@ -401,35 +332,10 @@ cd .. %fdupes $RPM_BUILD_ROOT/srv/www/obs %endif -# these config files must not be hard linked -install api/config/database.yml.example $RPM_BUILD_ROOT/srv/www/obs/api/config/database.yml -install api/config/options.yml.example $RPM_BUILD_ROOT/srv/www/obs/api/config/options.yml -install api/config/thinking_sphinx.yml.example $RPM_BUILD_ROOT/srv/www/obs/api/config/thinking_sphinx.yml - for file in api/log/access.log api/log/backend_access.log api/log/delayed_job.log api/log/error.log api/log/lastevents.access.log; do touch $RPM_BUILD_ROOT/srv/www/obs/$file done -pushd $RPM_BUILD_ROOT/srv/www/obs/api -# we need to have *something* as secret key -echo "" | sha256sum| cut -d\ -f 1 > config/secret.key -bundle exec rake assets:precompile RAILS_ENV=production RAILS_GROUPS=assets -rm -rf tmp/cache/sass tmp/cache/assets config/secret.key -export BUNDLE_WITHOUT=test:assets:development -export BUNDLE_FROZEN=1 -bundle config --local frozen 1 -bundle config --local without test:assets:development -# reinstall -install config/database.yml.example config/database.yml -: > log/production.log -sed -i -e 's,^api_version.*,api_version = "%version",' config/initializers/02_apiversion.rb -popd - -mkdir -p %{buildroot}%{_docdir} -cat > %{buildroot}%{_docdir}/README.devel <