LinuxQuestions.org
Review your favorite Linux distribution.
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 12-24-2009, 06:33 AM   #1
affinity
Member
 
Registered: Nov 2009
Distribution: Slackware64
Posts: 132

Rep: Reputation: 20
Script that changes the install location of SlackBuilds


I prefer installing third party software in the /usr/local directory so that I can keep it separate from the official install. This is purely personal preference, but I find it easier to backup just the /usr/local directory rather than the entire /usr directory. So I wrote a simple script that changes the install location of a SlackBuild to the /usr/local directory, I figured I'd share it in case anyone else was interested since I get a lot of information out of these forums.

Code:
#!/bin/sh
SOURCE=$(cat file.txt)
TARGET=$SOURCE.new
WORKDIR=/home/frank/Documents/SlackBuilds
CWD=$(pwd)

if [ $CWD != $WORKDIR ]; then
	cd $WORKDIR
fi

ls|grep SlackBuild > file.txt
sed -e 's:/usr:/usr/local:g' $SOURCE > $TARGET
mv $TARGET $SOURCE
exit
This will only work if there is only one SlackBuild in the directory since I have it automatically finding the name of the SlackBuild in the directory. If there is a better way of doing this by all means share, it doesn't look fancy but it gets the job done so I'm happy with it.
 
Old 12-24-2009, 11:04 AM   #2
TSquaredF
Member
 
Registered: Dec 2005
Location: "The South Coast of Texas"
Distribution: Slackware64-current
Posts: 490
Blog Entries: 1

Rep: Reputation: 55
Everyone programs differently. If I used a script, I would tend to use one like this
Code:
#!/bin/sh
SOURCE=$1.SlackBuild
TARGET=$SOURCE.new
WORKDIR=/home/bill/slackbuilds
if [ $CWD != $WORKDIR ]; then
	cd $WORKDIR
fi
sed -e 's:/usr:/usr/local:g' $SOURCE > $TARGET
mv $TARGET $SOURCE
exit
Then I could have a whole directory full of SlackBuilds & just feed the script the package name, as in
Code:
convert.sh numlockx
However, for something like this, I would just open it in an editor & use Search & Replace.
Regards,
Bill
 
1 members found this post helpful.
Old 12-24-2009, 11:23 AM   #3
affinity
Member
 
Registered: Nov 2009
Distribution: Slackware64
Posts: 132

Original Poster
Rep: Reputation: 20
Quote:
Then I could have a whole directory full of SlackBuilds & just feed the script the package name, as in
Code:
convert.sh numlockx
Bill
That's a very useful idea, thanks for the tip.
 
  


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
[SOLVED] ffmpeg install error from SlackBuilds eraosso Slackware 7 11-05-2009 07:23 PM
Build error when running the SlackBuilds.org script for LMMS Crushing Belial Slackware 1 08-05-2009 05:01 PM
Gnucash, can't install from the slackbuilds basheer Slackware 6 04-04-2009 10:03 PM
faac 1.26 fix when using slackbuilds build script Carpo Slackware 3 10-20-2007 03:09 AM
Use SlackBuilds.org or my own hosting to offer up SlackBuilds? hollywoodb Slackware 6 11-30-2006 08:56 PM


All times are GMT -5. The time now is 05:48 PM.

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