| 1 |
hwoarang |
1.3 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
hwoarang |
1.1 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
zmedico |
1.4 |
# $Header: /var/cvsroot/gentoo-x86/app-laptop/prey/prey-0.5.3.ebuild,v 1.3 2012/04/13 09:02:08 hwoarang Exp $
|
| 4 |
hwoarang |
1.1 |
|
| 5 |
|
|
EAPI=4
|
| 6 |
|
|
|
| 7 |
zmedico |
1.4 |
inherit eutils user
|
| 8 |
hwoarang |
1.1 |
|
| 9 |
|
|
DESCRIPTION="Tracking software for asset recovery"
|
| 10 |
|
|
HOMEPAGE="http://preyproject.com/"
|
| 11 |
|
|
SRC_URI="http://preyproject.com/releases/${PV}/${P}-linux.zip"
|
| 12 |
|
|
|
| 13 |
|
|
LICENSE="GPL-3"
|
| 14 |
|
|
SLOT="0"
|
| 15 |
|
|
KEYWORDS="~amd64 ~x86"
|
| 16 |
|
|
IUSE="gtk userpriv"
|
| 17 |
|
|
|
| 18 |
|
|
LINGUAS="en it sv es"
|
| 19 |
|
|
for x in ${LINGUAS}; do
|
| 20 |
|
|
IUSE="${IUSE} linguas_${x}"
|
| 21 |
|
|
done
|
| 22 |
|
|
|
| 23 |
|
|
MODULES="+alarm +alert +geo lock +network secure +session webcam"
|
| 24 |
|
|
IUSE="${IUSE} ${MODULES}"
|
| 25 |
|
|
|
| 26 |
|
|
DEPEND=""
|
| 27 |
|
|
#TODO: some of these deps may be dependent on USE
|
| 28 |
|
|
RDEPEND="${DEPEND}
|
| 29 |
|
|
app-shells/bash
|
| 30 |
|
|
virtual/cron
|
| 31 |
|
|
|| ( net-misc/curl net-misc/wget )
|
| 32 |
|
|
dev-perl/IO-Socket-SSL
|
| 33 |
|
|
dev-perl/Net-SSLeay
|
| 34 |
|
|
sys-apps/net-tools
|
| 35 |
|
|
alarm? ( media-sound/mpg123
|
| 36 |
|
|
media-sound/pulseaudio
|
| 37 |
|
|
)
|
| 38 |
|
|
alert? ( || ( ( gnome-extra/zenity ) ( kde-base/kdialog ) ) )
|
| 39 |
|
|
gtk? ( dev-python/pygtk )
|
| 40 |
|
|
lock? ( dev-python/pygtk )
|
| 41 |
|
|
network? ( net-analyzer/traceroute )
|
| 42 |
|
|
session? ( sys-apps/iproute2
|
| 43 |
|
|
|| ( media-gfx/scrot media-gfx/imagemagick )
|
| 44 |
|
|
)
|
| 45 |
ssuominen |
1.2 |
webcam? ( || ( ( media-video/mplayer[encode,jpeg,v4l] ) ( media-tv/xawtv ) ) )"
|
| 46 |
hwoarang |
1.1 |
|
| 47 |
|
|
S=${WORKDIR}/${PN}
|
| 48 |
|
|
|
| 49 |
|
|
pkg_setup() {
|
| 50 |
|
|
if use userpriv; then
|
| 51 |
|
|
enewgroup ${PN}
|
| 52 |
|
|
fi
|
| 53 |
|
|
if use gtk; then
|
| 54 |
|
|
ewarn "You have the 'gtk' useflag enabled"
|
| 55 |
|
|
ewarn "This means that the ${PN} configuration"
|
| 56 |
|
|
ewarn "will be accessible via a graphical user"
|
| 57 |
|
|
ewarn "interface. This may allow the thief to alter"
|
| 58 |
|
|
ewarn "or disable the ${PN} functionality"
|
| 59 |
|
|
fi
|
| 60 |
|
|
|
| 61 |
|
|
# remove system module since it depends on hal and we don't
|
| 62 |
|
|
# have hal in portage anymore
|
| 63 |
|
|
rm -rf "${S}"/modules/system || die
|
| 64 |
|
|
}
|
| 65 |
|
|
|
| 66 |
|
|
src_prepare() {
|
| 67 |
|
|
epatch "${FILESDIR}"/${PN}-cron-functions.patch \
|
| 68 |
|
|
"${FILESDIR}"/${P}-gtk-ui.patch \
|
| 69 |
|
|
"${FILESDIR}"/${P}-mplayer-support.patch
|
| 70 |
|
|
sed -i -e 's,readonly base_path=`dirname "$0"`,readonly \
|
| 71 |
|
|
base_path="/usr/share/prey",' \
|
| 72 |
|
|
"${S}"/prey.sh || die
|
| 73 |
|
|
}
|
| 74 |
|
|
|
| 75 |
|
|
src_install() {
|
| 76 |
|
|
# Remove config app if -gtk
|
| 77 |
|
|
if use gtk; then
|
| 78 |
|
|
# fix the path
|
| 79 |
|
|
doicon "${S}"/pixmaps/${PN}.png
|
| 80 |
|
|
newbin "${S}"/platform/linux/${PN}-config.py ${PN}-config
|
| 81 |
|
|
make_desktop_entry ${PN}-config "Prey Configuration" ${PN} \
|
| 82 |
|
|
"System;Monitor"
|
| 83 |
|
|
else
|
| 84 |
|
|
rm -f "${S}"/platform/linux/prey-config.py || die
|
| 85 |
|
|
fi
|
| 86 |
|
|
|
| 87 |
|
|
# clear out unneeded language files
|
| 88 |
|
|
for lang in ${LINGUAS}; do
|
| 89 |
|
|
use "linguas_${lang}" || rm -f lang/${lang} modules/*/lang/${lang}
|
| 90 |
|
|
done
|
| 91 |
|
|
|
| 92 |
|
|
# Core files
|
| 93 |
|
|
insinto /usr/share/prey
|
| 94 |
|
|
doins -r "${S}"/core "${S}"/lang "${S}"/pixmaps "${S}"/platform "${S}"/version
|
| 95 |
|
|
|
| 96 |
|
|
# Main script
|
| 97 |
|
|
newbin ${PN}.sh ${PN}
|
| 98 |
|
|
|
| 99 |
|
|
# Put the configuration file into /etc, strict perms, symlink
|
| 100 |
|
|
insinto /etc/prey
|
| 101 |
|
|
newins config ${PN}.conf
|
| 102 |
|
|
# some scripts require /usr/share/prey/config file to be present
|
| 103 |
|
|
# so symlink it to prey.conf
|
| 104 |
|
|
dosym /etc/${PN}/${PN}.conf /usr/share/${PN}/config
|
| 105 |
|
|
use userpriv && { fowners root:${PN} /etc/prey ; }
|
| 106 |
|
|
fperms 770 /etc/prey
|
| 107 |
|
|
use userpriv && { fowners root:${PN} /etc/prey/prey.conf ; }
|
| 108 |
|
|
fperms 660 /etc/prey/prey.conf
|
| 109 |
|
|
|
| 110 |
|
|
# Add cron.d script
|
| 111 |
|
|
insinto /etc/cron.d
|
| 112 |
|
|
doins "${FILESDIR}/prey.cron"
|
| 113 |
|
|
use userpriv && { fowners root:${PN} /etc/cron.d/prey.cron ; }
|
| 114 |
|
|
fperms 660 /etc/cron.d/prey.cron
|
| 115 |
|
|
|
| 116 |
|
|
dodoc README
|
| 117 |
|
|
|
| 118 |
|
|
# modules
|
| 119 |
|
|
cd "${S}"/modules
|
| 120 |
|
|
for mod in *
|
| 121 |
|
|
do
|
| 122 |
|
|
use ${mod} || continue
|
| 123 |
|
|
|
| 124 |
|
|
# move config, if present, to /etc/prey
|
| 125 |
|
|
if [ -f $mod/config ]
|
| 126 |
|
|
then
|
| 127 |
|
|
insinto "/etc/prey"
|
| 128 |
|
|
newins "$mod/config" "mod-$mod.conf"
|
| 129 |
|
|
use userpriv && { fowners root:${PN} "/etc/${PN}/mod-$mod.conf" ; }
|
| 130 |
|
|
fperms 660 "/etc/${PN}/mod-$mod.conf"
|
| 131 |
hwoarang |
1.3 |
# Rest of the module in its expected location
|
| 132 |
|
|
insinto /usr/share/prey/modules
|
| 133 |
|
|
doins -r "$mod"
|
| 134 |
hwoarang |
1.1 |
if [[ $mod == "lock" ]]; then
|
| 135 |
|
|
fperms 555 \
|
| 136 |
|
|
"/usr/share/${PN}/modules/lock/platform/linux/${PN}-lock"
|
| 137 |
|
|
fi
|
| 138 |
|
|
fi
|
| 139 |
|
|
done
|
| 140 |
|
|
|
| 141 |
|
|
}
|
| 142 |
|
|
pkg_postinst () {
|
| 143 |
|
|
elog "--Configuration--"
|
| 144 |
|
|
elog "Make sure you follow the next steps before running prey for the"
|
| 145 |
|
|
elog "first time"
|
| 146 |
|
|
if use userpriv; then
|
| 147 |
|
|
elog "- Add your user to ${PN} group using"
|
| 148 |
|
|
elog "gpasswd -a <your_user> ${PN}"
|
| 149 |
|
|
else
|
| 150 |
|
|
elog "You don't seem to have 'userpriv' enabled so"
|
| 151 |
|
|
elog "${PN} configuration is only accessible as root"
|
| 152 |
|
|
fi
|
| 153 |
|
|
elog "- Create an account on http://preyproject.com/"
|
| 154 |
|
|
elog "- Modify the core and module configuration in /etc/prey"
|
| 155 |
|
|
elog "- Uncomment the line in /etc/cron.d/prey.cron"
|
| 156 |
|
|
}
|