Changeset 28888


Ignore:
Timestamp:
2011-11-09T20:48:57+01:00 (5 years ago)
Author:
nico
Message:

packages/nrpe: use new service functions, move user/group creation from postinst to initscript

Location:
packages/admin/nrpe
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • packages/admin/nrpe/Makefile

    r28777 r28888  
    1010PKG_NAME:=nrpe 
    1111PKG_VERSION:=2.12 
    12 PKG_RELEASE:=2 
     12PKG_RELEASE:=3 
    1313 
    1414PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 
     
    3535endef 
    3636 
    37 define Package/nrpe/postinst 
    38 #!/bin/sh 
    39  
    40 id=50 
    41 name=nagios 
    42 home=/var/run/nagios 
    43 shell=/bin/false 
    44  
    45 # do not change below 
    46 # check if we are on real system 
    47 if [ -z "$${IPKG_INSTROOT}" ]; then 
    48         # create copies of passwd and group, if we use squashfs 
    49         rootfs=`mount |awk '/root/ { print $$5 }'` 
    50         if [ "$$rootfs" = "squashfs" ]; then 
    51                 if [ -h /etc/group ]; then 
    52                         rm /etc/group 
    53                         cp -p /rom/etc/group /etc/group 
    54                 fi 
    55                 if [ -h /etc/passwd ]; then 
    56                         rm /etc/passwd 
    57                         cp -p /rom/etc/passwd /etc/passwd 
    58                 fi 
    59         fi 
    60 fi 
    61  
    62 echo "" 
    63 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then 
    64         echo "adding group $$name to /etc/group" 
    65         echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group 
    66 fi 
    67 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then 
    68         echo "adding user $$name to /etc/passwd" 
    69         echo "$${name}:x:$${id}:$${id}:$${name}:$${home}:$${shell}" >> $${IPKG_INSTROOT}/etc/passwd 
    70 fi 
    71 endef 
    72  
    7337CONFIGURE_ARGS += \ 
    7438        --with-ssl="$(STAGING_DIR)/usr" \ 
  • packages/admin/nrpe/files/nrpe.init

    r26051 r28888  
    11#!/bin/sh /etc/rc.common 
    2 # Copyright (C) 2007 OpenWrt.org 
     2# Copyright (C) 2007-2011 OpenWrt.org 
    33 
    44START=70 
    55 
     6SERVICE_USE_PID=1 
     7 
    68start() { 
    7         /usr/sbin/nrpe -c /etc/nrpe.cfg -d 
     9        user_exists nagios 50 || user_add nagios 50 
     10        group_exists nagios 50 || group_add nagios 50 
     11        [ -d /var/run/nagios ] || { 
     12                mkdir -m 0755 -p /var/run/nagios 
     13                chown nagios:nagios /var/run/nagios 
     14        } 
     15        service_start /usr/sbin/nrpe -c /etc/nrpe.cfg -d 
    816} 
    917 
    1018stop() { 
    11         killall nrpe 
     19        service_stop /usr/sbin/nrpe 
    1220} 
Note: See TracChangeset for help on using the changeset viewer.