commit 538eaf5973fe2d9cf2e9571c3f29d2ece544e7c6 Author: danielkot Date: Fri Sep 16 17:13:07 2022 +0200 Init repo diff --git a/copy_elf_deps.sh b/copy_elf_deps.sh new file mode 100644 index 0000000..e5cbcff --- /dev/null +++ b/copy_elf_deps.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# Simple 'n Stupid ELF dynamic file copier for Android. +# By *DANiO* (C) 2022 y. + +# Functions +copy_deps() +{ + [ ! -e ${1} -o -e ${2}/${1} ]&&return 1 + cp -fv ${1} ${2}||return 1 + for i in `readelf -d ${1} |grep NEEDED|awk '{print $5}'|tr -d "[]"`;do + copy_deps ${i} ${2} + done + [ -n ${1} ]&©_deps ${@} +} +help() +{ +cat < -o|--output -- to properly run this script +eot +} + +# If no arguments bail-out. +[ ${#} -lt 1 ]&&help&&exit 0 + +# Parameters parser. +for i in ${@}; do + case ${i} in + -h|--help)help;exit 0;; + -i|--input)in=${2};shift 2;; + -o|--output)out=${2};shift 2;; + *)help&&exit 0;; + esac +done + +# Create dir for final binaries. +mkdir -pv ${out} + +# Run main function. +copy_deps ${in} ${out}||exit 1 +exit 0