WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [SOLVED] query a tce.installed script libgs versus ghostscript tce.installed  (Read 3945 times)

aus9

  • Guest
I am just curious so low priority and anyone can answer as I am just testing my thoughts on this install script

libgs
Quote
#!/bin/sh

if [ ! -f /usr/local/bin/gs ]; then
  ln -s gsc /usr/local/bin/gs
fi
[ -f /usr/local/lib/libgs.so.8 ] || ln -s /usr/local/lib/libgs.so.9 /usr/local/lib/libgs.so.8

I suspect
The first bit says if no file for gs then sym link gsc (without a pathway) to the missing file.
Why no full pathway is a question?

The second bit says for an old shared object found, sym link to the new updated file

Feel free to correct my understandings pls.

Why am I asking when I am not the maintainer etc.
--wellllll I am thinking of maintaining, but have yet to seek permisson
and have a script a built but I just want to see if there is a smarter way to my understanding
Obviously if I don't understand the script, people will have a lack of confidence in my tczs
hmmm ok they already have such .....I don't mind being the village idiot, it takes the pressure off

thanks for reading

trivia......maybe this was written when it was not so easy for people to update, so I can remove the second bit right?

b) now we have ghostscript tce.installed
Quote
#!/bin/sh

if [ -f /usr/local/bin/gsc ]; then
  rm /usr/local/bin/gs
  ln -s /tmp/tcloop/ghostscript/usr/local/bin/gs /usr/local/bin
fi

I am lost, what happens when someone installs both?
« Last Edit: February 21, 2013, 10:36:03 PM by aus9 »

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11628
Re: query a tce.installed script libgs versus ghostscript tce.installed
« Reply #1 on: February 21, 2013, 11:38:43 AM »
Hi aus9
Quote
Why no full pathway is a question?
The ln command is going to /usr/local/bin/ and from there creating a link from gs to gsc.
Quote
The second bit says for an old shared object found, sym link to the new updated file
I think the second bit says if /usr/local/lib/libgs.so.8 does not exist, create a link called /usr/local/lib/libgs.so.8 which
points to /usr/local/lib/libgs.so.9. I suspect that should be left in because some app hardcoded /usr/local/lib/libgs.so.8
as a requirement.

aus9

  • Guest
Re: query a tce.installed script libgs versus ghostscript tce.installed
« Reply #2 on: February 21, 2013, 06:53:34 PM »
Rich

thanks for helping but still confused, let stay with linking I have only known about
ln -s realfile newfile
 
