Rev 223 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
218 | kardasa | 1 | # Copyright 1999-2013 Gentoo Foundation |
2 | # Distributed under the terms of the GNU General Public License v2 |
||
3 | # $Header: |
||
4 | |||
5 | EAPI=4 |
||
6 | |||
7 | inherit eutils readme.gentoo user |
||
8 | |||
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 es it pt ro sv" |
||
19 | for x in ${LINGUAS}; do |
||
20 | IUSE="${IUSE} linguas_${x}" |
||
21 | done |
||
22 | |||
23 | MODULES="+alarm +alert +geo lock +network secure +session +system 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 | webcam? ( || ( ( media-video/mplayer[encode,jpeg,v4l] ) ( media-tv/xawtv ) ) ) |
||
46 | system? ( sys-apps/lshw )" |
||
47 | |||
48 | S=${WORKDIR}/${PN} |
||
49 | |||
50 | pkg_setup() { |
||
51 | if use userpriv; then |
||
52 | enewgroup ${PN} |
||
53 | fi |
||
54 | if use gtk; then |
||
55 | ewarn "You have the 'gtk' useflag enabled" |
||
56 | ewarn "This means that the ${PN} configuration" |
||
57 | ewarn "will be accessible via a graphical user" |
||
58 | ewarn "interface. This may allow the thief to alter" |
||
59 | ewarn "or disable the ${PN} functionality" |
||
60 | fi |
||
61 | } |
||
62 | |||
63 | src_prepare() { |
||
64 | DISABLE_AUTOFORMATTING="yes" |
||
65 | use userpriv && has_version "${CATEGORY}/${PN}:${SLOT}[-userpriv]" && FORCE_PRINT_ELOG="yes" |
||
66 | ! use userpriv && has_version "${CATEGORY}/${PN}:${SLOT}[userpriv]" && FORCE_PRINT_ELOG="yes" |
||
67 | |||
68 | DOC_CONTENTS="--Configuration-- |
||
69 | Make sure you follow the next steps before running prey for the |
||
70 | first time. |
||
71 | " |
||
72 | |||
73 | if use userpriv; then |
||
74 | DOC_CONTENTS+="- Add your user to ${PN} group using: |
||
75 | # gpasswd -a <your_user> ${PN}" |
||
76 | else |
||
77 | DOC_CONTENTS+="You don't seem to have 'userpriv' enabled so |
||
78 | ${PN} configuration is only accessible as root" |
||
79 | fi |
||
80 | |||
81 | DOC_CONTENTS+=" |
||
82 | - Create an account on http://preyproject.com/ |
||
83 | - Modify the core and module configuration in /etc/prey |
||
84 | - Uncomment the line in /etc/cron.d/prey.cron" |
||
85 | |||
86 | epatch "${FILESDIR}"/${P}-cron-functions.patch \ |
||
87 | "${FILESDIR}"/${PN}-0.5.4-gtk-ui.patch \ |
||
88 | "${FILESDIR}"/${PN}-0.5.3-mplayer-support.patch |
||
89 | sed -i -e 's,readonly base_path=`dirname "$0"`,readonly \ |
||
90 | base_path="/usr/share/prey",' \ |
||
91 | "${S}"/prey.sh || die |
||
92 | # Fix base path. Bug #438728 |
||
93 | sed -i -e "/readonly/s:base_path=.*:base_path=/usr/share/${PN}:" \ |
||
94 | prey.sh || die |
||
95 | } |
||
96 | |||
97 | src_install() { |
||
98 | # Remove config app if -gtk |
||
99 | if use gtk; then |
||
100 | # fix the path |
||
101 | doicon "${S}"/pixmaps/${PN}.png |
||
102 | newbin "${S}"/platform/linux/${PN}-config.py ${PN}-config |
||
103 | make_desktop_entry ${PN}-config "Prey Configuration" ${PN} \ |
||
104 | "System;Monitor" |
||
105 | else |
||
106 | rm -f "${S}"/platform/linux/prey-config.py || die |
||
107 | fi |
||
108 | |||
109 | # clear out unneeded language files |
||
110 | for lang in ${LINGUAS}; do |
||
111 | use "linguas_${lang}" || rm -f lang/${lang} modules/*/lang/${lang} |
||
112 | done |
||
113 | |||
114 | # Core files |
||
115 | insinto /usr/share/prey |
||
116 | doins -r "${S}"/core "${S}"/lang "${S}"/pixmaps "${S}"/platform "${S}"/version |
||
117 | |||
118 | # Main script |
||
119 | newbin ${PN}.sh ${PN} |
||
120 | |||
121 | # Put the configuration file into /etc, strict perms, symlink |
||
122 | insinto /etc/prey |
||
123 | newins config ${PN}.conf |
||
124 | # some scripts require /usr/share/prey/config file to be present |
||
125 | # so symlink it to prey.conf |
||
126 | dosym /etc/${PN}/${PN}.conf /usr/share/${PN}/config |
||
127 | use userpriv && { fowners root:${PN} /etc/prey ; } |
||
128 | fperms 770 /etc/prey |
||
129 | use userpriv && { fowners root:${PN} /etc/prey/prey.conf ; } |
||
130 | fperms 660 /etc/prey/prey.conf |
||
131 | |||
132 | # Add cron.d script |
||
133 | insinto /etc/cron.d |
||
134 | doins "${FILESDIR}/prey.cron" |
||
135 | use userpriv && { fowners root:${PN} /etc/cron.d/prey.cron ; } |
||
136 | fperms 660 /etc/cron.d/prey.cron |
||
137 | |||
138 | dodoc README |
||
139 | |||
140 | # modules |
||
141 | cd "${S}"/modules |
||
142 | for mod in * |
||
143 | do |
||
144 | use ${mod} || continue |
||
145 | |||
146 | # move config, if present, to /etc/prey |
||
147 | if [ -f $mod/config ] |
||
148 | then |
||
149 | insinto "/etc/prey" |
||
150 | newins "$mod/config" "mod-$mod.conf" |
||
151 | use userpriv && { fowners root:${PN} "/etc/${PN}/mod-$mod.conf" ; } |
||
152 | fperms 660 "/etc/${PN}/mod-$mod.conf" |
||
224 | kardasa | 153 | rm "${S}"/modules/$mod/config |
218 | kardasa | 154 | # Rest of the module in its expected location |
155 | insinto /usr/share/prey/modules |
||
223 | kardasa | 156 | doins -r "$mod" |
224 | kardasa | 157 | # Make symlink to /etc/prey module configuration file |
221 | kardasa | 158 | dosym /etc/${PN}/mod-$mod.conf /usr/share/${PN}/modules/$mod/config |
218 | kardasa | 159 | if [[ $mod == "lock" ]]; then |
160 | fperms 555 \ |
||
161 | "/usr/share/${PN}/modules/lock/platform/linux/${PN}-lock" |
||
162 | fi |
||
163 | fi |
||
164 | done |
||
165 | |||
166 | readme.gentoo_create_doc |
||
167 | } |