LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-01-2008, 03:07 PM   #1
pvpnguyen
Member
 
Registered: Mar 2006
Posts: 38

Rep: Reputation: 15
rpmbuild


Hello Masters, I am trying to build and rpm package which will display a message like "You have to be root in order to install this package..." if the user is not root. Is there a way to check for user privilege in the rpm spec file? You help is greatly appriciated. Thanks.
 
Old 02-01-2008, 05:01 PM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
I don't think there is. One can only install rpm as root since update of rpm database will be done during the install.

Brian
 
Old 02-01-2008, 07:25 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Like Brian1 said it won't pratical since you can only install packages as root account user, but that doesn't mean there is no way to accomplish this, just use a pre-install section in your .spec file:
Code:
%pre
set -e; [ `id -g` -ne 0 ] && { echo 'be root or be gone'; exit 1; }
 
Old 02-04-2008, 08:51 AM   #4
pvpnguyen
Member
 
Registered: Mar 2006
Posts: 38

Original Poster
Rep: Reputation: 15
Thank you very much, I will try that in the %pre section of the spec file.
 
Old 02-08-2008, 10:25 AM   #5
pvpnguyen
Member
 
Registered: Mar 2006
Posts: 38

Original Poster
Rep: Reputation: 15
Hello UnSpawn,

Somehow the rpm checks for /var/lib/rpm/__db.000 lock first before the %pre section. What I get if I install the rpm as no-root is: error: can't create trasnsaction lock on /var/lib/rpm/__db.000. For new users, they don't know what the problem is. That's why I need to display that message out the the user. Is there anyother way? Thanks so much
 
Old 02-08-2008, 10:17 PM   #6
cetialphav
Member
 
Registered: Sep 2003
Location: Raleigh, NC, USA
Distribution: Fedora
Posts: 88

Rep: Reputation: 16
One option would be to create a shell script to your users instead of a raw rpm. The shell script could extract the rpm from the script itself and then run whatever commands you want. There are plenty of linux installers that do something like this. Take a look at http://megastep.org/makeself/. That may work for you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to rpmbuild laleh Linux - Software 1 09-20-2006 02:09 AM
what should do after rpmbuild? joirnange Linux - Newbie 3 01-15-2005 05:23 AM
rpmbuild ?? mickeyboa Fedora 1 07-25-2004 10:09 PM
rpmbuild linuxdev Linux - Newbie 1 02-18-2004 03:13 PM
rpmbuild linuxdev Linux - Newbie 0 02-11-2004 02:22 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration