View | Details | Raw Unified | Return to bug 265807 | Differences between
and this patch

Collapse All | Expand All

(-)b/GIDs (-1 / +1 lines)
Lines 698-704 c-lightning:*:735: Link Here
698
# free: 754
698
# free: 754
699
# free: 755
699
# free: 755
700
# free: 756
700
# free: 756
701
# free: 757
701
sopel:*:757:
702
# free: 758
702
# free: 758
703
# free: 759
703
# free: 759
704
# free: 760
704
# free: 760
(-)b/UIDs (-1 / +1 lines)
Lines 703-709 c-lightning:*:735:735::0:0:c-lightning Daemon:/var/db/c-lightning:/usr/sbin/nolo Link Here
703
# free: 754
703
# free: 754
704
# free: 755
704
# free: 755
705
# free: 756
705
# free: 756
706
# free: 757
706
sopel:*:757:757::0:0:Sopel IRC Bot:/var/db/sopel:/usr/sbin/nologin
707
# free: 758
707
# free: 758
708
# free: 759
708
# free: 759
709
# free: 760
709
# free: 760
(-)b/irc/py-sopel/Makefile (+49 lines)
Added Link Here
1
PORTNAME=	sopel
2
PORTVERSION=	7.1.9
3
CATEGORIES=	irc python
4
MASTER_SITES=	CHEESESHOP
5
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
6
7
MAINTAINER=	DtxdF@riseup.net
8
COMMENT=	Simple and extensible IRC bot
9
10
LICENSE=	EFLv2
11
LICENSE_GROUPS=	FSF GPL OSI
12
LICENSE_NAME=	Eiffel Forum License, version 2
13
LICENSE_FILE=	${WRKSRC}/COPYING
14
LICENSE_PERMS=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
15
16
RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}dnspython>0:dns/py-dnspython@${PY_FLAVOR} \
17
		${PYTHON_PKGNAMEPREFIX}GeoIP2>0:net/py-GeoIP2@${PY_FLAVOR} \
18
		${PYTHON_PKGNAMEPREFIX}importlib-metadata>0:devel/py-importlib-metadata@${PY_FLAVOR} \
19
		${PYTHON_PKGNAMEPREFIX}packaging>0:devel/py-packaging@${PY_FLAVOR} \
20
		${PYTHON_PKGNAMEPREFIX}praw>0:www/py-praw@${PY_FLAVOR} \
21
		${PYTHON_PKGNAMEPREFIX}pytz>0:devel/py-pytz@${PY_FLAVOR} \
22
		${PYTHON_PKGNAMEPREFIX}requests>0:www/py-requests@${PY_FLAVOR} \
23
		${PYTHON_PKGNAMEPREFIX}sqlalchemy14>0:databases/py-sqlalchemy14@${PY_FLAVOR} \
24
		${PYTHON_PKGNAMEPREFIX}sqlite3>0:databases/py-sqlite3@${PY_FLAVOR} \
25
		${PYTHON_PKGNAMEPREFIX}urllib3>0:net/py-urllib3@${PY_FLAVOR} \
26
		${PYTHON_PKGNAMEPREFIX}xmltodict>=0.12:devel/py-xmltodict@${PY_FLAVOR}
27
28
USES=		python:3.8+
29
USE_PYTHON=	autoplist distutils
30
31
USERS=		sopel
32
GROUPS=		sopel
33
34
USE_RC_SUBR=	sopel
35
SUB_FILES+=	pkg-message
36
SUB_LIST+=	PYTHON_CMD=${PYTHON_CMD}
37
38
PLIST_SUB=	GROUP="${GROUPS:[0]}" \
39
		USER="${USERS:[0]}"
40
41
post-install:
42
	@${MKDIR} ${STAGEDIR}/${ETCDIR}
43
	@${CP} ${FILESDIR}/sopel-default.cfg ${STAGEDIR}/${ETCDIR}/sopel-default.cfg.sample
44
.for dir in run log db
45
	@${MKDIR} ${STAGEDIR}/var/${dir}/sopel
46
.endfor
47
	@${MKDIR} ${STAGEDIR}/var/db/sopel/www
