FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 05-21-2011, 08:02 AM
Ljubomir Ljubojevic
 
Default Passing password to script for rpmsign of list of .rpm files

John R. Dennison wrote:
> On Sat, May 21, 2011 at 12:50:10AM -0700, John R Pierce wrote:
>> that won't work right anyways. the first -name says match just .rpm
>> files. none of those will be .zzz so the 2nd expression won't ever get
>> hit (all .rpm files are not .zzz files).
>
> That's what I get for posting at this hour of the morning
>
> But even so, I still see little point in going through grep step when
> find has the ability internally.
>

Please post on OT, I messed up with this post, did not use reply.

Ljubomir
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-21-2011, 08:13 AM
Nicolas Thierry-Mieg
 
Default Passing password to script for rpmsign of list of .rpm files

John R. Dennison wrote:
> On Sat, May 21, 2011 at 09:30:06AM +0200, Nicolas Thierry-Mieg wrote:
>> Ljubomir Ljubojevic wrote:
>>> for i in $(find . -type f | grep .rpm); do
>>
>>> rpmsign --addsign `find . -type f | grep .rpm | grep -v .zzz`
>>
>> just a small comment, grep uses regexps so this doesn't do what you want
>> (eg the . is a wildcard char). Your script can break, silently (won't
>> sign rpms whose name contains "any char followed by zzz") or not (will
>> attempt to rpmsign eg myrpms.pl), with some particular file names.
>>
>> what you really want is files ending with .rpm, so:
>> grep '.rpm$'
>
> Why are people passing this off to grep?
>
> rpmsign --addsign $(find . -type f -name *.rpm ! -name *.zzz)

agreed, using find alone is "another way to do it", although as stated
by John Pierce the second -name is useless here.
I was pointing out a flaw in the code and offering a correction using
"the same way to do it".
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-21-2011, 08:32 AM
Ljubomir Ljubojevic
 
Default Passing password to script for rpmsign of list of .rpm files

Nicolas Thierry-Mieg wrote:
> John R. Dennison wrote:
>> On Sat, May 21, 2011 at 09:30:06AM +0200, Nicolas Thierry-Mieg wrote:
>>> Ljubomir Ljubojevic wrote:
>>>> for i in $(find . -type f | grep .rpm); do
>>>> rpmsign --addsign `find . -type f | grep .rpm | grep -v .zzz`
>>> just a small comment, grep uses regexps so this doesn't do what you want
>>> (eg the . is a wildcard char). Your script can break, silently (won't
>>> sign rpms whose name contains "any char followed by zzz") or not (will
>>> attempt to rpmsign eg myrpms.pl), with some particular file names.
>>>
>>> what you really want is files ending with .rpm, so:
>>> grep '.rpm$'
>> Why are people passing this off to grep?
>>
>> rpmsign --addsign $(find . -type f -name *.rpm ! -name *.zzz)
>
> agreed, using find alone is "another way to do it", although as stated
> by John Pierce the second -name is useless here.
> I was pointing out a flaw in the code and offering a correction using
> "the same way to do it".

I did some checking, yes
find . -type f -name *.rpm
does what I need it to do. Original command from KB's blog just used
something like
"find . -type f -name *.rpm"
, without "" before *.rpm so I used grep to correct. I was not aware of
benefit of "", finding examples for command "find" is little harder
to google since it is VERY common word in general. Thanks for pointing
this out.

Using *.rpm eliminates need for anything that contains ".zzz"

OK,

Part of e-mail from OT:

Anyhow, I have developed nice script for automatic signing of (--addsign
= only unsigned, --resign = all) rpm's.

Features:
1) It supports subdirectories of unlimited? depth.
2) Password is only asked once.
3) Timestamps are preserved.
4) Script outputs check of rpm's together with active GPG Key ID and
time of signing. Useful for final check and logging.

I hope this script will find good use for rpm packagers.

I named the script "rpm-autosign".

And the code is:

#!/bin/bash
# Author Ljubomir Ljubojevic <office at plnet dot rs>
for i in $(find . -type f -name *.rpm); do
touch -r "$i" "$i.zzz"
done
rpmsign --addsign `find . -type f -name *.rpm`
for i in $(find . -type f -name *.rpm); do
touch -r "$i.zzz" "$i"
done
for i in $(find . -type f -name *.zzz); do
rm -f "$i"
done
#rpmsign --checksig `find . -name *.rpm`
rpm -qp `find . -type f -name *.rpm` --qf='%-{NAME} %{BUILDHOST}
%{PACKAGER} %{SIGGPGgpsig}
'

Notice that last line is broken in two by mail client.

Ljubomir
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-21-2011, 08:37 AM
"John R. Dennison"
 
Default Passing password to script for rpmsign of list of .rpm files

On Sat, May 21, 2011 at 10:13:52AM +0200, Nicolas Thierry-Mieg wrote:
>
> agreed, using find alone is "another way to do it", although as stated
> by John Pierce the second -name is useless here.
> I was pointing out a flaw in the code and offering a correction using
> "the same way to do it".

Oh, indeed. My find construct was flawed from converting from the
previous example at 0darkhundred and not paying proper attention after a
far too long work week. Sorry for any confusion my post caused.




John

--
No government is perfect. One of the chief virtues of a democracy,
however, is that its defects are always visible and under democratic
processes can be pointed out and corrected.

