Files
jitty-scripts/trimrepo.sh
T
2026-10-29 14:59:00 -04:00

44 lines
979 B
Bash
Executable File

#!/bin/bash
chk_deps()
{
if ! command -v java >/dev/null 2>&1 || ! command -v wget >/dev/null 2>&1;then
echo "Please install: java & wget, one of them was not found"
exit 1
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