experimental/trunk/novell4gentoo/net-print/novell-iprint-xclient/novell-iprint-xclient-6.500.20070508_p1-r1.ebuild

147 lines
5.0 KiB
Bash

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
NOVELL_BUILDID="GsODlkBPM2g~"
NOVELL_FILE32="OES2-i386-CD1.iso"
RESTRICT="mirror strip"
inherit novell eutils rpm nsplugins
MY_PV="${PV/_p/-}"
DESCRIPTION="Novell iPrint Client for Linux Low Security"
HOMEPAGE="http://www.novell.com"
SRC_URI="http://${NOVELL_ACCOUNT_USERNAME}:${NOVELL_ACCOUNT_PASSWORD}@cdn.novell.com/prot/${NOVELL_BUILDID}/${NOVELL_FILE32}"
LICENSE="Novell-NCL"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE="gtk linguas_cs linguas_de linguas_es linguas_fr linguas_hu linguas_it linguas_ja linguas_pl linguas_pt linguas_ru linguas_sl linguas_zh_cn linguas_zh_tw"
DEPEND=">=app-arch/p7zip-4.15"
RDEPEND="virtual/libc
dev-libs/atk
dev-libs/expat
dev-libs/glib
media-libs/fontconfig
media-libs/freetype
media-libs/glitz
media-libs/libpng
>=net-print/cups-1.2
sys-libs/zlib
www-client/mozilla-firefox
x11-libs/gtk+
x11-libs/pango
x11-libs/cairo
x11-libs/libXrender
x11-libs/libX11
x11-libs/libXext
!net-print/novell-iprint-xclient-sh
!net-print/novell-iprint-xclient-sl"
src_unpack() {
7z x "${DISTDIR}"/${NOVELL_FILE32}
cd "${WORKDIR}"
rpm_unpack "${WORKDIR}"/suse/noarch/novell-iprint-client-6.0.20070914-2.noarch.rpm
mkdir -p "${WORKDIR}"/${PN}-${MY_PV}
cd ${PN}-${MY_PV}
if use x86
then
ndir=x86
narch=i586
nlib=lib
elif use amd64
then
ndir=x86_64
narch=x86_64
nlib=lib64
fi
rpm_unpack "${WORKDIR}"/var/opt/novell/iprint/htdocs/clients/linux/${ndir}/novell-iprint-xclient-sl-${MY_PV}.${narch}.rpm
}
src_compile() {
CUPSDIR=`cups-config --serverbin`
}
src_install() {
for x in cs de es fr hu it ja pl pt ru sl zh_cn zh_tw
do
if use linguas_${x}
then
cp "${WORKDIR}"/${PN}-${MY_PV}/opt/novell/iprint/share/locale/${x}/LC_MESSAGES/iprint-client.mo "${WORKDIR}"/${x}.mo
domo "${WORKDIR}"/${x}.mo
fi
done
insinto /etc/opt/novell/iprint
doins "${WORKDIR}"/${PN}-${MY_PV}/etc/opt/novell/iprint/*
into /opt/novell/iprint
dobin "${WORKDIR}"/${PN}-${MY_PV}/opt/novell/iprint/bin/*
insinto /opt/novell/iprint/plugin
doins "${WORKDIR}"/${PN}-${MY_PV}/opt/novell/iprint/plugin/npnipp.so
inst_plugin /opt/novell/iprint/plugin/npnipp.so
insinto /usr/share/autostart
doins "${WORKDIR}"/${PN}-${MY_PV}/opt/kde3/share/autostart/*.desktop
dosed "s:/usr/share/pixmaps/iprint_32:iprint.gif:g" /usr/share/autostart/iprint.desktop
exeinto ${CUPSDIR}/backend
doexe "${WORKDIR}"/${PN}-${MY_PV}/usr/${nlib}/cups/backend/*
dosym ${CUPSDIR} /usr/$(get_libdir)/cups
keepdir /var/opt/novell/log/iprint/client
into /opt/novell
dolib "${WORKDIR}"/${PN}-${MY_PV}/opt/novell/${nlib}/*
doman "${WORKDIR}"/${PN}-${MY_PV}/opt/novell/man/*/*
newicon "${WORKDIR}"/${PN}-${MY_PV}/opt/novell/iprint/share/icons/iprint_32.gif iprint.gif
if use x86
then
doenvd "${FILESDIR}"/80novell-iprint
elif use amd64
then
doenvd "${FILESDIR}"/80novell-iprint64
fi
}
pkg_nofetch() {
einfo "This files require you to register at ${HOMEPAGE} (free account)"
einfo "Please download following file:"
einfo " - ${NOVELL_FILE32}"
einfo "from http://download.novell.com/Download?buildid=${NOVELL_BUILDID}"
einfo "and place it in ${DISTDIR}"
einfo ""
einfo "To get rid of downloading files from ${HOMEPAGE}"
einfo "you can create a file /etc/portage/novell.acc"
einfo "containing the novell account infos with following commands"
einfo "# echo \"NOVELL_ACCOUNT_USERNAME=\\\"balduin\\\"\" >> /etc/portage/novell.acc"
einfo "# echo \"NOVELL_ACCOUNT_PASSWORD=\\\"derfisch\\\"\" >> /etc/portage/novell.acc"
}
pkg_postinst() {
##
## First, modify cupsd.conf to allow local access to /admin:
##
DATE=$(date +%Y%m%d)
TMP_DIR=/tmp
TMP_FILE="$(mktemp ${TMP_DIR}/.cupsd.conf.XXXXXX)"
EDIT_TAG="Edited by Novell-iPrint:"
CONF_FILE="/etc/cups/cupsd.conf"
BACKUP_FILE=${CONF_FILE}.bak.${DATE}.$$
# Modify CONF_FILE for 'low' security model for /admin section
if [ -f ${CONF_FILE} ]; then
sed -e "/^ *< *Location *\/admin/,/^ *< *\/Location *>/{ # Work only in the '<Location /admin>' block
/^.*Location/!d; # Delete all but the location directives
s@\(^ *< *Location.*$\)@\1\n# ${EDIT_TAG} ${DATE}\n#\n# Security setting: low\n# Original configuration backed up to ${BACKUP_FILE}\n#\n\nAuthType None\n\n## Restrict access to local domain\nOrder Deny,Allow\nDeny From All\nAllow From 127.0.0.1@;
}" ${CONF_FILE} > "${TMP_FILE}"
# Replace the CONF_FILE with our modified version
if ! cp "${CONF_FILE}" "${BACKUP_FILE}"; then
eerror "Failed to create backup of $(basename ${CONF_FILE})"
einfo "Add 'Allow From 127.0.0.1' for all users to <Location /admin> section manualy."
elif ! mv "${TMP_FILE}" ${CONF_FILE}; then
eerror "Failed to modify $(basename ${CONF_FILE})"
einfo "Add 'Allow From 127.0.0.1' for all users to <Location /admin> section manualy."
fi
rm -rf "${TMP_FILE}"
else
echo "${CONF_FILE}: No such file or directory or already modified by Novell iPrint"
fi
}