File: change-abi.sh

package info (click to toggle)
patchelf 0.18.0-1.4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,464 kB
  • sloc: cpp: 5,481; sh: 940; makefile: 194; ansic: 44; asm: 20
file content (29 lines) | stat: -rwxr-xr-x 829 bytes parent folder | download
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
#! /bin/sh -e

SCRATCH=scratch/$(basename "$0" .sh)

rm -rf "${SCRATCH}"
mkdir -p "${SCRATCH}"

cp simple-pie "${SCRATCH}/simple-pie"

# Save the old OS ABI
OLDABI=$(../src/patchelf --print-os-abi "${SCRATCH}/simple-pie")
# Ensure it's not empty
test -n "$OLDABI"

# Change OS ABI and verify it has been changed
for ABI in "System V" "HP-UX" "NetBSD" "Linux" "GNU Hurd" "Solaris" "AIX" "IRIX" "FreeBSD" "Tru64" "OpenBSD" "OpenVMS"; do
  echo "Set OS ABI to '$ABI'..."
  ../src/patchelf --set-os-abi "$ABI" "${SCRATCH}/simple-pie"

  echo "Check is OS ABI is '$ABI'..."
  NEWABI=$(../src/patchelf --print-os-abi "${SCRATCH}/simple-pie")
  test "$NEWABI" = "$ABI"
done

# Reset OS ABI to the saved one
../src/patchelf --set-os-abi "$OLDABI" "${SCRATCH}/simple-pie"

# Verify we still can run the executable
"${SCRATCH}/simple-pie"