so I just did a quick test, trying to reverse the order as per script
Code: [Select]
sudo ln -s gsc /bin/cat
ln: failed to create symbolic link `/bin/cat': File exists

Do you see why I am confused? while my old way is fine
Code: [Select]
sudo ln -s /bin/cat /bin/gsc
tc@box:~$ ls /bin/gsc
/bin/gsc

If I do this
Code: [Select]
sudo ln -s /bin/cat gsc
tc@box:~$ ls ~/gsc
/home/tc/gsc

and that appears to be of the type "create a link to TARGET in the current directory"

thanks for reading

Offline althalus

  • Sr. Member
  • ****
  • Posts: 351
Re: query a tce.installed script libgs versus ghostscript tce.installed
« Reply #3 on: February 21, 2013, 07:03:53 PM »
I am lost, what happens when someone installs both?
Assuming my brain hasn't fallen asleep on me, libgs only sets up /usr/local/bin/gs if it doesn't exist, whilst ghostscript will forcibly replace an existing /usr/local/bin/gs with it's version. So in theory, if a user installs both, ghostscript's version will always take priority over libgs's version.


thanks for helping but still confused, let stay with linking I have only known about
ln -s realfile newfile
Correct. So after libgs's script runs, you should be able to do this:
Code: [Select]
$ ls -l /usr/local/bin/gs
lrwxrwxrwx 1 root root 6 Feb 22 11:00 /usr/local/bin/gs -> gsc
Which would point to the gsc relative to gs's path, or /usr/local/bin/gsc

If your link target is a directory, then the link is created inside that directory with the same name as the target, which is how ghostscript's tce.installed script works.

aus9

  • Guest
Re: query a tce.installed script libgs versus ghostscript tce.installed
« Reply #4 on: February 21, 2013, 10:35:41 PM »
althalus as Rich may have wrote
Quote
The ln command is going to /usr/local/bin/ and from there creating a link from gs to gsc

we can agree its the reverse ,,,,,from realfile=gsc to gs
and that makes sense as libgs does not have a realfile = gs

Quote
libgs only sets up /usr/local/bin/gs if it doesn't exist, whilst ghostscript will forcibly replace an existing /usr/local/bin/gs with it's version

Great! That helps my understanding of those scripts. One of the reason I was posting is because I did not understand that point.

The other issue I am taking up with my fav maintainer so solved for now.
I think I prefer full pathways as I understand them better but I do know how to use inside folders

eg cd /usr/local/bin && ln -s realfile newfile

thanks heaps guys.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11628
Hi aus9
Personally I always use:
Code: [Select]
ln -s path/to/file path/to/link

Offline althalus

  • Sr. Member
  • ****
  • Posts: 351
Re: query a tce.installed script libgs versus ghostscript tce.installed
« Reply #6 on: February 21, 2013, 11:03:32 PM »
althalus as Rich may have wrote
Quote
The ln command is going to /usr/local/bin/ and from there creating a link from gs to gsc
I think Rich and I are saying the same thing, with different words. I understand a link from gs to gsc to mean:
gc -> gsc

Which is what you'd see if you ran ls -l gc

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Hi aus9
Personally I always use:
Code: [Select]
ln -s path/to/file path/to/link
Perhaps you meant
Code: [Select]
ln -s /path/to/file /path/to/linkinstead?
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11628
Hi althalus
That is correct. If you read my explanation carefully, it states it creates the link (gs) in the directory path preceding
it, then points it to the file (gsc) in the same directory because the file (gsc) does not have a path preceding it.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11628
Hi tinypoodle
Quote
Perhaps you meant
Quote
Code: [Select]
ln -s /path/to/file /path/to/link
instead?
If I want an absolute path, then yes. But I can use a relative path downward from where I am, or even:
Code: [Select]
ln -s ../a/b/file ../../../d/e/f/linkI left out the leading / because the path can be whatever suits your needs, though maybe I should have explained
that when I wrote it to begin with.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Code: [Select]
tc@box:~$ mkdir test7 && touch test7/bar
tc@box:~$ ln -s test7/bar test7/foo
tc@box:~$ file test7/*
test7/bar: empty
test7/foo: broken symbolic link to `test7/bar'
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11628
Hi tinypoodle
You are right, it's not quite that straight forward. The path to file appears to be influenced by the path to link.
To make that work you would have to do:
Code: [Select]
tc@box:~/msrbcusips/bonddurations$ mkdir x
tc@box:~/msrbcusips/bonddurations$ touch x/y
tc@box:~/msrbcusips/bonddurations$ ln -s ../x/y x/z
tc@box:~/msrbcusips/bonddurations$ ls -l x
total 0
-rw-r--r-- 1 tc staff 0 Feb 21 23:41 y
lrwxrwxrwx 1 tc staff 6 Feb 21 23:41 z -> ../x/y
In which case you might as well do:
Code: [Select]
tc@box:~/msrbcusips/bonddurations$ mkdir x
tc@box:~/msrbcusips/bonddurations$ touch x/y
tc@box:~/msrbcusips/bonddurations$ ln -s y x/z
tc@box:~/msrbcusips/bonddurations$ ls -l x
total 0
-rw-r--r-- 1 tc staff 0 Feb 21 23:47 y
lrwxrwxrwx 1 tc staff 1 Feb 21 23:47 z -> y