Mike Klein | 7e80c88 | 2015-02-03 10:43:28 -0500 | [diff] [blame] | 1 | # For each installed *-dev package DEV |
| 2 | for DEV in $(dpkg --list | grep '^ii [^ ]' | cut -d ' ' -f 3 | grep '\-dev$') |
| 3 | do |
| 4 | # For each multi-arch *.so SO installed by DEV |
| 5 | for DEV_64_SO in $(dpkg -L $DEV | grep '/lib/x86_64-linux-gnu/.*\.so$') |
| 6 | do |
| 7 | # Skip if DEV_64_SO is not a symlink |
| 8 | if ! test -L $DEV_64_SO |
| 9 | then |
| 10 | echo "$DEV installed $DEV_64_SO which is real." |
| 11 | continue |
| 12 | fi |
| 13 | |
| 14 | DEV_64_TARGET=$(readlink $DEV_64_SO) |
| 15 | DEV_64_TARGET_FULL=$(readlink -f $DEV_64_SO) |
| 16 | |
| 17 | DEV_32_SO=$(echo $DEV_64_SO | sed -e 's@/lib/x86_64-linux-gnu/@/lib/i386-linux-gnu/@') |
| 18 | DEV_32_TARGET=$(echo $DEV_64_TARGET | sed -e 's@/lib/x86_64-linux-gnu/@/lib/i386-linux-gnu/@') |
| 19 | DEV_32_TARGET_FULL=$(echo $DEV_64_TARGET_FULL | sed -e 's@/lib/x86_64-linux-gnu/@/lib/i386-linux-gnu/@') |
| 20 | |
| 21 | # Error if DEV_32_TARGET does not exist. |
| 22 | if ! test -e $DEV_32_TARGET_FULL |
| 23 | then |
| 24 | DEV_64_TARGET_PKG=$(dpkg -S $DEV_64_TARGET_FULL | cut -d ':' -f 1) |
| 25 | echo "Could not find $DEV_32_TARGET_FULL, probably provided by $DEV_64_TARGET_PKG:i386." |
| 26 | #echo " $DEV_64_SO -> $DEV_64_TARGET ($DEV_64_TARGET_FULL)" |
| 27 | #echo " $DEV_32_SO -> $DEV_32_TARGET ($DEV_32_TARGET_FULL)" |
| 28 | continue |
| 29 | fi |
| 30 | |
| 31 | # Create DEV_32_SO |
| 32 | sudo ln -s $DEV_32_TARGET $DEV_32_SO |
| 33 | done |
| 34 | done |