4 |
4 |
EAPI=7
|
5 |
5 |
|
6 |
6 |
MY_P="BackupPC-${PV}"
|
|
7 |
MY_PN="BackupPC"
|
7 |
8 |
|
8 |
9 |
inherit depend.apache systemd
|
9 |
10 |
|
... | ... | |
41 |
42 |
dev-perl/CGI
|
42 |
43 |
dev-perl/File-RsyncP
|
43 |
44 |
dev-perl/libwww-perl
|
|
45 |
dev-perl/BackupPC-XS
|
|
46 |
net-misc/rsync-bpc
|
44 |
47 |
virtual/mta
|
45 |
48 |
virtual/perl-IO-Compress
|
46 |
49 |
www-apache/mod_perl
|
... | ... | |
48 |
51 |
|| (
|
49 |
52 |
>=www-servers/apache-2.4[${APACHE_MODULES},apache2_modules_cgi]
|
50 |
53 |
>=www-servers/apache-2.4[${APACHE_MODULES},apache2_modules_cgid]
|
51 |
|
>=www-servers/apache-2.4[${APACHE_MODULES},apache2_modules_fcgid]
|
52 |
54 |
)
|
53 |
55 |
rss? ( dev-perl/XML-RSS )
|
54 |
56 |
samba? ( net-fs/samba )"
|
55 |
57 |
|
56 |
|
PATCHES=(
|
57 |
|
"${FILESDIR}/3.3.0/01-fix-configure.pl.patch"
|
58 |
|
"${FILESDIR}/3.3.0/02-fix-config.pl-formatting.patch"
|
59 |
|
"${FILESDIR}/3.3.0/03-reasonable-config.pl-defaults.patch"
|
60 |
|
"${FILESDIR}/3.2.0/04-add-docdir-marker.patch"
|
61 |
|
"${FILESDIR}/3.2.0/05-nicelevel.patch"
|
62 |
|
"${FILESDIR}"/${P}-perl522.patch #580254
|
63 |
|
"${FILESDIR}"/${P}-perl526.patch #594128
|
64 |
|
)
|
65 |
|
|
66 |
|
CGIDIR="/usr/lib/backuppc/htdocs"
|
67 |
|
CONFDIR="/etc/BackupPC"
|
68 |
|
DATADIR="/var/lib/backuppc"
|
69 |
|
DOCDIR="/usr/share/doc/${PF}"
|
70 |
|
LOGDIR="/var/log/BackupPC"
|
|
58 |
CGIDIR="${EROOT}/usr/lib/backuppc/htdocs"
|
|
59 |
CONFDIR="${EROOT}/etc/${MY_PN}"
|
|
60 |
DATADIR="${EROOT}/var/lib/backuppc"
|
|
61 |
DOCDIR="${EROOT}/usr/share/doc/${PF}"
|
|
62 |
LOGDIR="${EROOT}/var/log/BackupPC"
|
71 |
63 |
need_apache2_4
|
72 |
64 |
|
73 |
65 |
src_prepare() {
|
74 |
66 |
default
|
75 |
67 |
|
76 |
|
# Fix initscript
|
77 |
|
sed -e 's/runscript/openrc-run/g' -i init.d/src/gentoo-backuppc || die
|
78 |
|
|
79 |
68 |
# Fix docs location using the marker that we've patched in.
|
80 |
|
sed "s+__DOCDIR__+${DOCDIR}+" -i "lib/BackupPC/CGI/View.pm" || die
|
|
69 |
sed "s+__DOCDIR__+${DOCDIR}+" -i lib/BackupPC/CGI/View.pm || die
|
81 |
70 |
}
|
82 |
71 |
|
83 |
72 |
src_install() {
|
84 |
73 |
local myconf
|
85 |
|
myconf=""
|
86 |
74 |
if use samba ; then
|
87 |
|
myconf="--bin-path smbclient=$(type -p smbclient)"
|
88 |
|
myconf="${myconf} --bin-path nmblookup=$(type -p nmblookup)"
|
|
75 |
myconf=(
|
|
76 |
--bin-path smbclient=$(type -p smbclient)
|
|
77 |
--bin-path nmblookup=$(type -p nmblookup)
|
|
78 |
)
|
89 |
79 |
fi
|
90 |
80 |
|
91 |
81 |
/usr/bin/env perl ./configure.pl \
|
... | ... | |
110 |
100 |
--html-dir-url /image \
|
111 |
101 |
--cgi-dir "${CGIDIR}" \
|
112 |
102 |
--fhs \
|
113 |
|
${myconf} || die "failed the configure.pl script"
|
|
103 |
${myconf[@]} || die "failed the configure.pl script"
|
114 |
104 |
|
115 |
105 |
ebegin "Installing documentation"
|
116 |
106 |
|
... | ... | |
124 |
114 |
doman backuppc.8
|
125 |
115 |
|
126 |
116 |
# Place the documentation in the correct location
|
127 |
|
dodoc "${D}/usr/doc/BackupPC.html"
|
128 |
|
dodoc "${D}/usr/doc/BackupPC.pod"
|
129 |
|
rm -rf "${D}/usr/doc" || die
|
|
117 |
dodoc "${ED}/usr/share/doc/BackupPC/BackupPC.html"
|
|
118 |
dodoc "${ED}/usr/share/doc/BackupPC/BackupPC.pod"
|
|
119 |
rm -rf "${ED}/usr/share/doc" || die
|
130 |
120 |
|
131 |
121 |
eend 0
|
132 |
122 |
|
... | ... | |
139 |
129 |
keepdir "${LOGDIR}"
|
140 |
130 |
|
141 |
131 |
ebegin "Setting up init.d/conf.d/systemd scripts"
|
142 |
|
newinitd "${S}"/init.d/gentoo-backuppc backuppc
|
143 |
|
newconfd "${S}"/init.d/gentoo-backuppc.conf backuppc
|
|
132 |
newinitd "${S}"/systemd/init.d/gentoo-backuppc backuppc
|
|
133 |
newconfd "${S}"/systemd/init.d/gentoo-backuppc.conf backuppc
|
144 |
134 |
systemd_dounit "${FILESDIR}/${PN}.service"
|
145 |
135 |
|
146 |
136 |
insinto "${APACHE_MODULES_CONFDIR}"
|
... | ... | |
150 |
140 |
chown -R backuppc:backuppc "${D}${CONFDIR}" || die
|
151 |
141 |
chown -R backuppc:backuppc "${D}${DATADIR}" || die
|
152 |
142 |
chown -R backuppc:backuppc "${D}${LOGDIR}" || die
|
|
143 |
|
|
144 |
eend 0
|
153 |
145 |
}
|
154 |
146 |
|
155 |
147 |
pkg_postinst() {
|
156 |
148 |
elog "Installation finished, you may now start using BackupPC."
|
157 |
149 |
elog
|
158 |
|
elog "- Read the documentation in /usr/share/doc/${PF}/BackupPC.html"
|
|
150 |
elog "- Read the documentation in ${EROOT}/usr/share/doc/${PF}/BackupPC.html"
|
159 |
151 |
elog " Please pay special attention to the security section."
|
160 |
152 |
elog
|
161 |
153 |
elog "- You can launch backuppc by running:"
|
162 |
154 |
elog
|
163 |
155 |
elog " # /etc/init.d/backuppc start"
|
164 |
156 |
elog
|
165 |
|
elog "- To enable the GUI, first edit ${ROOT}/etc/conf.d/apache2 and add,"
|
|
157 |
elog "- To enable the GUI, first edit ${EROOT}/etc/conf.d/apache2 and add,"
|
166 |
158 |
elog
|
167 |
159 |
elog " \"-D BACKUPPC -D PERL -D MPM_ITK\""
|
168 |
160 |
elog
|
169 |
161 |
elog " to the APACHE2_OPTS line."
|
170 |
162 |
elog
|
171 |
|
elog " Then you must edit ${ROOT}/etc/apache2/modules.d/00_mpm_itk.conf"
|
|
163 |
elog " Then you must edit ${EROOT}/etc/apache2/modules.d/00_mpm_itk.conf"
|
172 |
164 |
elog " and adjust the values of LimitUIDRange/LimitGIDRange to include"
|
173 |
165 |
elog " the UID and GID of the backuppc user."
|
174 |
166 |
elog
|
... | ... | |
184 |
176 |
# Generate a new password if there's no auth file
|
185 |
177 |
if [[ ! -f "${CONFDIR}/users.htpasswd" ]]; then
|
186 |
178 |
adminuser="backuppc"
|
187 |
|
adminpass=$( makepasswd --chars=12 )
|
188 |
|
htpasswd -bc "${CONFDIR}/users.htpasswd" $adminuser $adminpass
|
|
179 |
adminpass=$(makepasswd --chars=12)
|
|
180 |
htpasswd -bc "${CONFDIR}/users.htpasswd" ${adminuser} ${adminpass}
|
189 |
181 |
|
190 |
182 |
elog ""
|
191 |
|
elog "- Created admin user $adminuser with password $adminpass"
|
|
183 |
elog "- Created admin user ${adminuser} with password ${adminpass}"
|
192 |
184 |
elog " To add new users, run: "
|
193 |
185 |
elog ""
|
194 |
186 |
elog " # htpasswd ${CONFDIR}/users.htpasswd newUser"
|