Skip to content

Commit 16aaa62

Browse files
Merge pull request #31 from 23xvx/add-support-platform-termux
Add zst compression type
2 parents 7ed2441 + f14ae35 commit 16aaa62

File tree

7 files changed

+37
-5
lines changed

7 files changed

+37
-5
lines changed

build-jammy.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ do_unmount "${frn}-armhf"
7676
do_unmount "${frn}-amd64"
7777

7878
shout "Build Complete.."
79-
ls ${frn}*tar*
79+
ls ${frn}*.*

cook.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ do_unmount "${frn}-armhf"
7272
do_unmount "${frn}-amd64"
7373

7474
shout "Build Complete.."
75-
ls ${frn}*tar*
75+
ls ${frn}*.*

plugins/envsetup

+16
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ setup_user() {
418418
}
419419

420420
do_chroot_proot_ae() {
421+
dpkg_depends_on proot
421422
local chroot_dir=$1
422423
shift
423424
local cmd_string=$*
@@ -495,6 +496,7 @@ do_compress() {
495496
bzip2) do_tar_bzip ;;
496497
gzip) do_tar_gzip ;;
497498
lz) do_tar_lz4 ;;
499+
zstd) do_tar_zstd ;;
498500
*)
499501
shout "Unknown compression type"
500502
shout "all compression: lz,gzip,bzip2"
@@ -548,6 +550,20 @@ do_tar_bzip() {
548550
$SUDO cp "${chroot_dir}/${TARGET_FILE}.tar.xz" out
549551
}
550552

553+
do_tar_zstd() {
554+
shout "installing zstd..."
555+
install_pkg "zstd"
556+
shout "starting compression..."
557+
$SUDO cp "plugins/zst-packer.sh" "${chroot_dir}"
558+
do_chroot_ae \
559+
"$chroot_dir" \
560+
"chmod +x /zst-packer.sh"
561+
do_chroot_ae \
562+
"$chroot_dir" \
563+
"/bin/bash /zst-packer.sh ${TARGET_FILE}"
564+
$SUDO cp "${chroot_dir}/${TARGET_FILE}.zst" out
565+
}
566+
551567
run_cmd() {
552568
local command=$*
553569
do_chroot_ae "$chroot_dir" "$command"

plugins/j-packer.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ tar \
77
--exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/mnt/*,/media/*,/lost+found/*} \
88
--exclude="*.l2s.*" \
99
--exclude=/${0} \
10-
--exclude="/${target}.tar.gz" \
10+
--exclude="/${target}.tar.xz" \
1111
--exclude-caches-all \
1212
--one-file-system \
1313
-cpf \

plugins/lz-packer.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ tar \
77
--exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/mnt/*,/media/*,/lost+found/*} \
88
--exclude="*.l2s.*" \
99
--exclude=/${0} \
10-
--exclude="/${target}.tar.gz" \
10+
--exclude="/${target}.tar.lz" \
1111
--exclude-caches-all \
1212
--one-file-system \
1313
-cpf \

plugins/zst-packer.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
3+
target=$1
4+
5+
tar \
6+
--exclude={/data,/apex,/vendor,/system,/sdcard} \
7+
--exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/mnt/*,/media/*,/lost+found/*} \
8+
--exclude="*.l2s.*" \
9+
--exclude=/${0} \
10+
--exclude="/${target}.zst" \
11+
--exclude-caches-all \
12+
--one-file-system \
13+
-cpf \
14+
- / -P \
15+
| pv -s $(($(du -skx / | awk '{print $1}') * 1024)) |\
16+
zstd > /"${target}".zst

setup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
if [ "$(uname -o)" = "Android" ]; then
55
echo "Running in Termux"
66
apt update
7-
apt install debootstrap which -y
7+
apt install debootstrap which proot -y
88
else
99
if [ "$(id -u)" != "0" ]; then
1010
if ! command -v sudo >/dev/null 2>&1; then

0 commit comments

Comments
 (0)