Ben Wagner | 63fd760 | 2017-10-09 15:45:33 -0400 | [diff] [blame] | 1 | # Copyright 2013 Google Inc. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
Mike Klein | 7e80c88 | 2015-02-03 10:43:28 -0500 | [diff] [blame] | 5 | # For each installed *-dev package DEV |
Ben Wagner | 22499b0 | 2017-11-09 16:47:13 -0500 | [diff] [blame] | 6 | for DEV in $(dpkg --list | grep '^ii [^ ]' | cut -d ' ' -f 3 | grep -P '\-dev($|\:amd64$)') |
Mike Klein | 7e80c88 | 2015-02-03 10:43:28 -0500 | [diff] [blame] | 7 | do |
| 8 | # For each multi-arch *.so SO installed by DEV |
| 9 | for DEV_64_SO in $(dpkg -L $DEV | grep '/lib/x86_64-linux-gnu/.*\.so$') |
| 10 | do |
| 11 | # Skip if DEV_64_SO is not a symlink |
| 12 | if ! test -L $DEV_64_SO |
| 13 | then |
| 14 | echo "$DEV installed $DEV_64_SO which is real." |
| 15 | continue |
| 16 | fi |
Ben Wagner | 63fd760 | 2017-10-09 15:45:33 -0400 | [diff] [blame] | 17 | |
Mike Klein | 7e80c88 | 2015-02-03 10:43:28 -0500 | [diff] [blame] | 18 | DEV_64_TARGET=$(readlink $DEV_64_SO) |
Ben Wagner | 63fd760 | 2017-10-09 15:45:33 -0400 | [diff] [blame] | 19 | DEV_64_TARGET_FULL=$(readlink -f $DEV_64_SO) |
| 20 | |
Mike Klein | 7e80c88 | 2015-02-03 10:43:28 -0500 | [diff] [blame] | 21 | DEV_32_SO=$(echo $DEV_64_SO | sed -e 's@/lib/x86_64-linux-gnu/@/lib/i386-linux-gnu/@') |
| 22 | DEV_32_TARGET=$(echo $DEV_64_TARGET | sed -e 's@/lib/x86_64-linux-gnu/@/lib/i386-linux-gnu/@') |
| 23 | DEV_32_TARGET_FULL=$(echo $DEV_64_TARGET_FULL | sed -e 's@/lib/x86_64-linux-gnu/@/lib/i386-linux-gnu/@') |
Ben Wagner | 63fd760 | 2017-10-09 15:45:33 -0400 | [diff] [blame] | 24 | |
Mike Klein | 7e80c88 | 2015-02-03 10:43:28 -0500 | [diff] [blame] | 25 | # Error if DEV_32_TARGET does not exist. |
| 26 | if ! test -e $DEV_32_TARGET_FULL |
| 27 | then |
| 28 | DEV_64_TARGET_PKG=$(dpkg -S $DEV_64_TARGET_FULL | cut -d ':' -f 1) |
| 29 | echo "Could not find $DEV_32_TARGET_FULL, probably provided by $DEV_64_TARGET_PKG:i386." |
| 30 | #echo " $DEV_64_SO -> $DEV_64_TARGET ($DEV_64_TARGET_FULL)" |
| 31 | #echo " $DEV_32_SO -> $DEV_32_TARGET ($DEV_32_TARGET_FULL)" |
| 32 | continue |
| 33 | fi |
Ben Wagner | 63fd760 | 2017-10-09 15:45:33 -0400 | [diff] [blame] | 34 | |
Mike Klein | 7e80c88 | 2015-02-03 10:43:28 -0500 | [diff] [blame] | 35 | # Create DEV_32_SO |
| 36 | sudo ln -s $DEV_32_TARGET $DEV_32_SO |
| 37 | done |
| 38 | done |