From 97c41e8f8472e02c379a495065a4432abd941971 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 29 Sep 2015 01:46:37 +0200 Subject: added rd-show fixed debian package diff --git a/MANIFEST b/MANIFEST index c550ce4..6a4343f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -7,7 +7,8 @@ MANIFEST META.yml utils/get-rd-token utils/get-rd-week -utils/rd-user utils/rd-group +utils/rd-show +utils/rd-user utils/rhrd-ws-login utils/update-rd-tokens diff --git a/Makefile.PL b/Makefile.PL index 27d40d6..d71fe5a 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,7 +1,7 @@ use ExtUtils::MakeMaker; use 5.004; -my @utils = qw(get-rd-token rhrd-ws-login get-rd-week update-rd-tokens rd-user rd-group); +my @utils = qw(get-rd-token rhrd-ws-login get-rd-week update-rd-tokens rd-user rd-group rd-show); WriteMakefile( NAME => 'RHRD', diff --git a/debian/changelog b/debian/changelog index 3f61d75..cbe7f88 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,20 +1,27 @@ +rhrdlibs (0.6.0-1) UNRELEASED; urgency=medium + + * new upstream release + * split utils into 2 seperate packages (workstaion / server) + + -- Christian Pointner Tue, 29 Sep 2015 01:16:45 +0200 + rhrdlibs (0.5.4-1) unstable; urgency=medium * new upstream release - -- Christian Pointner Sat, 05 Sep 2015 00:33:53 +0200 + -- Christian Pointner Sat, 05 Sep 2015 00:33:53 +0200 rhrdlibs (0.5.3-1) unstable; urgency=medium * new upstream release - -- Christian Pointner Fri, 04 Sep 2015 20:33:39 +0200 + -- Christian Pointner Fri, 04 Sep 2015 20:33:39 +0200 rhrdlibs (0.5.2-2) unstable; urgency=medium * fixed packge description - -- Christian Pointner Fri, 04 Sep 2015 20:03:47 +0200 + -- Christian Pointner Fri, 04 Sep 2015 20:03:47 +0200 rhrdlibs (0.5.2-1) unstable; urgency=medium diff --git a/debian/control b/debian/control index 7e6c61e..69a12f8 100644 --- a/debian/control +++ b/debian/control @@ -20,6 +20,14 @@ Description: Radio Helsinki Rivendell Utilities This package contains the following tools * get-rd-token * get-rd-week + * rd-group + * rd-show * rd-user - * rhrd-ws-login * update-rd-tokens + +Package: rhrd-utils-ws +Architecture: all +Depends: ${misc:Depends}, ${perl:Depends}, librhrd-perl +Description: Radio Helsinki Rivendell Utilities for Workstations + This package contains the following tools + * rhrd-ws-login diff --git a/debian/rhrd-utils-ws.install b/debian/rhrd-utils-ws.install new file mode 100644 index 0000000..da3ee4e --- /dev/null +++ b/debian/rhrd-utils-ws.install @@ -0,0 +1 @@ +usr/bin/rhrd-ws-login diff --git a/debian/rhrd-utils.install b/debian/rhrd-utils.install index c703cf8..24e18cc 100644 --- a/debian/rhrd-utils.install +++ b/debian/rhrd-utils.install @@ -1 +1,6 @@ -usr/bin/ +usr/bin/get-rd-token +usr/bin/get-rd-week +usr/bin/rd-group +usr/bin/rd-show +usr/bin/rd-user +usr/bin/update-rd-tokens diff --git a/utils/rd-group b/utils/rd-group index 1717caf..72c39e9 100755 --- a/utils/rd-group +++ b/utils/rd-group @@ -46,13 +46,13 @@ my ($dbh, undef, $errorstring) = RHRD::rddb::opendb(); if(defined $dbh) { if($cmd eq "check") { (my $result, my $status, $errorstring) = RHRD::rddb::check_group($dbh, $groupname); - print "$result, $status: $errorstring\n"; + print STDERR "$result, $status: $errorstring\n"; RHRD::rddb::closedb($dbh); exit $result; } elsif($cmd eq "add") { (my $cnt, undef, $errorstring) = RHRD::rddb::add_group($dbh, $groupname, $ARGV[2]); unless(defined $cnt) { - print "$errorstring\n"; + print STDERR "$errorstring\n"; RHRD::rddb::closedb($dbh); exit 1; } @@ -60,7 +60,7 @@ if(defined $dbh) { } elsif($cmd eq "remove") { my @results = RHRD::rddb::remove_group($dbh, $groupname); if(!defined $results[0] && defined $results[2]) { - print "$results[2]\n"; + print STDERR "$results[2]\n"; } else { for my $href (@results) { print int($href->{cnt}) . " " . $href->{name} . " deleted\n"; @@ -69,7 +69,7 @@ if(defined $dbh) { } elsif($cmd eq "get-members") { my @users = RHRD::rddb::get_group_members($dbh, $groupname); if(!defined $users[0] && defined $users[1]) { - print "$users[2]\n"; + print STDERR "$users[2]\n"; RHRD::rddb::closedb($dbh); exit 1; } @@ -79,7 +79,7 @@ if(defined $dbh) { } elsif($cmd eq "add-member") { (my $cnt, undef, $errorstring) = RHRD::rddb::add_group_member($dbh, $groupname, $ARGV[2]); unless(defined $cnt) { - print "$errorstring\n"; + print STDERR "$errorstring\n"; RHRD::rddb::closedb($dbh); exit 1; } @@ -87,7 +87,7 @@ if(defined $dbh) { } elsif($cmd eq "remove-member") { (my $cnt, undef, $errorstring) = RHRD::rddb::remove_group_member($dbh, $groupname, $ARGV[2]); unless(defined $cnt) { - print "$errorstring\n"; + print STDERR "$errorstring\n"; RHRD::rddb::closedb($dbh); exit 1; } @@ -96,7 +96,7 @@ if(defined $dbh) { (my $cnt, undef, $errorstring) = RHRD::rddb::is_group_member($dbh, $groupname, $ARGV[2]); RHRD::rddb::closedb($dbh); unless(defined $cnt) { - print "$errorstring\n"; + print STDERR "$errorstring\n"; exit 1; } print $ARGV[2] . " is" . (($cnt) ? "" : " not") . " a member\n"; @@ -104,7 +104,7 @@ if(defined $dbh) { } elsif($cmd eq "get-carts") { my ($low, $high, $type, $enforce_range) = RHRD::rddb::get_group_carts($dbh, $groupname); unless(defined $low) { - print "$type\n"; + print STDERR "$type\n"; RHRD::rddb::closedb($dbh); exit 1; } @@ -112,7 +112,7 @@ if(defined $dbh) { } elsif($cmd eq "set-carts") { (my $cnt, undef, $errorstring) = RHRD::rddb::set_group_carts($dbh, $groupname, $ARGV[2], $ARGV[3], $ARGV[4], $ARGV[5]); unless(defined $cnt) { - print "$errorstring\n"; + print STDERR "$errorstring\n"; RHRD::rddb::closedb($dbh); exit 1; } @@ -120,7 +120,7 @@ if(defined $dbh) { } elsif($cmd eq "get-reports") { my ($nownext, $traffic, $music) = RHRD::rddb::get_group_reports($dbh, $groupname); unless(defined $nownext) { - print "$music\n"; + print STDERR "$music\n"; RHRD::rddb::closedb($dbh); exit 1; } @@ -128,7 +128,7 @@ if(defined $dbh) { } elsif($cmd eq "set-reports") { (my $cnt, undef, $errorstring) = RHRD::rddb::set_group_reports($dbh, $groupname, $ARGV[2], $ARGV[3], $ARGV[4]); unless(defined $cnt) { - print "$errorstring\n"; + print STDERR "$errorstring\n"; RHRD::rddb::closedb($dbh); exit 1; } diff --git a/utils/rd-show b/utils/rd-show new file mode 100755 index 0000000..4fe9def --- /dev/null +++ b/utils/rd-show @@ -0,0 +1,58 @@ +#!/usr/bin/perl -w +# +# rhrdlibs +# +# Copyright (C) 2015 Christian Pointner +# +# This file is part of rhrdlibs. +# +# rhrdlibs is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# rhrdlibs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with rhrdlibs. If not, see . +# + +use strict; +use RHRD::rddb; + +# this is ridiculous but makes it a little harder to create/remove users... +if ($> != 0 ) { + print STDERR "this must be run as root!\n"; + exit 1; +} + +my $num_args = $#ARGV + 1; +if ($num_args != 2 && $num_args !=3) { + print STDERR "Usage: rd-show (add|remove) ??\n"; + exit 1; +} + +my $cmd = $ARGV[0]; + +my ($dbh, undef, $errorstring) = RHRD::rddb::opendb(); +if(defined $dbh) { + if($cmd eq "add") { + # TODO: implement this + } elsif($cmd eq "remove") { + # TODO: implement this + } else { + print STDERR "unknown command\n"; + RHRD::rddb::closedb($dbh); + exit 1; + } + + RHRD::rddb::closedb($dbh); +} else { + print STDERR "$errorstring\n"; + exit 1; +} + +exit 0 diff --git a/utils/rd-user b/utils/rd-user index 5b9d479..6b191be 100755 --- a/utils/rd-user +++ b/utils/rd-user @@ -44,14 +44,14 @@ my ($dbh, undef, $errorstring) = RHRD::rddb::opendb(); if(defined $dbh) { if($cmd eq "check") { (my $result, my $status, $errorstring) = RHRD::rddb::check_user($dbh, $username); - print "$result, $status: $errorstring\n"; + print STDERR "$result, $status: $errorstring\n"; RHRD::rddb::closedb($dbh); exit $result; } elsif($cmd eq "add") { my $token = mkpasswd(-length => 16, -minnum => 3, -minupper => 3, -minspecial => 0); (my $cnt, undef, $errorstring) = RHRD::rddb::add_user($dbh, $username, $token, $fullname); unless(defined $cnt) { - print "$errorstring\n"; + print STDERR "$errorstring\n"; RHRD::rddb::closedb($dbh); exit 1; } @@ -59,7 +59,7 @@ if(defined $dbh) { } elsif($cmd eq "remove") { my @results = RHRD::rddb::remove_user($dbh, $username); if(!defined $results[0] && defined $results[2]) { - print "$results[2]\n"; + print STDERR "$results[2]\n"; } else { for my $href (@results) { print int($href->{cnt}) . " " . $href->{name} . " deleted\n"; -- cgit v0.10.2