WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: dep generator  (Read 1740 times)

Offline CardealRusso

  • Full Member
  • ***
  • Posts: 178
dep generator
« on: November 28, 2023, 04:12:02 PM »
Hopefully this will make less typos than manual edits and save some time.

Code: [Select]
optionalDir="/etc/sysconfig/tcedir/optional"
result=$(find . -exec ldd {} \; 2>/dev/null | awk '/\/usr\/local\/lib/ {print $3}' | xargs ls -lah | awk '{print $11}' | awk -F'/' '{print $4 ".tcz"}' | sort | uniq)

while [ "$result" != "$resultCopy" ]; do
    resultCopy=$result
    for item in $result; do
        list_file="${optionalDir}/${item}.dep"
        if [ -e "$list_file" ]; then
            while read -r line; do
                if [ -n "$line" ]; then
                    result=$(echo "$result" | tr ' ' '\n' | grep -v "$line")
                fi
            done < "$list_file"
        fi
    done
done

echo $result | tr ' ' '\n'

It is expected to run this script in the directory containing binaries that already have all dependencies loaded.

It also won't work with copy2fs extensions.

Edit: "-type f" removed from second line
« Last Edit: December 01, 2023, 04:32:01 AM by Juanito »

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 712
Re: dep generator
« Reply #1 on: November 29, 2023, 12:19:11 AM »
Maybe one could include this into the submit check script.
I like the result one liner. :), the power of unix with piping.

Offline CardealRusso

  • Full Member
  • ***
  • Posts: 178
Re: dep generator
« Reply #2 on: November 29, 2023, 05:49:31 AM »
Maybe one could include this into the submit check script.
Unfortunately this still requires manual editing. And -dev files don't work. It's a "little help" than doing all the dirty work.

Also, there are dependencies can't be detected on this way, like icon themes, etc. So for sure it is very useful, but can't be used exclusively but a good tool to detect missing libs.