ldd considered harmful

master
Ismael Barros 2013-04-02 09:48:20 +02:00
parent 66b1013d41
commit 830f593bb2
3 changed files with 16 additions and 11 deletions

View File

@ -3,7 +3,7 @@
EXCEPTIONS=libGL.so.1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:usr/lib/
function findFiles() {
findFiles() {
find -iname *.so
find -iname *.so.*
@ -15,9 +15,10 @@ function findFiles() {
done
}
function extractDependencies() {
ldd $@ | grep "not found" | sort | uniq >&2
ldd "$@" 2>/dev/null | grep -v "not a dynamic executable" | grep -v "^\." | grep -v "$PWD" | cut -d" " -f3 | grep "^/" | sort | uniq
extractDependencies() {
objdump -p "$@" 2>/dev/null | egrep NEEDED | awk '{ print $2 }' | grep -v "$PWD" | egrep "^/" | sort | uniq
#ldd $@ | grep "not found" | sort | uniq >&2
#ldd "$@" 2>/dev/null | grep -v "not a dynamic executable" | grep -v "^\." | grep -v "$PWD" | cut -d" " -f3 | grep "^/" | sort | uniq
}
mkdir -p usr/lib

View File

@ -12,7 +12,7 @@ OIFS=$IFS
NIFS=$'\n'
export _POSIX2_VERSION=199209 # Needed to unpack old loki packages
function extract_property() {
extract_property() {
local property="$1"
local file="$2"
grep "$property:" "$file" | cut -d: -f2 | trimp

16
util.sh
View File

@ -1,18 +1,18 @@
#!/bin/sh
function die() { echo $@; exit 1; }
function trimp() { sed -e 's/^[ \t]*//g' -e 's/[ \t]*$//g'; }
function trim() { echo $@ | trimp; }
die() { echo $@; exit 1; }
trimp() { sed -e 's/^[ \t]*//g' -e 's/[ \t]*$//g'; }
trim() { echo $@ | trimp; }
desktopFile_getParameter() { file=$1; parameter=$2; grep "${parameter}=" "$file" | cut -d= -f2- | trimp; }
desktopFile_setParameter() { file=$1; parameter=$2; value=$3; sed -i -e "s|${parameter}=.*|${parameter}=$value|" "$file"; }
function xml_extract_node() {
xml_extract_node() {
local node="$1"
local file="$2"
grep -Pzo "(?s)<$node.*?>.*?</$node>" "$file"
}
function xml_extract_property() {
xml_extract_property() {
local property="$1"
local line="$2"
echo "$line" | egrep -o "$property=\"[^\"]*\"" | cut -d\" -f2
@ -23,11 +23,15 @@ set_resolution() { xrandr -s $1; }
run_oss() { if [ $(which padspp 2>/dev/null) ]; then padsp $@; else $@; fi; }
run_shell() { if [[ $(tty) = "not a tty" ]]; then xterm -e "$@"; else $@; fi; }
run_keepResolution()
setup_keepResolution()
{
resolution=$(get_resolution)
restore_resolution() { set_resolution "$resolution"; }
trap restore_resolution EXIT
}
run_keepResolution()
{
setup_keepResolution
$@