Jump to content

Кастомизация при сборке пакетов


Recommended Posts

Цитата

(draft)

Универсальность!

Чтоб её не потерять (разные системы - разные требования, различие в  путях к бинарным файлам/скриптам, ...), для себя пакеты можно собирать с параметрами, отличными от предложенных.

 

Получилось накнецто - вот что я правил

Makefile   nagios-plugins

Скрытый текст

#
# Copyright (C) 2008-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# Depends on nagios 3.x only, no need to update it in future

include $(TOPDIR)/rules.mk

PKG_NAME:=nagios-plugins
PKG_VERSION:=2.0.3
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://nagios-plugins.org/download
PKG_MD5SUM:=6755765bab88b506181268ef7982595e

PKG_FIXUP:=autoreconf
PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

define Package/nagios-plugins
  SECTION:=admin
  CATEGORY:=Administration
  DEPENDS:=+libopenssl +libpthread +librt +bash
  TITLE:=plugins for Nagios checks
  URL:=http://nagiosplug.sourceforge.net/
endef

CONFIGURE_ARGS += \
 --with-trusted-path="/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin" \
 --with-perl="/opt/bin/perl" \
 --with-openssl="$(STAGING_DIR)/opt" \
 --without-pgsql \
 --without-radius \
 --without-ldap \
 --without-mysql \
 $(call autoconf_bool,CONFIG_IPV6,ipv6) \
 --with-ping-command="/opt/bin/ping -w %d -c %d %s" \
 --with-ping6-command="/opt/bin/ping6 -w %d -c %d %s" \
 --with-ps-command="/opt/bin/ps w" \
 --with-ps-cols="6" \
 --with-ps-format="%d %s %d %s %s %n" \
 --with-ps-varlist="&procpid$(comma)&procuid$(comma)&procvsz$(comma)procstat$(comma)procprog$(comma)&pos" \
 --with-uptime-command="/opt/bin/uptime" \
 --with-ssh-command="/opt/bin/ssh" \
 --with-nslookup-command="/opt/bin/nslookup"

