Extracts application from alternate OS. No doubt useful for other apps too....
Feel free to share other similar uses on alternate OS / binaries.
( Tip: Kali has alot of useful arm7 stuff! )
Well.... scooped this one out for test purposes..... I think something similar would work for arm7hf.
As always, rough proof of concept...... as always mind any regulations in your region and I see this as a debugging tool rather than something to be run full time.....
#!/bin/bash
# extracts ntop binary and libs from alpine3.6-64 from WITHIN chroot!
# tested on .... master ...
# note you can use luci-app-lxc to create an alpine-3.6 in /srv/lxc/
# then
# > cp thiscript.sh /srv/lxc/NAME/rootfs
# > chroot /srv/lxc/NAME/rootfs
# > apk update; apk add ntop; apk add bash
# > thisscript.sh
CHAPP="/ntop"
mkdir -p $CHAPP
copy_libs() {
for i in $(ldd $*|grep -v dynamic|cut -d " " -f 3|sed 's/://'|sort|uniq)
do cp --parents $i $CHAPP && echo $i; done
}
copy_libs /usr/bin/ntop
cp -r --parents /usr/lib/ntop $CHAPP;
cp -r --parents /usr/share/ntop $CHAPP;
cp -r --parents /var/lib/ntop $CHAPP;
cp --parents /usr/bin/ntop $CHAPP;
echo "ntop has been extracted to $CHAPP"
echo "exit chroot and mv $CHAPP to / or your preferred location"
/bin/startntop.sh
#!/bin/sh
#################### SAMPLE START SCRIPT
APPDIR="/ntop"
export LD_LIBRARY_PATH=/usr/lib:/lib:$APPDIR/lib:$APPDIR/usr/lib:$APPDIR/usr/lib/ntop
mkdir -p /usr/share/ntop
ln -s $APPDIR/usr/share/ntop/html/ /usr/share/ntop/html
$APPDIR/usr/bin/ntop --set-admin-password=password
$APPDIR/usr/bin/ntop -P $APPDIR/usr/lib/ntop