2017-07-29 17:09:10 -04:00
|
|
|
#!/data/data/com.termux/files/usr/bin/bash
|
2018-09-21 00:15:29 -04:00
|
|
|
set -ex
|
2018-09-21 00:00:57 -04:00
|
|
|
apt update
|
2018-09-21 00:04:13 -04:00
|
|
|
apt -y install make clang openssl-dev perl tsu wget git python python-dev gnupg dirmngr curl autoconf automake sed gettext gzip pkg-config libcrypt-dev
|
2017-07-29 16:44:05 -04:00
|
|
|
|
|
|
|
pip install virtualenv
|
|
|
|
virtualenv --python=python3 borg-env
|
|
|
|
source borg-env/bin/activate
|
|
|
|
|
2018-07-05 14:45:50 -04:00
|
|
|
test -d borg || git clone https://github.com/borgbackup/borg.git
|
2017-07-29 16:44:05 -04:00
|
|
|
cd borg
|
2018-07-05 14:45:50 -04:00
|
|
|
git checkout 1.1.6
|
2017-07-29 16:44:05 -04:00
|
|
|
|
2018-07-05 14:45:50 -04:00
|
|
|
pip install Cython
|
2017-07-29 16:44:05 -04:00
|
|
|
pip install -r requirements.d/development.txt
|
|
|
|
|
2017-11-25 18:01:17 -05:00
|
|
|
#find if sync_file_range is available
|
|
|
|
s=`bash ../sync_file_range_test/test.sh`
|
|
|
|
if [ "$s" = "1" ];
|
|
|
|
then
|
|
|
|
echo "patching borg to not use sync_file_range...."
|
|
|
|
git apply ../borg_sync_file_range.patch
|
|
|
|
else
|
|
|
|
echo "no need to patch borg"
|
|
|
|
fi
|
|
|
|
|
2017-07-29 16:44:05 -04:00
|
|
|
#download and build lz4
|
|
|
|
wget https://github.com/lz4/lz4/archive/v1.7.5.tar.gz -O lz4.tar.gz
|
|
|
|
tar -xf lz4.tar.gz
|
|
|
|
cd lz4-1.7.5
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
#download and build libattr
|
|
|
|
wget https://download.savannah.gnu.org/releases/attr/attr-2.4.47.src.tar.gz
|
|
|
|
wget https://download.savannah.gnu.org/releases/attr/attr-2.4.47.src.tar.gz.sig
|
|
|
|
gpg2 attr-2.4.47.src.tar.gz.sig
|
|
|
|
tar -xf attr-2.4.47.src.tar.gz
|
|
|
|
cd attr-2.4.47
|
2018-09-21 00:15:29 -04:00
|
|
|
|
2017-07-29 16:44:05 -04:00
|
|
|
#fixing paths to sh
|
|
|
|
sed -i "s/\/bin\/sh/\/data\/data\/com.termux\/files\/usr\/bin\/sh/" configure
|
2017-07-29 17:31:22 -04:00
|
|
|
sed -i "s/\/bin\/sh/\/data\/data\/com.termux\/files\/usr\/bin\/sh/" install-sh
|
2017-07-29 16:44:05 -04:00
|
|
|
sed -i "s/\/bin\/sh/\/data\/data\/com.termux\/files\/usr\/bin\/sh/" include/install-sh
|
2018-09-21 00:15:29 -04:00
|
|
|
|
2017-07-29 16:44:05 -04:00
|
|
|
#fix for non-existent /tmp directory in set_cc_for_build of config.guess for 32-bit arm
|
|
|
|
sed -i "s/TMPDIR=\/tmp/TMPDIR=tmp/g" config.guess
|
|
|
|
mkdir tmp
|
|
|
|
|
2017-09-17 00:35:19 -04:00
|
|
|
./configure CC=clang --prefix=/data/data/com.termux/files/usr/
|
2017-07-29 16:44:05 -04:00
|
|
|
|
|
|
|
#fix for ./include/attr/xattr.h:37:58: error: expected function body after function declarator
|
|
|
|
# const void *__value, size_t __size, int __flags) __THROW;
|
2017-07-29 17:31:22 -04:00
|
|
|
sed -i "s/__THROW//g" include/xattr.h
|
2017-07-29 16:44:05 -04:00
|
|
|
make
|
|
|
|
make install install-lib install-dev
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
#download and build libacl
|
|
|
|
wget https://download.savannah.gnu.org/releases/acl/acl-2.2.52.src.tar.gz
|
|
|
|
wget https://download.savannah.gnu.org/releases/acl/acl-2.2.52.src.tar.gz.sig
|
|
|
|
gpg2 --recv-key 0542DF34
|
|
|
|
tar -xf acl-2.2.52.src.tar.gz
|
|
|
|
cd acl-2.2.52
|
|
|
|
#fixing paths to sh
|
|
|
|
sed -i "s/\/bin\/sh/\/data\/data\/com.termux\/files\/usr\/bin\/sh/" configure
|
2017-07-29 17:31:22 -04:00
|
|
|
sed -i "s/\/bin\/sh/\/data\/data\/com.termux\/files\/usr\/bin\/sh/" install-sh
|
2017-07-29 16:44:05 -04:00
|
|
|
sed -i "s/\/bin\/sh/\/data\/data\/com.termux\/files\/usr\/bin\/sh/" include/install-sh
|
|
|
|
|
|
|
|
#fix for non-existent /tmp directory in set_cc_for_build of config.guess for 32-bit arm
|
|
|
|
sed -i "s/TMPDIR=\/tmp/TMPDIR=tmp/g" config.guess
|
|
|
|
mkdir tmp
|
|
|
|
|
2017-09-17 00:35:19 -04:00
|
|
|
./configure --prefix=/data/data/com.termux/files/usr/ CC=clang
|
2017-07-29 16:44:05 -04:00
|
|
|
make
|
|
|
|
make install install-lib install-dev
|
|
|
|
cd ..
|
|
|
|
|
2017-11-25 14:29:18 -05:00
|
|
|
#patching paths
|
|
|
|
export BORG_OPENSSL_PREFIX="/data/data/com.termux/files/usr/"
|
|
|
|
export BORG_LZ4_PREFIX="/data/data/com.termux/files/usr/"
|
2017-07-29 16:44:05 -04:00
|
|
|
|
|
|
|
pip install -e .
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
#need wrapper for ssh, because /system/lib64/ needs to be in LD_LIBRARY_PATH
|
|
|
|
#otherwise: Remote: CANNOT LINK EXECUTABLE "ssh": library "libandroid-support.so" not found
|
|
|
|
export BORG_RSH=borg_ssh_wrapper
|
|
|
|
cp borg_ssh_wrapper /data/data/com.termux/files/usr/bin/borg_ssh_wrapper
|
|
|
|
chmod +x /data/data/com.termux/files/usr/bin/borg_ssh_wrapper
|
2017-07-29 17:14:21 -04:00
|
|
|
|
|
|
|
#test by creating a backup of the borg directory
|
2017-11-25 14:37:51 -05:00
|
|
|
borg init -e none borg_test
|
2017-07-29 17:39:34 -04:00
|
|
|
borg create borg_test::1 borg
|
2017-07-29 17:14:21 -04:00
|
|
|
borg list borg_test
|
|
|
|
borg info borg_test::1
|
|
|
|
borg list borg_test::1
|