Skip to content

Commit

Permalink
added cron+conf+spec
Browse files Browse the repository at this point in the history
  • Loading branch information
prusnak committed Mar 14, 2009
1 parent 3334586 commit c1163f1
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 4 deletions.
14 changes: 10 additions & 4 deletions popcorn-client
Expand Up @@ -128,7 +128,13 @@ class Client:
def write(self):
print self.data,

client = Client()
# client.post()
# client.email()
client.write()
enabled = os.environ['POPCORN_ENABLED'] if os.environ.has_key('POPCORN_ENABLED') else None
if enabled and enabled != '0':
method = os.environ['POPCORN_METHOD'] if os.environ.has_key('POPCORN_METHOD') else None
client = Client()
if method == '0':
client.email()
elif method == '1':
client.post()
else:
client.write()
11 changes: 11 additions & 0 deletions popcorn.conf
@@ -0,0 +1,11 @@
# participate in the survey?
# 0 - no
# 1 - yes

POPCORN_ENABLED=1

# method to use for submitting information
# 0 - e-mail
# 1 - HTTP POST

POPCORN_METHOD=1
6 changes: 6 additions & 0 deletions popcorn.cron
@@ -0,0 +1,6 @@
#!/bin/sh

if [ -x /usr/bin/popcorn-client -a -f /etc/popcorn.conf ]; then
. /etc/popcorn.conf
/usr/bin/popcorn-client
fi
34 changes: 34 additions & 0 deletions popcorn.spec
@@ -0,0 +1,34 @@
Name: popcorn
Version: 0.1
Release: 0
Url: http://en.opensuse.org/Popcorn
License: X11/MIT
Group: System/Packages
Summary: Popularity Contest (for RPM)
Source0: popcorn-client
Source1: popcorn.conf
Source2: popcorn.cron
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python rpm-python
Requires: python

%description
Popularity Contest (for RPM)

%prep
cp %{SOURCE0} %{SOURCE1} %{SOURCE2} .

%build

%install
install -D -m 0755 popcorn-client $RPM_BUILD_ROOT%{_bindir}/popcorn-client
install -D -m 0644 popcorn.conf $RPM_BUILD_ROOT%{_sysconfdir}/popcorn.conf
install -D -m 0755 popcorn.cron $RPM_BUILD_ROOT%{_sysconfdir}/cron.weekly/popcorn

%clean
rm -rf $RPM_BUILD_ROOT

%files
%{_bindir}/popcorn-client
%{_sysconfdir}/popcorn.conf
%{_sysconfdir}/cron.weekly/popcorn

0 comments on commit c1163f1

Please sign in to comment.