Skip to content

Add zst compression type #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-jammy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ do_unmount "${frn}-armhf"
do_unmount "${frn}-amd64"

shout "Build Complete.."
ls ${frn}*tar*
ls ${frn}*.*
2 changes: 1 addition & 1 deletion cook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ do_unmount "${frn}-armhf"
do_unmount "${frn}-amd64"

shout "Build Complete.."
ls ${frn}*tar*
ls ${frn}*.*
16 changes: 16 additions & 0 deletions plugins/envsetup
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ setup_user() {
}

do_chroot_proot_ae() {
dpkg_depends_on proot
local chroot_dir=$1
shift
local cmd_string=$*
Expand Down Expand Up @@ -495,6 +496,7 @@ do_compress() {
bzip2) do_tar_bzip ;;
gzip) do_tar_gzip ;;
lz) do_tar_lz4 ;;
zstd) do_tar_zstd ;;
*)
shout "Unknown compression type"
shout "all compression: lz,gzip,bzip2"
Expand Down Expand Up @@ -548,6 +550,20 @@ do_tar_bzip() {
$SUDO cp "${chroot_dir}/${TARGET_FILE}.tar.xz" out
}

do_tar_zstd() {
shout "installing zstd..."
install_pkg "zstd"
shout "starting compression..."
$SUDO cp "plugins/zst-packer.sh" "${chroot_dir}"
do_chroot_ae \
"$chroot_dir" \
"chmod +x /zst-packer.sh"
do_chroot_ae \
"$chroot_dir" \
"/bin/bash /zst-packer.sh ${TARGET_FILE}"
$SUDO cp "${chroot_dir}/${TARGET_FILE}.zst" out
}

run_cmd() {
local command=$*
do_chroot_ae "$chroot_dir" "$command"
Expand Down
2 changes: 1 addition & 1 deletion plugins/j-packer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tar \
--exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/mnt/*,/media/*,/lost+found/*} \
--exclude="*.l2s.*" \
--exclude=/${0} \
--exclude="/${target}.tar.gz" \
--exclude="/${target}.tar.xz" \
--exclude-caches-all \
--one-file-system \
-cpf \
Expand Down
2 changes: 1 addition & 1 deletion plugins/lz-packer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tar \
--exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/mnt/*,/media/*,/lost+found/*} \
--exclude="*.l2s.*" \
--exclude=/${0} \
--exclude="/${target}.tar.gz" \
--exclude="/${target}.tar.lz" \
--exclude-caches-all \
--one-file-system \
-cpf \
Expand Down
16 changes: 16 additions & 0 deletions plugins/zst-packer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

target=$1

tar \
--exclude={/data,/apex,/vendor,/system,/sdcard} \
--exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/mnt/*,/media/*,/lost+found/*} \
--exclude="*.l2s.*" \
--exclude=/${0} \
--exclude="/${target}.zst" \
--exclude-caches-all \
--one-file-system \
-cpf \
- / -P \
| pv -s $(($(du -skx / | awk '{print $1}') * 1024)) |\
zstd > /"${target}".zst
2 changes: 1 addition & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if [ "$(uname -o)" = "Android" ]; then
echo "Running in Termux"
apt update
apt install debootstrap which -y
apt install debootstrap which proot -y
else
if [ "$(id -u)" != "0" ]; then
if ! command -v sudo >/dev/null 2>&1; then
Expand Down