File prey.spec of Package prey

#
# spec file for package prey
#
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:           prey
Version:        0.6.4
Release:        0
License:        GPL-3.0
Summary:        Tracking device for your laptop
Url:            https://preyproject.com/
Group:          System/Monitoring
Source0:        https://preyproject.com/releases/%{version}/%{name}-%{version}-linux.zip
Source1:        https://preyproject.com/releases/%{version}/%{name}-%{version}-linux.zip.md5sum
# PATCH-FIX-OPENSUSE - session_functions.patch malcolmlewis@opensuse.org --
# Use xwd for screenshot capture, still under discussion with Developer
# https://groups.google.com/group/prey-security/browse_thread/thread/1d894b0d80ed39a5
# PATCH-FIX-UPSTREAM: https://github.com/prey/prey-bash-client-modules/pull/19
Patch0:         session_functions.patch
BuildRequires:  ImageMagick
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  unzip
BuildRequires:  update-desktop-files
Requires:       ImageMagick
Requires:       curl
Requires:       perl-IO-Socket-SSL
Requires:       perl-Net-SSLeay
Requires:       python >= %{py_ver}
Requires:       python-gtk >= 2.6
Requires:       v4l-tools
Requires:       wget
Requires:       xdg-utils
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
Prey is a lightweight application that will help you track and find your
laptop if it ever gets stolen.

The script runs at a specified interval in your machine, and checks for a 
specified URL in the web. If the URL exists it means the computer/laptop has 
been stolen, and thus goes through the information gathering routine and
sends all that info through to a previously defined email address. You can
also not define a URL and in that case the program will send the data every
time it runs.

You can also use the Prey web control panel (control.preyproject.com)
to manage the computer state, as well as toggling different modules for
triggering certain behaviours remotely. In this case you don't have to
worry about the URL thing since it takes care of that for you. You only
need to register and insert the API and Device keys in the Prey 
configuration.

%prep
%setup -q -n %{name}
%patch0

%build
# No building required, just a placehoder

%install
mkdir -p %{buildroot}%{_datadir}/%{name}
cp -af config core lang modules pixmaps platform prey.sh version \
   %{buildroot}%{_datadir}/%{name}

pushd %{buildroot}%{_datadir}/%{name}
# Set file permissions on all files as they are 0644
   chmod -Rf 0755 *
# Fix files that don't need to be executable
   chmod 0644 version \
   platform/linux/prey-config.glade \
   platform/linux/prey-config2.glade \
   modules/alarm/version \
   modules/lock/version \
   modules/alert/version \
   modules/session/version \
   modules/network/version \
   modules/system/version \
   modules/webcam/version \
   modules/wipe/version \
   modules/geo/version
# Only allow root to run prey.sh and edit config
   chmod 0700 prey.sh config
popd

#Create configure script
mkdir -p %{buildroot}%{_bindir}
cat > %{buildroot}%{_bindir}/%{name} << EOF
#!/bin/sh
#Simple script to start prey configurator

cd /usr/share/prey/platform/linux

KDESU=/usr/bin/kdesu
GNOMESU=/usr/bin/gnomesu
XDGSU=/usr/bin/xdg-su

if [ -e "\$KDESU" ]
   then
   \$KDESU -c /usr/share/prey/platform/linux/prey-config.py
elif [ -e "\$GNOMESU" ]
   then
   \$GNOMESU -c /usr/share/prey/platform/linux/prey-config.py
elif [ -e "\$XDGSU" ]
   then
   \$XDGSU -c /usr/share/prey/platform/linux/prey-config.py
else
   echo "Unable to find suitable su application, please install xdg-utils"
fi
EOF

chmod +x %{buildroot}%{_bindir}/%{name}

# Add desktop file
cat > %{name}.desktop <<EOF
[Desktop Entry]
Encoding=UTF-8
Name=Prey Configurator
GenericName=Prey Configurator
Comment=Configure Prey tracking device for your laptop
Exec=%{name}
Icon=%{name}
Terminal=false
Type=Application
StartupNotify=true
Categories=System;Monitor;
EOF

pushd %{buildroot}%{_datadir}/%{name}/pixmaps/
convert -geometry 64 %{name}.png %{name}.png
popd
mkdir -p %{buildroot}%{_datadir}/pixmaps
cp %{buildroot}%{_datadir}/%{name}/pixmaps/%{name}.png \
   %{buildroot}%{_datadir}/pixmaps/

%suse_update_desktop_file -i %{name}

%fdupes -s %{buildroot}%{_datadir}/%{name}

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%files
%defattr(-,root,root,-)
%doc README LICENSE
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/%{name}
%config(noreplace) %{_datadir}/%{name}/config

%changelog
openSUSE Build Service is sponsored by