jitty-scripts/trimrepo.sh

47 lines
998 B
Bash
Raw Permalink Normal View History

#!/bin/bash
chk_deps()
{
if [ ! -f /usr/bin/tux ] || [ ! -f /usr/bin/sudo ];then
echo "Please install: tuxc & sudo, one of them was not found"
exit 1
sudo tux i openjdk-8-jre wget
fi
}
dl_bins()
{
file_name="bfg"
file_version="1.13.0"
dldest="./"
dltool="wget"
dlurl="https://repo1.maven.org/maven2/com/madgag/bfg/${file_version}/${file_name}-${file_version}.jar"
if [ -f ./bfg-1.13.0.jar ];then
echo "${file_name}-${file_version} already exists"
return
elif [ ${dltool} = "wget" ];then
${dltool} ${dlurl} -P ${dldest}
elif [ ${dltool} = "aria2c" ];then
${dltool} -x 10 -j 10 ${dlurl} -d ${dldest}
fi
}
chk_deps
dl_bins
trim_size="10M"
if [ ! -d .git/ ];then
echo "This is not a git repository"
else
java -jar ./${file_name}-${file_version}.jar --strip-blobs-bigger-than ${trim_size}
git reflog expire --expire=now --all && git gc --prune=now --aggressive
fi