LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-30-2011, 02:10 AM   #1
cigerma
LQ Newbie
 
Registered: Aug 2010
Posts: 2

Rep: Reputation: 0
About creating symlinks in .SlackBuild and doinst.sh


Hi guys,
I'm a Slack noob, but I really enjoy Slackware's simplicity and stability. I'm trying
to build a system based on Slackware these days, I'm now able to write .SlackBuild myself,
but I have some problems with creating symlinks in .SlackBuild and doinst.sh. Yesterday I
wrote a .SlackBuild, and then made the package, installed it in the chroot environment, but
it finally damaged my system. I wrote the following two lines in the doinst.sh file because I thought it would be called from the chroot environment, not from the host:
Code:
(rm -rf /bin)
(ln -sf /usr/bin /bin)
I know this is really stupid! And of course I know where I'm wrong, then I looked at some official SlackBuild scripts, and I found Pat sometimes made symlinks using "relative path" and using "obsolute path" in other times.
So my question is:
1. Never use "obsolute path" with the "rm" command in the build script, right?
2. Is it always safer to use "relative path" in the build script and the post-install doinst.sh script ?
3. What should I pay attention to when install a package using "--root /someplace" compared to just install it in the host?

P.S.: Sorry for my poor english, I wish you will understand what I'm saying.
 
Old 12-30-2011, 08:42 PM   #2
bobzilla
Member
 
Registered: Nov 2005
Location: Serbia
Distribution: Slackware
Posts: 175

Rep: Reputation: Disabled
Why would you want to remove /bin? Not wise thing to do. Your scripts shouldn't try to do tricks like that.

1. You can use absolute path, but you shouldn't (in most cases) have to remove anything. Not safe thing to do.
2. If you're operating on a chroot system, run the installpkg inside the chroot (you'll need shell and basic utilites and of course pkgtools inside your chroot). Or if you are using "installpkg --root" outside of chroot use the absolute path to the chroot location.
3. Not to do things as those? I personally wouldn't recommend putting something like that inside the SlackBuild/doinst.sh. But if you must, see #2.

Last edited by bobzilla; 12-30-2011 at 08:45 PM. Reason: a small typo
 
Old 12-30-2011, 08:48 PM   #3
bobzilla
Member
 
Registered: Nov 2005
Location: Serbia
Distribution: Slackware
Posts: 175

Rep: Reputation: Disabled
Btw, I haven't used relative path in my scripts. So, I can't answer that part of the question. Well, I didn't try to remove /bin either. Take a look at FHS for more info about /bin and what it serves for.
 
Old 12-30-2011, 09:13 PM   #4
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,211

Rep: Reputation: 292Reputation: 292Reputation: 292
I'm gussing what he really wanted to do was rm -r $PKG/bin and then symlink
 
Old 12-30-2011, 09:30 PM   #5
bobzilla
Member
 
Registered: Nov 2005
Location: Serbia
Distribution: Slackware
Posts: 175

Rep: Reputation: Disabled
You're most likely right. Haven't thought about that.
 
Old 12-30-2011, 11:13 PM   #6
cigerma
LQ Newbie
 
Registered: Aug 2010
Posts: 2

Original Poster
Rep: Reputation: 0
hi, look at this:
https://fedoraproject.org/wiki/Features/UsrMove
this is where my idea come from.
 
Old 12-31-2011, 05:37 AM   #7
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,211

Rep: Reputation: 292Reputation: 292Reputation: 292
If that does eventually happen in slackware, wait for it to happen before building packages based on it.
 
Old 12-31-2011, 06:31 AM   #8
bobzilla
Member
 
Registered: Nov 2005
Location: Serbia
Distribution: Slackware
Posts: 175

Rep: Reputation: Disabled
Maybe he's building a custom system based on Slack.

You're pretty much on your own with that. Try the relative paths if you want to reuse those packages again. Otherwise absolute path will work. Just be carefull what you do in you slackbuilds. As dive noted, always check if your SlackBuild is operating on $PKG/ not /. As doinst.sh is concerned, already answered that.
 
  


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
problem creating rkhunter 1.3.6 package using slackbuild jrecortel Slackware 2 05-26-2010 09:37 PM
help w/ creating a SlackBuild for icecat empcrono Slackware 7 10-29-2008 03:43 PM
Creating symlinks on a CIFS share? MasterC Linux - General 2 08-30-2007 04:34 PM
doinst.sh syntax (help please) Dark Carnival Slackware 3 01-25-2007 09:08 AM
Creating symlinks bripage Linux - General 2 07-23-2002 07:33 PM


All times are GMT -5. The time now is 03:19 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