How it works?
Install API directory
First of all you will find a directory called "Install" in:
- /var/www/nmsprime/Install for nmsprime-base package
- in each module directory, like /var/www/nmsprime/modules/ProvBase/Install – to config the build of each individual package
Files
config.cfg
Options
Section | Paramater | Note | Â |
---|---|---|---|
[config] | name | The RPM package name | Â |
 | description | The RPM package description |  |
 | destination | The install destination directory |  |
 | license | The license which will be shown in RPM package |  |
 | depends | The 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 |
 | options | This options will be 1-to-1 send to fpm build tool |  |
 | exclude | Exclude 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); }