Hanno Böck commited on 2008-04-19 22:52:40
Zeige 1 geänderte Dateien mit 0 Einfügungen und 165 Löschungen.
... | ... |
@@ -1,165 +0,0 @@ |
1 |
-# Copyright 1999-2007 Gentoo Foundation |
|
2 |
-# Distributed under the terms of the GNU General Public License v2 |
|
3 |
-# $Header: $ |
|
4 |
- |
|
5 |
-# |
|
6 |
-# Original Author: Lars Strojny <lars@strojny.net> |
|
7 |
-# Purpose: Providing macros to handle installation and setup of the py-transport |
|
8 |
-# family |
|
9 |
-# |
|
10 |
-inherit eutils python |
|
11 |
-ECLASS="pytransport" |
|
12 |
-INHERITED="$INHERITED $ECLASS" |
|
13 |
-EXPORT_FUNCTIONS src_install pkg_postinst |
|
14 |
- |
|
15 |
-LICENSE="GPL-2" |
|
16 |
- |
|
17 |
-pytransport_is_subversion() { |
|
18 |
- [[ "${PV}" = 9999 ]] && return 0 || return 1 |
|
19 |
-} |
|
20 |
- |
|
21 |
-pytransport_is_subversion && S=${WORKDIR}/${PN} |
|
22 |
-SLOT=0 |
|
23 |
- |
|
24 |
-if pytransport_is_subversion; then |
|
25 |
- inherit subversion |
|
26 |
- [ -z "${ESVN_REPO_URI}" ] && ESVN_REPO_URI="http://svn.blathersource.org/${PN}/trunk" |
|
27 |
- SRC_URI="" |
|
28 |
-else |
|
29 |
- SRC_URI="http://www.blathersource.org/download.php/${PN}/${P}.tar.gz" |
|
30 |
-fi |
|
31 |
- |
|
32 |
-HOMEPAGE="http://${PN}.blathersource.org/" |
|
33 |
- |
|
34 |
-DEPEND=">=net-im/jabber-base-0.0 |
|
35 |
- >=dev-lang/python-2.3" |
|
36 |
- |
|
37 |
-RDEPEND=">dev-python/twisted-2.4 |
|
38 |
- >dev-python/twisted-words-0.4 |
|
39 |
- >=dev-python/twisted-web-0.5 |
|
40 |
- >=dev-python/imaging-1.1" |
|
41 |
-# >=dev-python/twisted-words-0.1.0 |
|
42 |
- |
|
43 |
-PYTRANSPORT_LIB_DIR=${PYTRANSPORT_LIB_DIR:=tools data src} |
|
44 |
-PYTRANSPORT_CONFIG=config_example.xml |
|
45 |
- |
|
46 |
-# Create the minimal token name from the package name |
|
47 |
-# |
|
48 |
-# Example: pyicq-t-svn |
|
49 |
-# |
|
50 |
-pytransport_get_human_name() { |
|
51 |
- echo "${PN}" \ |
|
52 |
- | sed -e "s:^py\([a-z]*\)-t$:\1:g" \ |
|
53 |
- | tr [:lower:] [:upper:] |
|
54 |
-} |
|
55 |
- |
|
56 |
-# |
|
57 |
-# Guess the script name |
|
58 |
-# |
|
59 |
-pytransport_get_script_name() { |
|
60 |
- echo "Py$(pytransport_get_human_name ${PN})t.py" |
|
61 |
-} |
|
62 |
- |
|
63 |
-# |
|
64 |
-# Adjust configuration file defaults |
|
65 |
-# |
|
66 |
-pytransport_adjust_configfile() { |
|
67 |
- local configfile="$1" |
|
68 |
- dosed \ |
|
69 |
- "s:<spooldir>[^\<]*</spooldir>:<spooldir>/var/spool/jabber/</spooldir>:" \ |
|
70 |
- "${configfile}" || die "Could not sed ${configfile}" |
|
71 |
- dosed \ |
|
72 |
- "s:<pid>[^\<]*</pid>:<pid>/var/run/jabber/${PN}.pid</pid>:" \ |
|
73 |
- "${configfile}" || die "Could not sed ${configfile}" |
|
74 |
- return 0 |
|
75 |
-} |
|
76 |
- |
|
77 |
-# |
|
78 |
-# Get python version |
|
79 |
-# |
|
80 |
-pytransport_get_python_version() { |
|
81 |
- [ -z "${PYVER}" ] && python_version |
|
82 |
- echo "${PYVER}" |
|
83 |
-} |
|
84 |
- |
|
85 |
-# |
|
86 |
-# Install transport libraries |
|
87 |
-# |
|
88 |
-pytransport_install_libs() { |
|
89 |
- insinto /usr/lib/python$(pytransport_get_python_version)/site-packages/${PN}/ |
|
90 |
- doins -r ${PYTRANSPORT_LIB_DIR} || \ |
|
91 |
- die "Could not install library" |
|
92 |
- newins $(pytransport_get_script_name) ${PN}.py || \ |
|
93 |
- die "Could not find initial .py-scripts" |
|
94 |
- return 0 |
|
95 |
-} |
|
96 |
- |
|
97 |
-# |
|
98 |
-# Install configuration |
|
99 |
-# |
|
100 |
-pytransport_install_config() { |
|
101 |
- insinto /etc/jabber |
|
102 |
- newins "${PYTRANSPORT_CONFIG}" ${PN}.xml |
|
103 |
- fperms 600 /etc/jabber/${PN}.xml || die "Could not adjust perms" |
|
104 |
- pytransport_adjust_configfile /etc/jabber/${PN}.xml || die "Could not adjust config" |
|
105 |
- fowners jabber:jabber /etc/jabber/${PN}.xml || die "Could not adjust perms" |
|
106 |
- return 0 |
|
107 |
-} |
|
108 |
- |
|
109 |
-# |
|
110 |
-# Generate init.d-script |
|
111 |
-# |
|
112 |
-pytransport_generate_initd() { |
|
113 |
- pytransport_is_subversion && local suffix=" (Subversion)" |
|
114 |
- echo "#!/sbin/runscript |
|
115 |
- |
|
116 |
- |
|
117 |
-depend() { |
|
118 |
- need net |
|
119 |
- use jabber-server |
|
120 |
-} |
|
121 |
- |
|
122 |
-start() { |
|
123 |
- ebegin \"Starting $(pytransport_get_human_name) Jabber Transport${suffix}\" |
|
124 |
- start-stop-daemon --start --quiet \\ |
|
125 |
- --background --name \"${PN}\" --chuid jabber:jabber \\ |
|
126 |
- --exec /usr/bin/python$(pytransport_get_python_version) \\ |
|
127 |
- /usr/lib/python$(pytransport_get_python_version)/site-packages/${PN}/${PN}.py \\ |
|
128 |
- -c /etc/jabber/${PN}.xml \\ |
|
129 |
- -l /var/log/jabber/${PN}.log |
|
130 |
- eend 0 |
|
131 |
-} |
|
132 |
- |
|
133 |
-stop() { |
|
134 |
- ebegin \"Stopping $(pytransport_get_human_name) Jabber Transport${suffix}\" |
|
135 |
- start-stop-daemon --stop --quiet --pidfile /var/run/jabber/pyicq-t-svn.pid |
|
136 |
- sleep 3 |
|
137 |
- eend \$? |
|
138 |
-}" |
|
139 |
-} |
|
140 |
- |
|
141 |
-# |
|
142 |
-# Exported install function |
|
143 |
-# |
|
144 |
-pytransport_src_install() { |
|
145 |
- einfo "Installing library files ..." |
|
146 |
- pytransport_install_libs || die "Failed installing libs" |
|
147 |
- |
|
148 |
- einfo "Installing config file: /etc/jabber/${PN}.xml" |
|
149 |
- pytransport_install_config || die "Failed installing configuration" |
|
150 |
- |
|
151 |
- einfo "Generating init script: /etc/init.d/${PN}" |
|
152 |
- exeinto /etc/init.d |
|
153 |
- pytransport_generate_initd > myinitd |
|
154 |
- newexe myinitd ${PN} |
|
155 |
-} |
|
156 |
- |
|
157 |
-# |
|
158 |
-# Show postinst information |
|
159 |
-# |
|
160 |
-pytransport_pkg_postinst() { |
|
161 |
- einfo "A sample configuration file has been installed in /etc/jabber/${PN}.xml." |
|
162 |
- einfo "Please edit it, and the configuration of you Jabber server to match." |
|
163 |
- einfo "You also need to create a directory <host>.yourjabberhostname.tld in" |
|
164 |
- einfo "/var/spool/jabber and chown it to jabber:jabber." |
|
165 |
-} |
|
166 | 0 |