You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
3.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# Copyright 2020-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit desktop xdg
DESCRIPTION="Dr.Web for Linux Workstations"
HOMEPAGE="https://www.drweb.ru/"
SRC_URI="
x86? (
http://cdn-download.drweb.com/pub/drweb/unix/workstation/11.1/drweb-${PV}-av-linux-x86.run
)
amd64? (
http://cdn-download.drweb.com/pub/drweb/unix/workstation/11.1/drweb-${PV}-av-linux-amd64.run
)
"
LICENSE="AGPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
RESTRICT="bindist strip mirror"
S=${WORKDIR}
src_unpack() {
"${DISTDIR}/${A}" --tar xfC ${S} || die
}
pkg_preinst() {
# Sandbox Disabled
# Запускаем установку
${S}/install.sh --non-interactive || die
# Правим сценарий запуска для работы с open-rc
sed -i -E -e '78a\# < Добавление для open-rc >\n elif which rc-service >/dev/null 2>&1; then\
start-stop-daemon --start --exec "${DAEMON}" \\\
--pidfile "${PIDFILE}" -- -d -p ${PIDFILE}\n\# < Добавление для open-rc />' /etc/init.d/drweb-configd
sed -i -E -e '112a\# < Добавление для open-rc >\n elif which rc-service >/dev/null 2>&1; then\
start-stop-daemon --stop --exec "${DAEMON}" \\\
--pidfile "${PIDFILE}"\n\# < Добавление для open-rc />' /etc/init.d/drweb-configd
sed -i -E -e '143a\# < Добавление для open-rc >\n elif which rc-service >/dev/null 2>&1; then\
start-stop-daemon --signal HUP \\\
--exec "${DAEMON}" --pidfile "${PIDFILE}"\n\# < Добавление для open-rc />' /etc/init.d/drweb-configd
sed -i -E -e '160a\# < Добавление для open-rc >\n elif which rc-service >/dev/null 2>&1; then\
start-stop-daemon --stop --exec "${DAEMON}" \\\
--pidfile "${PIDFILE}" || \\\
start-stop-daemon --start --exec "${DAEMON}" \\\
--pidfile "${PIDFILE}" -- -d -p ${PIDFILE}\n\# < Добавление для open-rc />' /etc/init.d/drweb-configd
}
pkg_postinst() {
# Добавляем службы в автозагрузку
if which systemctl >/dev/null 2>&1; then
systemctl enable drweb-configd >/dev/null 2>&1 && elog "Служба drweb-configd установлена"
elif which update-rc.d >/dev/null 2>&1; then
update-rc.d drweb-configd defaults 90 10 >/dev/null 2>&1 && elog "Служба drweb-configd установлена"
elif which rc-update >/dev/null 2>&1; then
rc-update add drweb-configd default >/dev/null 2>&1 && elog "Служба drweb-configd установлена"
fi
[ -x /etc/init.d/drweb-configd ] && /etc/init.d/drweb-configd start
xdg_desktop_database_update
xdg_icon_cache_update
}
pkg_prerm() {
if [ "${REPLACED_BY_VERSION}" = "" ]; then
elog "Пакет окончательно удаляется"
/opt/drweb.com/bin/remove.sh --non-interactive || die
elog "Если желаете, то можете вручную удалить старые данные командой:"
elog "# rm -rf /var/opt/drweb.com"
# Удаляем службы
if which systemctl >/dev/null 2>&1; then
systemctl disable drweb-configd >/dev/null 2>&1
elif which update-rc.d >/dev/null 2>&1; then
update-rc.d -f drweb-configd remove >/dev/null 2>&1
elif which rc-update >/dev/null 2>&1; then
rc-update del drweb-configd >/dev/null 2>&1
fi
fi
}
pkg_postrm() {
xdg_desktop_database_update
xdg_icon_cache_update
}