File: updatefat

package info (click to toggle)
r-base 4.5.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 112,924 kB
  • sloc: ansic: 291,338; fortran: 111,889; javascript: 14,798; yacc: 6,154; sh: 5,689; makefile: 5,239; tcl: 4,562; perl: 963; objc: 791; f90: 758; asm: 258; java: 31; sed: 1
file content (35 lines) | stat: -rwxr-xr-x 919 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh

# creates or updates a fat binary by replacing or adding a new architecture.
# the target file doesn't need to exist - it will be created if not
# already present

if [ -z "$1" -o -z "$2" ]; then
    echo ""
    echo " Usage: updatefat <target> <new-file>"
    echo ""
    echo "  Works even if <target> doesn't exist or is not fat."
    echo ""
    exit 1
fi

thisarch=`lipo -detailed_info "$2"|sed -n 's/.\{0,\}architecture:* \(.\{1,\}\)/\1/p'`
if [ -z "$thisarch" ]; then
    echo "Cannot find out architecture of $2" >&2
    exit 2
fi

#echo "architecture: $thisarch";
if [ -e "$1" ]; then \
    if lipo -detailed_info "$1"|grep "architecture:* $thisarch\$" > /dev/null; then
	if lipo -info "$1"|grep ^Non-fat > /dev/null; then
	    lipo -create "$2" -o "$1"
	else
	    lipo -replace "$thisarch" "$2" "$1" -o "$1"
	fi
    else
	lipo -create "$1" "$2" -o "$1"
    fi
else
    lipo -create "$2" -o "$1"
fi