Skip to content

Commit c0280cd

Browse files
committed
Upload file
1 parent 7ba3c16 commit c0280cd

4 files changed

Lines changed: 25 additions & 5 deletions

File tree

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# kakathic
22

3-
if [ "$1" == "-h" ] || [ "$1" == "--help" ] || [ ! -f "$1" ];then
3+
if [ "$1" == "-h" ] || [ "$1" == "--help" ];then
44
echo "listpayload path/payload.[bin/zip]"
55
exit 1
66
fi
7-
(
8-
payload_dumper --out $TMP --list "$1" | sed "1,/-----/d" | awk '{print $1" ("$2$3")"}'
9-
) 2>/dev/null
7+
8+
if [ "$1" == "-b" ] || [ "$1" == "--byte" ];then
9+
shift
10+
payload_extract -p -i "$1" | awk '/^name:/{n=$2;s=$4;printf "%s|%s (%sB)\n",n,n,s}'
11+
else
12+
payload_extract -p -i "$1" | awk '/^name:/{n=$2;s=$4;cmd="coverbyte "s;cmd|getline r;close(cmd);printf "%s|%s (%s)\n",n,n,r}'
13+
fi

pio/src/main/assets/home/bin/unpack_img

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,22 @@ done
6969
progress -1/0
7070
}
7171

72+
process_payload(){
73+
PIDK=$!
74+
num1="$1";
75+
while kill -0 $PIDK 2>/dev/null; do
76+
if [ -f "$num1" ];then
77+
num3=$(tr '\r' '\n' < "$num1" | grep -o '[0-9]\+%' | tail -n1 | tr -d '%')
78+
if [ "$num3" ];then
79+
[ "${num3:-0}" == "${num4:-1}" ] || progress "$num3/100"
80+
num4="$num3"
81+
fi
82+
fi
83+
sleep 1
84+
done
85+
progress -1/0
86+
}
87+
7288
# xử lý zip
7389
if [ "$dang_tep" == 'zip' ];then
7490
xacnhatpay="$(listpayload "$INPUT")"
@@ -105,7 +121,7 @@ elif [ "$dang_tep" == 'sparse' ];then
105121
simg2img "$INPUT" "$file_img"
106122
elif [ "$dang_tep" == 'payload' ] || [ -n "$xacnhatpay" ];then
107123
echo -e "$unpack_text_1 (${INPUT##*/}) ➠ ($PVUGBIN)...\n"
108-
payload_dumper --no-parallel --out "$TMP" --images "$PVUGBIN" "$INPUT" >/dev/null || killtree "Payload unpack error"
124+
payload_extract -i "$INPUT" -X "$PVUGBIN" -o "$TMP" &>"$TMP/payload_extract.log" || killtree "Payload unpack error" & process_payload "$TMP/payload_extract.log"
109125
file_img="$TMP/$PVUGBIN.img"
110126
elif [ "$dang_tep" == 'super' ];then
111127
echo -e "$unpack_text_1 (${INPUT##*/}) ➠ ($PVUGBIN)...\n"
-3.71 MB
Binary file not shown.
2.89 MB
Binary file not shown.

0 commit comments

Comments
 (0)