.PHONY: install uninstall install: # This command verifies if the group _i2pd exists. If it doesn't, it # creates it with gid 838. groupinfo -e _i2pd || groupadd -g 838 _i2pd # These commands verify if the user _i2pd exists. If it doesn't, it # creates it with uid 838, default group 838 (which is _i2pd), login # class "i2pd" (created manually before running this script), comment # "i2pd account", home directory /var/lib/i2pd, and login shell # /sbin/nologin (which forbids it from loging in). # The mkdir and chown are used instead of the -m option of useradd in # case /var/lib/i2pd already existed before the execution of this make # target. mkdir -p /var/lib/i2pd userinfo -e _i2pd || useradd -u 838 -g 838 -L i2pd \ -c "i2pd account" -d /var/lib/i2pd -s /sbin/nologin _i2pd chown -R _i2pd:_i2pd /var/lib/i2pd # This command copies the RC script in the RC script folder to allow # I2Pd to be managed by the service supervisor. install -o root -g bin -m 555 i2pd /etc/rc.d/i2pd uninstall: # This command removes the RC script. rcctl disable i2pd rm /etc/rc.d/i2pd # This command removes the _i2pd user and its home. userdel -r _i2pd # This command removes the _i2pd group. groupdel _i2pd