48
49
.include <bsd.port.mk>
(-)b/irc/py-sopel/distinfo (+3 lines)
Added Link Here
1
TIMESTAMP = 1660249423
2
SHA256 (sopel-7.1.9.tar.gz) = 209fa8bcb42febf514d687a9994423cda5811b745d777c6fba2ec58caf3952bb
3
SIZE (sopel-7.1.9.tar.gz) = 263438
(-)b/irc/py-sopel/files/pkg-message.in (+45 lines)
Added Link Here
1
[
2
{
3
  type: install
4
  message: <<EOM
5
Sopel was installed and there are some notes:
6
7
1. The default profile or configuration file is installed in
8
%%ETCDIR%%/sopel-default.cfg.
9
10
2. The default profile uses logdir (/var/log/sopel), pid_dir
11
(/var/run/sopel) and homedir (/var/db/sopel) directories, which are
12
already created. You can change them in %%ETCDIR%%/sopel-default.cfg.
13
14
3. Enable sopel with:
15
sysrc sopel_enable="YES"
16
17
4. Sopel can configure the common options with:
18
service sopel configure
19
20
5. Before starting sopel, it must be configured using service sopel configure
21
or directly in the configuration file. After it is configured, the 
22
not_configured parameter in the configuration file must be removed
23
or change its value to False.
24
25
6. The service can run multiple instances of sopel, the default
26
profile is "default". You can change or add more profiles by making
27
a copy or creating other files with the prefix sopel- and the name
28
of the profile:
29
30
cp %%ETCDIR%%/sopel-default.cfg.sample %%ETCDIR%%/sopel-profile1.cfg
31
cp %%ETCDIR%%/sopel-default.cfg.sample %%ETCDIR%%/sopel-profile2.cfg
32
cp %%ETCDIR%%/sopel-default.cfg.sample %%ETCDIR%%/sopel-profile3.cfg
33
34
Edit and add them in /etc/rc.conf:
35
36
sysrc sopel_profiles+="profile1 profile2 profile3"
37
38
7. Each plugin has its own configuration. If you observe strange behavior, please
39
make sure you have configured the module correctly before reporting it as a bug.
40
41
8. Start the service:
42
service sopel start
43
EOM
44
}
45
]
(-)b/irc/py-sopel/files/sopel-default.cfg (+21 lines)
Added Link Here
1
#
2
# IMPORTANT NOTE!
3
# You must delete the not_configured line in order for the bot to work,
4
# otherwise it will refuse to start.
5
[core]
6
nick=sopel
7
not_configured=True
8
host=irc.libera.chat
9
port=6697
10
use_ssl=True
11
verify_ssl=True
12
owner=
13
logdir=/var/log/sopel
14
pid_dir=/var/run/sopel
15
homedir=/var/db/sopel
16
17
[meetbot]
18
# If this directory is not created, sopel will see "/www/meetings"
19
# and not as "/var/db/sopel/www/meetings". Sopel runs by default
20
# as a non-root user, it cannot make a directory in /.
21
meeting_log_path = /var/db/sopel/www/meetings
(-)b/irc/py-sopel/files/sopel.in (+147 lines)
Added Link Here
1
#!/bin/sh
2
3
# PROVIDE: sopel
4
# REQUIRE: LOGIN
5
# KEYWORD: shutdown
6
#
7
# Configuration settings for sopel in /etc/rc.conf
8
#
9
# sopel_enable (bool):	Enable sopel. (default=NO)
10
# sopel_piddir (str):	Directory in which to put the process ID file. (default=/var/run/sopel)
11
# sopel_confdir (str):	Configuration directory. (default=%%ETCDIR%%)
12
# sopel_flags (str):	Flags used for sopel. (default=--config-dir "${sopel_confdir}")
13
# sopel_script (str):	Path to sopel application. (default=%%PREFIX%%/bin/sopel)
14
# sopel_user (str):	User to run sopel as. (default=sopel)
15
# sopel_profiles (str):	List of profiles for running multiple sopel instances.
16
#			(default=default)
17
# sopel_prefix (str):	Each profile or configuration file must begin with thix prefix
18
#			followed by the profile name, followed by the extension .cfg,
19
#			such as sopel-default.cfg, sopel-libera.chat.cfg, etc.
20
#			(default=sopel-)
21
# sopel_output (str):	Send stdout and stderr to a file. If you set the logdir parameter in
22
#			the sopel file configuration, your best option is to send the output
23
#			to /dev/null. But this can be changed for debugging.
24
#			(default=/dev/null)
25
26
. /etc/rc.subr
27
28
name=sopel
29
rcvar=sopel_enable
30
desc="Simple, easy-to-use, open-source IRC utility bot, written in Python"
31
start_precmd=sopel_checkprofile
32
stop_precmd=sopel_checkprofile
33
start_cmd=sopel_start
34
stop_cmd=sopel_stop
35
restart_cmd=sopel_restart
36
status_cmd=sopel_status
37
configure_cmd=sopel_configure
38
extra_commands="configure status"
39
command_interpreter="%%PYTHON_CMD%%"
40
41
load_rc_config $name
42
43
: ${sopel_enable:=NO}
44
: ${sopel_piddir:=/var/run/sopel}
45
: ${sopel_confdir:=%%ETCDIR%%}
46
: ${sopel_flags=--config-dir "${sopel_confdir}"}
47
: ${sopel_script:=%%PREFIX%%/bin/sopel}
48
: ${sopel_user:=sopel}
49
: ${sopel_profiles:=default}
50
: ${sopel_prefix:=sopel-}
51
: ${sopel_output:=/dev/null}
52
53
sopel_checkprofile()
54
{
55
	if ! [ -f "${sopel_confdir}/${sopel_prefix}${profile}.cfg" ]; then
56
		echo "Sopel profile '${profile}' does not exist."
57
		return 1
58
	fi
59
60
	return 0
61
}
62
63
sopel_start()
64
{
65
	local profile
66
67
	profile="$1"; shift
68
69
	echo "Starting sopel profile '${profile}'." && sleep 1
70
        daemon \
71
		-o "${sopel_output}" \
72
		-t "${desc}" \
73
		-u "${sopel_user}" \
74
		${command_interpreter} \
75
		${sopel_script} start ${sopel_flags} \
76
			-c "${sopel_prefix}${profile}" $@
77
}
78
79
sopel_stop()
80
{
81
	local pid pidfile profile
82
	
83
	profile="$1"; shift
84
85
	pidfile="${sopel_piddir}/sopel-${sopel_prefix}${profile}.pid"
86
	if ! [ -f "${pidfile}" ]; then
87
		echo "sopel profile '${profile}' not running? (check ${sopel_piddir}/sopel-${sopel_prefix}${profile}.pid)."
88
		return 1
89
	fi
90
91
	pid=`cat ${pidfile}`
92
93
	echo "Stopping sopel profile '${profile}'."
94
        daemon \
95
		-o "${sopel_output}" \
96
		${command_interpreter} \
97
		${sopel_script} stop ${sopel_flags} \
98
			-c "${sopel_prefix}${profile}" $@
99
100
	wait_for_pids $pid
101
}
102
103
sopel_restart()
104
{
105
	local profile
106
	
107
	profile="$1"; shift
108
109
        run_rc_command stop "${profile}" $@
110
        run_rc_command start "${profile}" $@
111
}
112
113
sopel_status()
114
{
115
	local profile pid
116
117
	profile="$1"; shift
118
119
	pid=`check_pidfile \
120
		"${sopel_piddir}/sopel-${sopel_prefix}${profile}.pid" \
121
		"${sopel_script}" \
122
		"${command_interpreter}"`
123
124
	if [ -n "${pid}" ]; then
125
		echo "Sopel profile '${profile}' is running as pid ${pid}."
126
	else
127
		echo "Sopel profile '${profile}' is not running."
128
	fi
129
}
130
131
sopel_configure()
132
{
133
	local profile
134
135
	profile="$1"; shift
136
137
	echo "Configuring profile '${profile}'..."
138
139
	${command_interpreter} \
140
        ${sopel_script} configure ${sopel_flags} \
141
		-c "${sopel_confdir}/${sopel_prefix}${profile}" $@
142
}
143
144
cmd="$1"; shift
145
for profile in ${sopel_profiles}; do
146
	run_rc_command "${cmd}" "${profile}" $@
147
done
(-)b/irc/py-sopel/pkg-descr (+5 lines)
Added Link Here
1
Sopel is a simple, lightweight, open source, easy-to-use IRC Utility
2
bot, written in Python. It's designed to be easy to use, run and
3
extend.
4
5
WWW: https://github.com/sopel-irc/sopel
(-)b/irc/py-sopel/pkg-plist (-1 / +6 lines)
Added Link Here
0
- 
1
@sample(%%USER%%,%%GROUP%%,640) %%ETCDIR%%/sopel-default.cfg.sample %%ETCDIR%%/sopel-default.cfg
2
@dir(%%USER%%,%%GROUP%%,0700) %%ETCDIR%%
3
@dir(%%USER%%,%%GROUP%%,0700) /var/db/sopel
4
@dir(%%USER%%,%%GROUP%%,) /var/db/sopel/www
5
@dir(%%USER%%,%%GROUP%%,0700) /var/log/sopel
6
@dir(%%USER%%,%%GROUP%%,0700) /var/run/sopel

Return to bug 265807