Ignore:
Timestamp:
Jun 14, 2015 8:16:16 PM (5 years ago)
Author:
kytv <kytv@…>
Branches:
master
Children:
8096e4f6
Parents:
863e120
Message:

debian: Add support for setting open file limits to initscript, add comment to explain how to do it with systemd

File:
1 edited

Legend:

Unmodified
Added
Removed
  • debian/i2p.postinst

    r863e120 r627f707  
    77
    88conffile="/etc/default/i2p"
    9 #systemdservice="/lib/systemd/system/i2p.service"
     9systemdservice="/lib/systemd/system/i2p.service"
    1010
    1111# Source debconf library -- we have a Depends line
     
    2626            echo "RUN_DAEMON=" >> $conffile
    2727            echo "I2PUSER=" >> $conffile
     28            echo "ULIMIT=" >> $conffile
    2829            echo "CONFINE_WITH_APPARMOR=" >> $conffile
    2930            echo "# The next value is also wrapper.java.maxmemory in /etc/i2p/wrapper.config" >> $conffile
     
    5051        test -z "$MEMORYLIMIT" || grep -Eq '^ *MEMORYLIMIT=' $conffile || \
    5152            echo "MEMORYLIMIT=" >> $conffile
     53        test -z "$ULIMIT" || grep -Eq '^ *ULIMIT=' $conffile || \
     54            echo "ULIMIT=" >> $conffile
    5255        test -z "$CONFINE_WITH_APPARMOR" || grep -Eq '^ *CONFINE_WITH_APPARMOR=' $conffile || \
    5356            echo "CONFINE_WITH_APPARMOR=" >> $conffile
     
    5861        fi
    5962
    60 
    61 
    6263        sed -e "s/^ *RUN_DAEMON=.*/RUN_DAEMON=\"$RUN_DAEMON\"/" \
    6364            -e "s/^ *I2PUSER=.*/I2PUSER=\"$I2PUSER\"/" \
     
    6768        mv -f $conffile.tmp $conffile
    6869
    69 #        if [ -e "$systemdservice" ]; then
    70 #            sed -e "s/User=.*/User=$I2PUSER/" < "$systemdservice" > "$systemdservice.tmp"
    71 #            mv -f "$systemdservice.tmp" "$systemdservice"
    72 #            chmod 0644 -f "$systemdservice"
    73 #            if grep -q 'systemd' /proc/1/comm > /dev/null 2>&1; then
    74 #                systemctl --system daemon-reload
    75 #                if [ $RUN_DAEMON = 'true' ]; then
    76 #                    systemctl enable i2p.service
    77 #                else
    78 #                    systemctl disable i2p.service
    79 #                fi
    80 #            fi
    81 #        fi
     70        if [ -e "$systemdservice" ]; then
     71            sed -e "s/User=.*/User=$I2PUSER/" < "$systemdservice" > "$systemdservice.tmp"
     72            mv -f "$systemdservice.tmp" "$systemdservice"
     73            chmod 0644 -f "$systemdservice"
     74            if grep -q 'systemd' /proc/1/comm > /dev/null 2>&1; then
     75                systemctl --system daemon-reload
     76                if [ $RUN_DAEMON = 'true' ]; then
     77                    systemctl enable i2p.service
     78                else
     79                    systemctl disable i2p.service
     80                fi
     81            fi
     82        fi
    8283
    8384        sed -e "s/^ *wrapper\.java\.maxmemory=.*/wrapper\.java\.maxmemory=$MEMORYLIMIT/" \
Note: See TracChangeset for help on using the changeset viewer.