[opensuse-packaging] commands to go into a .specfile
Hello, I am trying to compile the cricket from source code. I am using this a guide to try and get it going:- http://cricket.sourceforge.net/support/doc/beginner.html I need to put the following commands into the spec file 1. Setup cricket userid and group [done] %pre id cricket >/dev/null 2>&1 if [ $? -ne 0 ]; then /usr/sbin/groupadd cricket /usr/sbin/useradd -r -d %{_libdir}/%{name} -c "Cricket SNMP Monitor" cricket fi step 2. How do I unpack the cricket-1.0.5.tar.gz into the cricket account that has just been created, what commands do I use to do this ? The next steps from 2 onwards needs to go into the .specfile. Question: What section do they go under ? step 3. /bin/su - cricket step 4. /bin/ln -s cricket-1.0.5 cricket step 5. /bin/cp -rv cricket/sample-config cricket-config step 6. cd ~cricket step 7. cd cricket step 8. /bin/cp -v cricket-conf.pl.sample cricket-conf.pl Another question:- Q. How do I install the following Perl modules ?, what commands do I add to the .specfile ? You need to install the following Perl modules for Cricket to work correctly. Module From -------------------------------------------------------------------- MD5 CPAN: by-authors/id/GAAS/Digest-MD5-*.tar.gz LWP CPAN: by-authors/id/GAAS/libwww-perl-*.tar.gz DB_File CPAN: by-authors/id/PMQS/DB_File-*.tar.gz Date::Parse CPAN: by-authors/id/GBARR/TimeDate-*.tar.gz Time::HiRes CPAN: by-authors/id/DEWEG/Time-HiRes-*.tar.gz SNMP_Session http://www.switch.ch/misc/leinen/snmp/perl RRD http://ee-staff.ethz.ch/~oetiker/webtools/rrdtool Project -> https://build.opensuse.org/package/show?package=cricket-1-0-5&project=home%3Adoiggl Thanks for your answers and time on this Glenn. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
* doiggl@velocitynet.com.au (doiggl@velocitynet.com.au) [20091026 11:50]:
I am trying to compile the cricket from source code. I am using this a guide to try and get it going:- http://cricket.sourceforge.net/support/doc/beginner.html
I need to put the following commands into the spec file
1. Setup cricket userid and group [done]
I'd create a special user to run Cricket as that makes things much easier. In the .spec do something like: %pre /usr/sbin/useradd -r -o -c "Cricket SNMP Monitor" \ -s /bin/false -d %{_libdir}/%{name} %{name} 2> /dev/null || :
step 2. How do I unpack the cricket-1.0.5.tar.gz into the cricket account that has just been created, what commands do I use to do this ?
You don't. I'd install into a directory under /opt and make that direcory and all files below it belong to the user cricket in the spec file.
Another question:- Q. How do I install the following Perl modules ?, what commands do I add to the .specfile ?
Check if openSUSE already provides them. If not, create a new package for each module that's missing. Add all needed modules to Requires: of cricket.spec. cheers Philipp -- Anything whose specification is too complicated to explain easily probably needs to be redesigned. David Abrahams on boost -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Thankyou Philipp for the infomation. Philipp wrote:
You don't. I'd install into a directory under /opt and make that direcory and all files below it belong to the user cricket in the spec file.
I changed the line in the spec file to /usr/sbin/useradd -r -o -c "Cricket SNMP Monitor" -s /bin/false -d %{_libdir}/%{name} %{name} 2> /dev/null || : Question: What syntax do I use for the following commands in the specfile ? , and in which section should these commands be in ? # cd /opt # gunzip -c cricket-1.0.5.tar.gz| tar xopf - # /bin/ln -s cricket-1.0.5 cricket # cd cricket # /bin/cp -v cricket-conf.pl.sample cricket-conf.pl Also how do you change the ownership of the files /opt/cricket Have you got an example please. Thanks for the info Glenn. Project -> https://build.opensuse.org/package/show?package=cricket-1-0-5&project=home%3Adoiggl -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
* doiggl@velocitynet.com.au (doiggl@velocitynet.com.au) [20091027 01:04]:
Philipp wrote:
You don't. I'd install into a directory under /opt and make that direcory and all files below it belong to the user cricket in the spec file.
I changed the line in the spec file to
/usr/sbin/useradd -r -o -c "Cricket SNMP Monitor" -s /bin/false -d %{_libdir}/%{name} %{name} 2> /dev/null || :
Question: What syntax do I use for the following commands in the specfile ? , and in which section should these commands be in ?
# cd /opt # gunzip -c cricket-1.0.5.tar.gz| tar xopf - # /bin/ln -s cricket-1.0.5 cricket # cd cricket # /bin/cp -v cricket-conf.pl.sample cricket-conf.pl
No, do it differently. Simply name the cricket tarball As source and let rpm unpack it. I'd recommend repacking it as bz2 with bznew as that would save space. And then do in %install: mkdir -p %{buildroot}/opt cd .. cp -a %{name}-%{version} %{buildroot}/opt/%{name} pushd %{buildroot}/opt/%{name} cp cricket-conf.pl.sample cricket-conf.pl Remember to mark cricket-conf.pl as a configuration file in the %files section by doing either %config /opt/%{name}/cricket-conf.pl or %config(noreplace) /opt/%{name}/cricket-conf.pl
Also how do you change the ownership of the files /opt/cricket Have you got an example please.
By simply packaging them with said owner, eg. by changing %defattr(-,root,root) to %defattr(-,cricket,root) or %defattr(-,cricket,cricket) In the latter case you'd have to create the group cricket in the spec file. See mysql.spec for an example. Philipp -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Tue, 27 Oct 2009 12:59:18 +0100, Philipp Thomas <pth@suse.de> wrote:
* doiggl@velocitynet.com.au (doiggl@velocitynet.com.au) [20091027 01:04]:
You don't. I'd install into a directory under /opt and make that
Philipp wrote: direcory and all files below it belong to the user cricket in the spec file.
I changed the line in the spec file to
/usr/sbin/useradd -r -o -c "Cricket SNMP Monitor" -s /bin/false -d %{_libdir}/%{name} %{name} 2> /dev/null || :
Question: What syntax do I use for the following commands in the specfile ? , and in which section should these commands be in ?
# cd /opt # gunzip -c cricket-1.0.5.tar.gz| tar xopf - # /bin/ln -s cricket-1.0.5 cricket # cd cricket # /bin/cp -v cricket-conf.pl.sample cricket-conf.pl
No, do it differently. Simply name the cricket tarball As source and let rpm unpack it. I'd recommend repacking it as bz2 with bznew as that would save space. And then do in %install:
mkdir -p %{buildroot}/opt cd .. cp -a %{name}-%{version} %{buildroot}/opt/%{name} pushd %{buildroot}/opt/%{name} cp cricket-conf.pl.sample cricket-conf.pl
Remember to mark cricket-conf.pl as a configuration file in the %files section by doing either
%config /opt/%{name}/cricket-conf.pl
or
%config(noreplace) /opt/%{name}/cricket-conf.pl
Also how do you change the ownership of the files /opt/cricket Have you got an example please.
By simply packaging them with said owner, eg. by changing
%defattr(-,root,root)
to
%defattr(-,cricket,root)
or
%defattr(-,cricket,cricket)
In the latter case you'd have to create the group cricket in the spec file. See mysql.spec for an example.
Philipp -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Thanks for the info Philipp Question what should i set name to ? (e.g just cricket-1.0.5) - So far I've done the following items:- # bznew -K cricket-1.0.5.tar.gz -> output cricket-1.0.5.tar.bz2 and attached it the project. Set Source: cricket-1.0.5.tar.bz2 #next install cricket-1.0.5.into /opt #still need to make symbolic link from to %install mkdir -p %{buildroot}/opt cd .. cp -a %{name}-%{version} %{buildroot}/opt/%{name} pushd %{buildroot}/opt/%{name} #need to make symbolic link from cricket to cricket-1.0.5 cd %{buildroot}/opt /bin/ln -s cricket-1.0.5 cricket cp cricket-conf.pl.sample cricket-conf.pl %pre id cricket >/dev/null 2>&1 if [ $? -ne 0 ]; then /usr/sbin/groupadd cricket /usr/sbin/useradd -r -o -c "Cricket SNMP Monitor" -s /bin/false -d %{_libdir}/%{name} %{name} 2> /dev/null || : fi %postun if [ $1 -eq 0 ]; then /usr/sbin/userdel cricket /usr/sbin/groupdel cricket fi %files %defattr(-,cricket,cricket) specfile ->https://build.opensuse.org/package/edit_file?file=cricket-1-0-5.spec&package=cricket-1-0-5&project=home%3Adoiggl project -> https://build.opensuse.org/package/show?package=cricket-1-0-5&project=home%3Adoiggl Question:- Does the specfile look ok to you ? Thanks for the help Glenn -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Tue, 27 Oct 2009 12:59:18 +0100, Philipp Thomas <pth@suse.de> wrote:
You don't. I'd install into a directory under /opt and make that
Philipp wrote: direcory and all files below it belong to the user cricket in the spec
file.
No, do it differently. Simply name the cricket tarball As source and let rpm unpack it. I'd recommend repacking it as bz2 with bznew as that would save space. And then do in %install:
I did the following: # bznew -K cricket-1.0.5.tar.gz -> output cricket-1.0.5.tar.bz2 I attached cricket-1.0.5.tar.bz2 to the project. Question:- How do I detatch cricket-1.0.5.tar.bz2 in the project to the /opt directory and unpack it. Also can these commands go in the %install section ? # cd /opt # /bin/ln -s cricket-1.0.5 cricket specfile ->https://build.opensuse.org/package/edit_file?file=cricket-1-0-5.spec&package=cricket-1-0-5&project=home%3Adoiggl project -> https://build.opensuse.org/package/show?package=cricket-1-0-5&project=home%3Adoiggl Thanks for the advice. Glenn -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
doiggl@velocitynet.com.au napsal(a):
Hello, I am trying to compile the cricket from source code. I am using this a guide to try and get it going:- http://cricket.sourceforge.net/support/doc/beginner.html
I need to put the following commands into the spec file
1. Setup cricket userid and group [done]
%pre id cricket >/dev/null 2>&1 if [ $? -ne 0 ]; then /usr/sbin/groupadd cricket /usr/sbin/useradd -r -d %{_libdir}/%{name} -c "Cricket SNMP Monitor" cricket fi
You have it too simple. Correct way to check account is getent (user can use ldap, NIS...). And it can happen that group exist, but username not, and vice versa. This is sniplet we use in Spacewalk project: %define package_name nocpulse getent group %{package_name} >/dev/null || groupadd -r %{package_name} getent passwd %{package_name} >/dev/null || \ useradd -r -g %{package_name} -G apache \ -d %{_var}/lib/%{package_name} -s /bin/bash \ -c "NOCpulse user" %{package_name} Miroslav Suchy -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On 10/29/2009 12:25 PM, Miroslav Suchý wrote:
You have it too simple. Correct way to check account is getent (user can use ldap, NIS...). And it can happen that group exist, but username not, and vice versa. This is sniplet we use in Spacewalk project:
%define package_name nocpulse getent group %{package_name} >/dev/null || groupadd -r %{package_name} getent passwd %{package_name} >/dev/null || \ useradd -r -g %{package_name} -G apache \ -d %{_var}/lib/%{package_name} -s /bin/bash \ -c "NOCpulse user" %{package_name}
... or check http://en.opensuse.org/Packaging/Users_And_Groups which is moreorless the same, but more general. -- Best Regards / S pozdravom, Pavol RUSNAK SUSE LINUX, s.r.o openSUSE Boosters Team Lihovarska 1060/12 PGP 0xA6917144 19000 Praha 9, CR prusnak[at]suse.cz http://www.suse.cz -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
participants (4)
-
doiggl@velocitynet.com.au
-
Miroslav Suchý
-
Pavol Rusnak
-
Philipp Thomas