Skip to content

Commit

Permalink
Fix: incomplete apk backup
Browse files Browse the repository at this point in the history
  • Loading branch information
VR-25 committed Jun 24, 2022
1 parent 5b268d9 commit 2e50b94
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions tarb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,28 @@ allow_apk_sideload() {

app() {
local i=
mkdir -p $BKP_DIR/$1/${3:-apk}
: > $TMP
for i in $2/*.${3:-apk}; do
[ -f $i ] || return 0
cp_uf $i $BKP_DIR/$1/${3:-apk}/${i##*/}
echo ${i##*/} >> $TMP
done
for i in $BKP_DIR/$1/${3:-apk}/*.${3:-apk}; do
grep -q ${i##*/} $TMP || rm -f $i
done
local pwd=$PWD
local type=${3:-apk}
[ -d $2 ] || return 0
mkdir -p $BKP_DIR/$1/$type
if [ $type = apk ]; then
cd $2
[ $(du -c *.apk | sed -n 's/\ttotal$//p') -eq $([ ! -f $BKP_DIR/$1/$type/base.apk ] && echo 0 || du -c $BKP_DIR/$1/$type/*.apk | sed -n 's/\ttotal$//p') ] || {
echo " apk(s)"
cp -f *.apk $BKP_DIR/$1/$type/
}
cd $pwd
else
: > $TMP
for i in $2/*.$type; do
[ -f $i ] || return 0
cp_uf $i $BKP_DIR/$1/$type/${i##*/}
echo ${i##*/} >> $TMP
done
for i in $BKP_DIR/$1/$type/*.$type; do
grep -q ${i##*/} $TMP || rm -f $i
done
fi
}


Expand Down

0 comments on commit 2e50b94

Please sign in to comment.