Changeset 28903


Ignore:
Timestamp:
2011-11-10T00:25:15+01:00 (4 years ago)
Author:
nico
Message:

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

Location:
packages/mail/dovecot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • packages/mail/dovecot/Makefile

    r22395 r28903  
    11# 
    2 # Copyright (C) 2006-2010 OpenWrt.org 
     2# Copyright (C) 2006-2011 OpenWrt.org 
    33# 
    44# This is free software, licensed under the GNU General Public License v2. 
     
    1010PKG_NAME:=dovecot 
    1111PKG_VERSION:=1.2.13 
    12 PKG_RELEASE:=1 
     12PKG_RELEASE:=2 
    1313 
    1414PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 
     
    7575endef 
    7676 
    77 define Package/dovecot/postinst 
    78 #!/bin/sh 
    79  
    80 id=59 
    81 name=dovecot 
    82 home=/var/run/dovecot 
    83 shell=/bin/false 
    84  
    85 # do not change below 
    86 # check if we are on real system 
    87 if [ -z "$${IPKG_INSTROOT}" ]; then 
    88         # create copies of passwd and group, if we use squashfs 
    89         rootfs=`mount |awk '/root/ { print $$5 }'` 
    90         if [ "$$rootfs" = "squashfs" ]; then 
    91                 if [ -h /etc/group ]; then 
    92                         rm /etc/group 
    93                         cp -p /rom/etc/group /etc/group 
    94                 fi 
    95                 if [ -h /etc/passwd ]; then 
    96                         rm /etc/passwd 
    97                         cp -p /rom/etc/passwd /etc/passwd 
    98                 fi 
    99         fi 
    100 fi 
    101  
    102 echo "" 
    103 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then 
    104         echo "adding group $$name to /etc/group" 
    105         echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group 
    106 fi 
    107 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then 
    108         echo "adding user $$name to /etc/passwd" 
    109         echo "$${name}:x:$${id}:$${id}:$${name}:$${home}:$${shell}" >> $${IPKG_INSTROOT}/etc/passwd 
    110 fi 
    111 endef 
    112  
    113  
    11477$(eval $(call BuildPackage,dovecot)) 
  • packages/mail/dovecot/files/dovecot.init

    r14889 r28903  
    11#!/bin/sh /etc/rc.common 
    2 # Copyright (C) 2006-2008 OpenWrt.org 
     2# Copyright (C) 2006-2011 OpenWrt.org 
    33 
    44START=99 
    55 
    6 RUN_D=/var/run/dovecot 
    7 PID_F=$RUN_D/master.pid 
     6SERVICE_PID_FILE=/var/run/dovecot/master.pid 
    87 
    98start() { 
    10         mkdir -p $RUN_D 
    11         dovecot 
     9        user_exists dovecot 59 || user_add dovecot 59 
     10        group_exists dovecot 59 || group_add dovecot 59 
     11        mkdir -p -m 0755 /var/lib/dovecot 
     12        mkdir -p -m 0755 /var/run/dovecot 
     13        chmod 0750 /var/lib/dovecot 
     14        service_start /usr/sbin/dovecot 
    1215} 
    1316 
    1417stop() { 
    15         [ -f $PID_F ] && kill $(cat $PID_F) 
     18        service_stop /usr/sbin/dovecot 
    1619} 
    1720 
    1821reload() { 
    19         [ -f $PID_F ] && kill -HUP $(cat $PID_F) 
     22        service_reload /usr/sbin/dovecot 
    2023} 
Note: See TracChangeset for help on using the changeset viewer.