Skip to content

Instantly share code, notes, and snippets.

@dillera
Last active July 8, 2020 21:09
Show Gist options
  • Save dillera/c5b7ab0138a22dd821023bdc069d9135 to your computer and use it in GitHub Desktop.
Save dillera/c5b7ab0138a22dd821023bdc069d9135 to your computer and use it in GitHub Desktop.
Python script to fix IRIX idm files with symbolic links in them
@dillera
Copy link
Author

dillera commented Jun 30, 2020

before:

l 0755 root sys usr/sgug/lib32/libbz2.so.1 lib32/libbz2.so.1 rse.sw.base
l 0755 root sys usr/sgug/lib32/libbz2.so.1.0 lib32/libbz2.so.1.0 rse.sw.base

after script

l 0755 root sys usr/sgug/lib32/libbz2.so.1 lib32/libbz2.so.1.0.8 rse.sw.base
l 0755 root sys usr/sgug/lib32/libbz2.so.1.0 lib32/libbz2.so.1.0.8 rse.sw.base

@dillera
Copy link
Author

dillera commented Jun 30, 2020

the trick is getting the real actual proper target of the symlink. since Software Packager had no idea, you need to run that find command with some awk to get just the path of the symlink and the real filename of the target.

Since the IDM file has as it's STREE the same thing as the full path of the symlink you found on the filesystem, you can use that as the key to the dict you created and the value is the real file. Then write out the line but put in the real target as the DTREE and you have it fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment