#! /bin/sh

for file in lib*.so.*; do
    if [ -f "$file" ]; then
        base_name1="${file%.*}"
        base_name2="${base_name1%.*}"

        if [ "$base_name1" != "$file" ]; then
            ln -sf "$file" "$base_name1"
            echo "$base_name1 -> $file"
        fi

        if [ "$base_name2" != "$base_name1" ]; then
            ln -sf "$file" "$base_name2"
            echo "$base_name2 -> $file"
        fi
    fi
done
