LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 06-16-2008, 03:55 PM   #1
C-Sniper
Member
 
Registered: Dec 2006
Distribution: Slackware
Posts: 507

Rep: Reputation: 33
Generic Slackbuild script


hi all,
i have been working on a generic slakcbuild script recently and was wondering about a piece of code i am not sure is working correctly.
Code:
grep DESTDIR Makefile*
if [ $? = /dev/null ]; then
	make prefix=$PKG/usr install || exit 1
else
	make install DESTDIR=$PKG || exit 1
fi
would this work for determining if the makefile has a DESTDIR variable?

also, is there any way i can have it look at both "makefile" and "Makefile" in case one is lower case and another is upper? (two different programs but i have already seen it between "configure" and "Configure")

Thanks!
 
Old 06-16-2008, 04:16 PM   #2
rg3
Member
 
Registered: Jul 2007
Distribution: Slackware Linux
Posts: 509

Rep: Reputation: Disabled
I'd use the following code:

Code:
if grep -q DESTDIR [Mm]akefile; then
	make install DESTDIR=$PKG || exit 1
else
	make prefix=$PKG/usr install || exit 1
fi
 
Old 06-16-2008, 04:26 PM   #3
mRgOBLIN
Slackware Contributor
 
Registered: Jun 2002
Location: New Zealand
Distribution: Slackware
Posts: 999

Rep: Reputation: 227Reputation: 227Reputation: 227
You can put the upper and lower case characters in [] and the shell will take care of it.
You can even use ranges like [a-z] (any lowercase letter)

Use something like this.

Code:
fgrep DESTDIR [mM]akefile*
if [ $? -eq 0 ]; then
     foo
else
     blah
fi
Ahh quick on the trigger rg3

Last edited by mRgOBLIN; 06-16-2008 at 04:28 PM.
 
Old 06-16-2008, 04:51 PM   #4
GazL
Senior Member
 
Registered: May 2008
Posts: 3,392

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
Bah!... don't any of you guys try and catch errors?

Code:
grep -q 'DESTDIR' [Mm]akefile ; rc_grep=$?
case $rc_grep in
(0)    echo "Found DESTDIR"
       # do DESTDIR stuff
       ;;
(1)    echo "No DESTDIR"
       # do other stuff
       ;;
(2)    echo "No makefile!.. STOPPED!" 1>&2
       exit 1
esac
 
Old 06-16-2008, 05:05 PM   #5
C-Sniper
Member
 
Registered: Dec 2006
Distribution: Slackware
Posts: 507

Original Poster
Rep: Reputation: 33
Thanks for the help!
 
  


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
Swiftfox slackbuild script shadowsnipes Slackware 23 10-24-2008 10:52 PM
a generic SlackBuild shilo Slackware 46 06-19-2008 11:45 PM
write a SlackBuild script for qc-usb-messenger-1.8 tramni1980 Slackware 2 06-05-2008 11:30 AM
SlackBuild.org nvidia kernel build script bug Woodsman Slackware 3 04-06-2008 07:48 PM
Trouble with my first SlackBuild script Yalla-One Slackware 6 06-10-2006 02:03 PM


All times are GMT -5. The time now is 07:03 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration