Tiny Core Linux

Tiny Core Extensions => TCE Tips & Tricks => Topic started by: Vaguiner on November 28, 2023, 04:12:02 PM

Title: dep generator
Post by: Vaguiner 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
Title: Re: dep generator
Post by: patrikg 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.
Title: Re: dep generator
Post by: Vaguiner 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.