-- Harry S Truman (1884 - 1972), 33rd US President, to a joint session
of the US Congress (12 March 1947), outlining what became known as
The Truman Doctrine
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-21-2011, 03:52 PM
Johnny Hughes
 
Default Passing password to script for rpmsign of list of .rpm files

On 05/20/2011 01:13 PM, Keith Roberts wrote:
> On Fri, 20 May 2011, Ljubomir Ljubojevic wrote:
>
>> To: CentOS mailing list <centos@centos.org>
>> From: Ljubomir Ljubojevic <office@plnet.rs>
>> Subject: [CentOS] Passing password to script for rpmsign of list of .rpm files
>>
>> I am trying to automatize signing of unsigned .rpm files. My repo has at
>> least 50 x 3 packages.
>>
>> But I would have to type numerous passwords for each file. I can not see
>> hot to pass pass phrase to script.
>>
>> rpmsign --resign {--pass=??} <filename from list> ????
>>
>> Can someone advise me how to do that?
>>
>
> Hi Ljubomir.
>
> Not sure if this would work for signing packages, but I use
> this script to start all services listed in a text file:
>
> #!/bin/bash
>
> # Start all services on machine
>
> echo
> echo
> "+++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++"
> echo "Running script: $0"
> echo
> "+++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++"
> echo
>
> # start all services listed in service-names
> xargs -a ./service-names -i chkconfig --level 2345 {} on
>
> # list the status of services in service-names file
> echo "All services are now turned on (all those listed in
> service-names file)
> "
> echo "for run levels 2345"
> echo
> xargs -a ./service-names -i chkconfig --list {}
> echo
>
> exit 0
>
> You may be able to modify the above script to do what you
> need it to. xargs is in the findutils package:
>
> Name : findutils
> Arch : i386
> Epoch : 1
> Version : 4.2.27
> Release : 6.el5
> Size : 662 k
> Repo : installed
> Summary : The GNU versions of find utilities (find and xargs).
> URL : http://www.gnu.org/software/findutils/
> License : GPL
>
> Description: The findutils package contains programs which
> will help you locate files on your system. The find utility
> searches through a hierarchy of directories looking for
> files which match a certain set of criteria (such as a
> filename pattern). The xargs utility builds and executes
> command lines from standard input arguments (usually lists
> of file names generated by the find command).

I don't think he wants to find the files ... I think he wants to know
how to pass in a passwd for signature.

Can't you just do this in the script:

rpm --resign <options, names and crap> <<EOF
<passwd>
EOF



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-21-2011, 04:02 PM
Ljubomir Ljubojevic
 
Default Passing password to script for rpmsign of list of .rpm files

Johnny Hughes wrote:
> On 05/20/2011 01:13 PM, Keith Roberts wrote:
>> On Fri, 20 May 2011, Ljubomir Ljubojevic wrote:
>>
>>> To: CentOS mailing list <centos@centos.org>
>>> From: Ljubomir Ljubojevic <office@plnet.rs>
>>> Subject: [CentOS] Passing password to script for rpmsign of list of .rpm files
>>>
>>> I am trying to automatize signing of unsigned .rpm files. My repo has at
>>> least 50 x 3 packages.
>>>
>>> But I would have to type numerous passwords for each file. I can not see
>>> hot to pass pass phrase to script.
>>>
>>> rpmsign --resign {--pass=??} <filename from list> ????
>>>
>>> Can someone advise me how to do that?
>>>
>> Hi Ljubomir.
>>
>> Not sure if this would work for signing packages, but I use
>> this script to start all services listed in a text file:
>>
>> #!/bin/bash
>>
>> # Start all services on machine
>>
>> echo
>> echo
>> "+++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++"
>> echo "Running script: $0"
>> echo
>> "+++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++"
>> echo
>>
>> # start all services listed in service-names
>> xargs -a ./service-names -i chkconfig --level 2345 {} on
>>
>> # list the status of services in service-names file
>> echo "All services are now turned on (all those listed in
>> service-names file)
>> "
>> echo "for run levels 2345"
>> echo
>> xargs -a ./service-names -i chkconfig --list {}
>> echo
>>
>> exit 0
>>
>> You may be able to modify the above script to do what you
>> need it to. xargs is in the findutils package:
>>
>> Name : findutils
>> Arch : i386
>> Epoch : 1
>> Version : 4.2.27
>> Release : 6.el5
>> Size : 662 k
>> Repo : installed
>> Summary : The GNU versions of find utilities (find and xargs).
>> URL : http://www.gnu.org/software/findutils/
>> License : GPL
>>
>> Description: The findutils package contains programs which
>> will help you locate files on your system. The find utility
>> searches through a hierarchy of directories looking for
>> files which match a certain set of criteria (such as a
>> filename pattern). The xargs utility builds and executes
>> command lines from standard input arguments (usually lists
>> of file names generated by the find command).
>
> I don't think he wants to find the files ... I think he wants to know
> how to pass in a passwd for signature.
>
> Can't you just do this in the script:
>
> rpm --resign <options, names and crap> <<EOF
> <passwd>
> EOF
>
Script is already done:
http://lists.centos.org/pipermail/centos/2011-May/111937.html

I made a mistake and broke the thread, so guys replied there.

Ljubomir
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 01:15 PM.

VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org