Building Your Contrib

From SME Server
Revision as of 06:58, 30 July 2022 by Unnilennium (talk | contribs) (Created page with "This how-to intend to give you a tour of what you need with some usefull tmeplates to build you own contrib on SME10 with last php-fpm, httpd 2.4, core backup integration and...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This how-to intend to give you a tour of what you need with some usefull tmeplates to build you own contrib on SME10 with last php-fpm, httpd 2.4, core backup integration and systemd usage

Architecture

SPEC file

%define name foo
%define version 3.6.431
%define release 1
Summary: foo is a helpdesk system
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
Distribution: SME Server
License: GNU GPL version 2
URL: http://www.fooweb.com
Group: SMEserver/addon
#wget http://www.fooweb.com/downloads/foo-3.6.431.tar.gz
Source: foo-3.6.431.tar.gz
Packager: Stephen Foo <support@foo.net>
BuildArchitectures: noarch
BuildRoot: /var/tmp/%{name}-%{version}
BuildRequires: e-smith-devtools
Requires: e-smith-release >= 7.0
AutoReqProv: no

%description
http://foo.org/
foo is a helpdesk system 

%changelog
* Thu Sep 13 2007 Stephen Foo <support@foo.net> 3.6.431-1
- initial release
- builds from unchanged .tar.gz 

%prep
%setup  -c -n %{name}

%build
perl createlink

%install
rm -rf $RPM_BUILD_ROOT
(cd root   ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
rm -f %{name}-%{version}-filelist
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
   --dir '/opt/foo/tempdir/' 'attr(775,www,www)' \
   --file '/opt/foo/logo.gif' 'attr(660,www,www)' \
   --ignoredir '/opt/foo' \
    > %{name}-%{version}-filelist

%clean
cd ..
rm -rf %{name}

%files -f %{name}-%{version}-filelist
%defattr(-,root,root)

Createlinks

#!/usr/bin/perl
use strict;
use esmith::Build::CreateLinks qw(:all);

my $pkg= "smeserver-foo";
my $event = "${pkg}-update";

event_actions($event, qw(
   myfoo 05
   systemd-default 88
   systemd-reload  89
));

event_templates($event, qw(
/etc/httpd/conf/httpd.conf
/etc/opt/remi/php80/php-fpm.d/www.conf
/opt/foo/foo.conf
));

event_services($event, qw(
    php80-php-fpm restart
    httpd-e-smith restart
    foo restart
));

use esmith::Build::Backup qw(:all);
backup_includes($pkg, qw(
/opt/foo/
));

Configuration DB

Mariadb myslq init

Systemd

all you need to have your service to start is

  1. a configuration db key foo of type service with status enabled
  2. a dropin file as this one

/usr/lib/systemd/system/foo.service.d/50koozali.conf

[Service]
#first we reset the ExecStartPre
ExecStartPre=
#our needs
ExecStartPre=-/sbin/e-smith/service-status foo
ExecStartPre=-/sbin/e-smith/expand-template /opt/foo/foo.conf

Restart=always
[Install]
#so it start on boot
WantedBy=sme-server.target

PHP-FPM

Apache httpd