How it works?

Install API directory

First of all you will find a directory called "Install" in:

  1. /var/www/nmsprime/Install for nmsprime-base package
  2. in each module directory, like /var/www/nmsprime/modules/ProvBase/Install – to config the build of each individual package

Files

config.cfg

Options

SectionParamaterNote 
[config]nameThe RPM package name 
 descriptionThe RPM package description 
 destinationThe install destination directory 
 licenseThe license which will be shown in RPM package 
 dependsThe depending/required RPM packages

NOTE: we must provide all php56u packages from all other dependencies packages, like cacti, icinga, here

Otherwise these packages: it will throw an error, like php-common conflicts with php56u-common

 optionsThis options will be 1-to-1 send to fpm build tool 
 excludeExclude these files/directories from build process 
[files] Copy the files from Install/files directory to destination, see below: 

 

Example: nmsprime-base

/var/www/nmsprime/Install/config.cfg
[config]
name            = "nmsprime-base"
description     = "NMS Prime Base Package"
destination     = "/var/www/nmsprime"
license         = "GPLv3"
depends         = "mariadb mariadb-server httpd php56u php56u-cli php56u-mysqlnd php56u-mcrypt php56u-mbstring php56u-pdo mod_ssl composer git wget"
options         = ""
exclude         = "'**nmsprime/modules' '**nmsprime/public/modules' '**nmsprime/storage/app' # ..

[files]
nmsprime-admin.conf     = /etc/httpd/conf.d/nmsprime-admin.conf
cron-nmsprime           = /etc/cron.d/nmsprime
# ..

Example: nmsprime-provbase

/var/www/nmsprime/modules/ProvBase/Install/config.cfg
[config]
name            = "nmsprime-provbase"
description     = "NMS Prime Provisioning Base Package"
destination     = "/var/www/nmsprime/modules/ProvBase"
license         = "GPLv3"
depends         = "dhcp bind tftp tftp-server xinetd net-snmp net-snmp-devel php56u-snmp php56u-pgsql postgresql flex flex-devel bzip2 gcc bison nmsprime-base"
options         = ""
exclude         = "**/Install *.log"

[files]
tftp            = /etc/xinetd.d/tftp-nmsprime
# ..

before_install.sh

This bash script will be called before installing the package

after_install.sh

This bash script will be called after installing the package

/var/www/nmsprime/Install/install.php

This script is called from our RPM build server during RPM build process. It works like:

/var/www/nmsprime/Install/install.php
// install.php <package version> <build from directory> <rpm target directory>

// Parse Config for FPM from Install/config.cfg
function config ($dir_root)
{
        // ..
}

// Make fpm Command Line for Execution
function fpm ($dir, $version, $rpm_dir)
{
        $config = config($dir);
        return 'fpm -s dir -t rpm -v '.$version.' '.' --architecture all --force --verbose -p '.$rpm_dir.' '.$config;
}

// Build Main package
$cmd = fpm($dir, $version, $rpm_dir);
system ($cmd);

// Foreach Module
foreach (array_slice(scandir($dir.'/modules'), 2) as $mod)
{
        $cmd = fpm($dir.'/modules/'.$mod, $version, $rpm_dir);
        system ($cmd);
}