diff options
author | Nuno Teixeira <eduardo@FreeBSD.org> | 2023-06-03 10:14:14 +0000 |
---|---|---|
committer | Nuno Teixeira <eduardo@FreeBSD.org> | 2023-06-03 10:14:14 +0000 |
commit | 1044fe65f12a1885352cab5a155c3634ed4d0f02 (patch) | |
tree | 1811a73001ec405652ef8f736d210ee40ef68621 /net-p2p | |
parent | 1b11583c894cc0ef7e105acfbccc800829fbfc20 (diff) | |
download | ports-1044fe65f12a1885352cab5a155c3634ed4d0f02.tar.gz ports-1044fe65f12a1885352cab5a155c3634ed4d0f02.zip |
net-p2p/amule: Modernize rc script
PR: 266866
Reported by: echoxxzz@gmail.com
Diffstat (limited to 'net-p2p')
-rw-r--r-- | net-p2p/amule/Makefile | 2 | ||||
-rw-r--r-- | net-p2p/amule/files/amuled.in | 54 |
2 files changed, 11 insertions, 45 deletions
diff --git a/net-p2p/amule/Makefile b/net-p2p/amule/Makefile index 2689353f4092..6e5e6c511408 100644 --- a/net-p2p/amule/Makefile +++ b/net-p2p/amule/Makefile @@ -1,6 +1,6 @@ PORTNAME= amule PORTVERSION= 2.3.3 -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= net-p2p MASTER_SITES= SF/${PORTNAME}/aMule/${PORTVERSION} DISTNAME= aMule-${PORTVERSION} diff --git a/net-p2p/amule/files/amuled.in b/net-p2p/amule/files/amuled.in index 5c1cdb745f74..53c6c28da255 100644 --- a/net-p2p/amule/files/amuled.in +++ b/net-p2p/amule/files/amuled.in @@ -1,8 +1,5 @@ #!/bin/sh -# aMule RCng startup script -# Ogirinal work from Gabriele Cecchetti (amule.org forum) -# # PROVIDE: amuled # REQUIRE: NETWORKING SERVERS # BEFORE: DAEMON @@ -13,8 +10,8 @@ # Set it to "YES" to enable amuled # amuled_user (str): Set to user running amuled # (default 'aMule') -# amuled_home (str): Set to home directory of user running amuled -# (default /home/${amuled_user}) +# amuled_config (str): Set to home directory of user running amuled +# (default /home/${amuled_user}) . /etc/rc.subr @@ -23,45 +20,14 @@ rcvar=amuled_enable load_rc_config $name -[ -z "$amuled_enable" ] && amuled_enable="NO" -[ -z "$amuled_user" ] && amuled_user="aMule" -[ -z "$amuled_home" ] && amuled_home="/home/${amuled_user}" +: ${amuled_enable="NO"} +: ${amuled_user:="amule"} +: ${amuled_config:="/home/${amuled_user}/.aMule"} -required_dirs=${amuled_home} -required_files="${amuled_home}/.aMule/amule.conf" - -start_cmd="${name}_start" -stop_cmd="${name}_stop" - -amuled_start() -{ - if [ ! -f /var/run/${name}.run ] - then - su -l ${amuled_user} -c "amuled &" 2>>/var/log/${name}.log >>/var/log/${name}.log && touch /var/run/${name}.run - echo "Started ${name}." - echo `date` : "Started ${name}." >> /var/log/${name}.log - else - echo "${name} seems to be already running -- remove /var/run/${name}.run manually if needed." - fi -} - -amuled_stop() -{ - if [ -f /var/run/${name}.run ] - then - # The following line is much better, but doesn't stop totally amuled - # su -l ${amuled_user} -c "amulecmd -c Shutdown" 2>>/var/log/${name}.log >>/var/log/${name}.log - # Since amuled catches SIGTERM, this way is preferred for now - killall -TERM amuled 2>>/var/log/${name}.log >>/var/log/${name}.log ; sleep 3 - killall -KILL amuled 2>>/var/log/${name}.log >>/var/log/${name}.log - # Also kill amuleweb if needed - killall -KILL amuleweb 2>/dev/null >/dev/null - rm -f /var/run/${name}.run - echo "Stopped ${name}." - echo `date` : "Stopped ${name}." >> /var/log/${name}.log - else - echo "${name} doesn't seem to be running -- create /var/run/${name}.run if needed." - fi -} +pidfile="${amuled_config}/amuled.pid" +procname="/usr/local/bin/amuled" +required_files="${amuled_config}/amule.conf" +command="/usr/sbin/daemon" +command_args="-f -p ${pidfile} ${procname} --config-dir=${amuled_config}" run_rc_command "$1" |