zapret/install_bin.sh

37 lines
788 B
Bash
Raw Normal View History

2019-05-02 09:48:37 +03:00
#!/bin/sh
SCRIPT=$(readlink -f $0)
EXEDIR=$(dirname $SCRIPT)
2019-05-02 10:22:47 +03:00
BINS=binaries
BINDIR=$EXEDIR/$BINS
2019-05-02 09:48:37 +03:00
check_dir()
{
2019-05-02 10:22:47 +03:00
echo 0.0.0.0 | "$BINDIR/$1/ip2net" 1>/dev/null 2>/dev/null
2019-05-02 09:48:37 +03:00
}
2019-05-02 10:22:47 +03:00
# link or copy executables. uncomment either ln or cp, comment other
2019-05-02 09:48:37 +03:00
ccp()
{
2019-05-02 10:22:47 +03:00
local F=$(basename $1)
2019-05-02 10:39:28 +03:00
[ -f "$EXEDIR/$2/$F" ] && rm -f "$EXEDIR/$2/$F"
2019-05-02 10:30:18 +03:00
ln -fs "../$BINS/$1" "$EXEDIR/$2" && echo linking : "../$BINS/$1" =\> "$EXEDIR/$2"
2019-05-02 10:22:47 +03:00
#cp -f "$BINDIR/$1" "$EXEDIR/$2" && echo copying : "$BINDIR/$1" =\> "$EXEDIR/$2"
2019-05-02 09:48:37 +03:00
}
2019-05-02 11:20:13 +03:00
for arch in aarch64 armhf mips64r2-msb mips32r1-lsb mips32r1-msb x86_64 x86
2019-05-02 09:48:37 +03:00
do
if check_dir $arch; then
echo $arch is OK
2019-05-02 10:22:47 +03:00
echo installing binaries ...
ccp $arch/ip2net ip2net
ccp $arch/mdig mdig
ccp $arch/nfqws nfq
ccp $arch/tpws tpws
2019-05-02 09:48:37 +03:00
break
else
echo $arch is NOT OK
fi
done