define Package/nagios-plugins/install
 $(INSTALL_DIR) $(1)/opt/lib
 $(CP) $(PKG_INSTALL_DIR)/opt/lib/* $(1)/opt/lib
 $(SED) 's,/bin/bash,/opt/bin/bash,g' \
     $(1)/opt/lib/check_{log,oracle,sensors}
endef

$(eval $(call BuildPackage,nagios-plugins))

Пакет прикрепил в сообщении

 

nagios-plugins_2.0.3-1a_mipsel-3x.ipk

  • Thanks 1
Link to comment
Share on other sites

4 минуты назад, Cosmit сказал:

При установке пакета ругаеться   

Нужно было в Makefile поменять PKG_RELEASE.

 

Для Entware-ng эти изменения не нужны, т.к в 99% случаев /bin/ping имеется (прошивочный).

  • Thanks 1
Link to comment
Share on other sites

58 минут назад, Cosmit сказал:

Получилось накнец-то - вот что я правил...

ещё можно изменить порядок в --with-trusted-path (в nagios-plugins) и включить вывод графиков (в nagios)

  DEPENDS:=+libpthread +perl +libltdl +libgd +libjpeg +libpng +zlib

...

endef

EXTRA_CFLAGS += $(TARGET_CPPFLAGS)

CONFIGURE_ARGS += \
    --with-nagios-user="root" \
    --with-nagios-group="root" \
    --with-command-user="root" \
    --with-command-group="root" \
    --sysconfdir="/opt/etc/nagios" \
    CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)"

define Build/Compile

 

  • Thanks 1
Link to comment
Share on other sites

nagios Makefile 

Скрытый текст

#
# Copyright (C) 2008-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# This is the last release from 3.x fork. We not going to update it in future

include $(TOPDIR)/rules.mk

PKG_NAME:=nagios
PKG_VERSION:=3.5.1
PKG_RELEASE:=1a

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/nagios/nagios-3.x/nagios-3.5.1
PKG_MD5SUM:=9947ed3d220b4da86710884260d42856

include $(INCLUDE_DIR)/package.mk

PKG_UNPACK:=gzip -dc $(DL_DIR)/$(PKG_SOURCE) | $(TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xf -
define Package/nagios
  SECTION:=admin
  CATEGORY:=Administration
  DEPENDS:=+libpthread +perl +libltdl +libgd +libjpeg +libpng +zlib
  TITLE:=service and network monitoring program
  URL:=http://www.nagios.org/
endef

define Package/nagios/description
 service and network monitoring program
endef

EXTRA_CFLAGS += $(TARGET_CPPFLAGS)

CONFIGURE_ARGS += \
 --with-nagios-user="root" \
 --with-nagios-group="root" \
 --with-command-user="root" \
 --with-command-group="root" \
 --sysconfdir="/opt/etc/nagios" \
 CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)"

define Build/Compile
 $(MAKE) -C $(PKG_BUILD_DIR) \
  DESTDIR="$(PKG_INSTALL_DIR)" \
  INSTALL_OPTS="" \
  STRIP=: \
  all install install-config
endef

define Package/nagios/install
 $(INSTALL_DIR) $(1)/opt/bin
 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/opt/bin/nagios{,tats} $(1)/opt/bin
 $(INSTALL_DIR) $(1)/opt/sbin
 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/opt/sbin/*.cgi $(1)/opt/sbin
 $(INSTALL_DIR) $(1)/opt/etc/nagios/objects
 $(INSTALL_CONF) \
     $(PKG_INSTALL_DIR)/opt/etc/nagios/*.cfg \
     $(1)/opt/etc/nagios
 $(INSTALL_CONF) \
     $(PKG_INSTALL_DIR)/opt/etc/nagios/objects/*.cfg \
     $(1)/opt/etc/nagios/objects
 $(INSTALL_DIR) $(1)/opt/share/www
 $(CP) $(PKG_INSTALL_DIR)/opt/share/* $(1)/opt/share/www
 $(INSTALL_DIR) $(1)/opt/var/{spool/checkresults,archives}
endef

define Package/nagios/conffiles
/opt/etc/nagios/
endef

$(eval $(call BuildPackage,nagios))

nagios-plugins  Makefile 

Скрытый текст


# Copyright (C) 2008-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# Depends on nagios 3.x only, no need to update it in future

include $(TOPDIR)/rules.mk

PKG_NAME:=nagios-plugins
PKG_VERSION:=2.0.3
PKG_RELEASE:=1a

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://nagios-plugins.org/download
PKG_MD5SUM:=6755765bab88b506181268ef7982595e

PKG_FIXUP:=autoreconf
PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

define Package/nagios-plugins
  SECTION:=admin
  CATEGORY:=Administration
  DEPENDS:=+libopenssl +libpthread +librt +bash
  TITLE:=plugins for Nagios checks
  URL:=http://nagiosplug.sourceforge.net/
endef

CONFIGURE_ARGS += \
 --with-trusted-path="/opt/bin:/opt/sbin:/bin:/sbin:/usr/bin:/usr/sbin" \
 --with-perl="/opt/bin/perl" \
 --with-openssl="$(STAGING_DIR)/opt" \
 --without-pgsql \
 --without-radius \
 --without-ldap \
 --without-mysql \
 $(call autoconf_bool,CONFIG_IPV6,ipv6) \
 --with-ping-command="/opt/bin/ping -w %d -c %d %s" \
 --with-ping6-command="/opt/bin/ping6 -w %d -c %d %s" \
 --with-ps-command="/opt/bin/ps w" \
 --with-ps-cols="6" \
 --with-ps-format="%d %s %d %s %s %n" \
 --with-ps-varlist="&procpid$(comma)&procuid$(comma)&procvsz$(comma)procstat$(comma)procprog$(comma)&pos" \
 --with-uptime-command="/opt/bin/uptime" \
 --with-ssh-command="/opt/bin/ssh" \
 --with-nslookup-command="/opt/bin/nslookup"

define Package/nagios-plugins/install
 $(INSTALL_DIR) $(1)/opt/lib
 $(CP) $(PKG_INSTALL_DIR)/opt/lib/* $(1)/opt/lib
 $(SED) 's,/bin/bash,/opt/bin/bash,g' \
     $(1)/opt/lib/check_{log,oracle,sensors}
endef

$(eval $(call BuildPackage,nagios-plugins))

 

 

nagios_3.5.1-1a_mipsel-3x.ipk

nagios-plugins_2.0.3-1a_mipsel-3x.ipk

Edited by TheBB
nagios Makefile change
Link to comment
Share on other sites

@Cosmit, создать папку и скопировать в нее:

...
 $(INSTALL_DIR) $(1)/opt/share/www/nagios
 $(CP) $(PKG_INSTALL_DIR)/opt/share/* $(1)/opt/share/www/nagios/
...

если и бинарники перенести в cgi-bin, то

...
define Package/nagios/install
...
 $(INSTALL_DIR) $(1)/opt/share/www/nagios/cgi-bin
 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/opt/sbin/*.cgi $(1)/opt/share/www/nagios/cgi-bin/
...
 $(INSTALL_DIR) $(1)/opt/share/www <-- del, т.к. уже создана выше (можно и оставить)
 $(CP) $(PKG_INSTALL_DIR)/opt/share/* $(1)/opt/share/www/nagios/
...

 

  • Thanks 1
Link to comment
Share on other sites

Ещё мона конешно добавить скипт запуска Nagios    в  /opt/etc/init.d/

Скрытый текст

#!/bin/sh

ENABLED=yes
PROCS=nagios
ARGS="-d /opt/etc/nagios/nagios.cfg"
PREARGS=""
DESC=$PROCS
PATH=/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

. /opt/etc/init.d/rc.func 

и в /opt/etc/nagios/cgi.cfg   заменить nagiosadmin   на   root   

и в /opt/var/ создать каталог    rw

Edited by Cosmit
  • Thanks 2
Link to comment
Share on other sites

я же привел Makefile (часть) для nagios (и ваш исправлял ))) ). в DEPENDS либы добавили, а в CONFIGURE_VARS оставили выкл. удалите

CONFIGURE_VARS += \
 ac_cv_lib_gd_gdImagePng_1=no \
 ac_cv_lib_gd_gdImagePng_2=no \
 ac_cv_lib_gd_gdImagePng_3=no \
 ac_cv_lib_gd_gdImagePng_4=no

остальные *.cgi и соберутся

Link to comment
Share on other sites

TheBB

И всетаки. 

15 часов назад, Cosmit сказал:

Ещё мона конешно добавить скипт запуска Nagios    в  /opt/etc/init.d/

  Показать содержимое

#!/bin/sh

ENABLED=yes
PROCS=nagios
ARGS="-d /opt/etc/nagios/nagios.cfg"
PREARGS=""
DESC=$PROCS
PATH=/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

. /opt/etc/init.d/rc.func 

и в /opt/etc/nagios/cgi.cfg   заменить nagiosadmin   на   root   

и в /opt/var/ создать каталог    rw

 

Link to comment
Share on other sites

Чтоб по-быстрому, то:

Создаёте рядом с Makefile папку files. В неё кладёте скрипт запуска SNNnagios (NN - цифры). В Makefile дописываете (NN - заменить на то, что присвоили)

...
$(INSTALL_DIR) $(1)/opt/etc/init.d
$(INSTALL_BIN) ./files/SNNnagios $(1)/opt/etc/init.d/
...

rw по аналогии с init.d

...
$(INSTALL_DIR) $(1)/opt/var/rw
...

для смены пользователя (и не только) используйте потоковый редактор, "именуемый в народе" sed

...
sed -i 's,nagiosadmin,root,g' $(1)/opt/etc/nagios/cgi.cfg
endef

 

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...