Skip to content

Commit

Permalink
feat: Switch back to gnu tar
Browse files Browse the repository at this point in the history
Change-Id: Ifccff2f06d37d12cdeca55133fcdde2decc686fb
  • Loading branch information
XayahSuSuSu committed Dec 14, 2024
1 parent 3230d8d commit 52ac6b3
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 22 deletions.
Binary file modified source/app/src/arm64-v8a/assets/bin.zip
Binary file not shown.
Binary file modified source/app/src/armeabi-v7a/assets/bin.zip
Binary file not shown.
Binary file modified source/app/src/x86/assets/bin.zip
Binary file not shown.
Binary file modified source/app/src/x86_64/assets/bin.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ private class EnvInitializer : Shell.Initializer() {
.add("export PATH=${context.binDir()}:${USD}PATH")
.add("export HOME=${context.filesDir()}")
.add("set -o pipefail") // Ensure that the exit code of each command is correct.
.add("alias tar=${QUOTE}busybox tar$QUOTE")
.add("alias awk=${QUOTE}busybox awk$QUOTE")
.add("alias ps=${QUOTE}busybox ps$QUOTE")
.exec()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,24 @@ object Tar {

// Compress
val result = if (extra.isEmpty()) {
// tar -cpf - $src > "$dst"
// tar --totals -cpf - $src > "$dst"
execute(
"--totals",
"-cpf",
"- $src",
"-",
"${SymbolUtil.QUOTE}$src${SymbolUtil.QUOTE}",
">",
"${SymbolUtil.QUOTE}$dst${SymbolUtil.QUOTE}",
)
} else {
// tar -cpf - $src | $extra > "$dst"
// tar --totals -cpf - "$src | $extra > "$dst"
execute(
"--totals",
"-cpf",
"- $src",
"| $extra",
"-",
"${SymbolUtil.QUOTE}$src${SymbolUtil.QUOTE}",
"|",
extra,
">",
"${SymbolUtil.QUOTE}$dst${SymbolUtil.QUOTE}",
)
Expand All @@ -42,8 +47,9 @@ object Tar {
run {
val exclusion = exclusionList.trim().map { "--exclude=$it" }.toSpaceString()
if (extra.isEmpty()) {
// tar "$exclusion" $h -cpf - -C "$srcDir" -- "$src" > "$dst"
// tar --totals "$exclusion" $h -cpf - -C "$srcDir" -- "$src" > "$dst"
execute(
"--totals",
exclusion,
h,
"-cpf",
Expand All @@ -56,8 +62,9 @@ object Tar {
"${SymbolUtil.QUOTE}$dst${SymbolUtil.QUOTE}",
)
} else {
// tar "$exclusion" $h -cpf - -C "$srcDir" -- "$src" | $extra > "$dst"
// tar --totals "$exclusion" $h -cpf - -C "$srcDir" -- "$src" | $extra > "$dst"
execute(
"--totals",
exclusion,
h,
"-cpf",
Expand All @@ -66,7 +73,8 @@ object Tar {
"${SymbolUtil.QUOTE}$srcDir${SymbolUtil.QUOTE}",
"--",
"${SymbolUtil.QUOTE}$src${SymbolUtil.QUOTE}",
"| $extra",
"|",
extra,
">",
"${SymbolUtil.QUOTE}$dst${SymbolUtil.QUOTE}",
)
Expand Down Expand Up @@ -101,22 +109,24 @@ object Tar {

suspend fun decompress(src: String, dst: String, extra: String): ShellResult = run {
if (extra.isEmpty()) {
// tar -xmpf "$src" -C "$dst"
// tar --totals -xmpf "$src" -C "$dst"
execute(
"--totals",
"-xmpf",
"${SymbolUtil.QUOTE}$src${SymbolUtil.QUOTE}",
"-C",
"${SymbolUtil.QUOTE}$dst${SymbolUtil.QUOTE}",
)
} else {
// zstd -d -c "$src" | tar -xmpf - -C "$dst"
// zstd -d -c "$src" | tar --totals -xmpf - -C "$dst"
BaseUtil.execute(
"zstd",
"-d",
"-c",
"${SymbolUtil.QUOTE}$src${SymbolUtil.QUOTE}",
"|",
"tar",
"--totals",
"-xmpf",
"-",
"-C",
Expand All @@ -128,25 +138,29 @@ object Tar {
suspend fun decompress(exclusionList: List<String>, clear: String, m: Boolean, src: String, dst: String, extra: String): ShellResult = run {
val exclusion = exclusionList.trim().map { "--exclude=$it" }.toSpaceString()
if (extra.isEmpty()) {
// tar "$exclusion" -xmpf "$src" -C "$dst"
// tar --totals "$exclusion" $clear -xmpf "$src" -C "$dst"
execute(
"--totals",
exclusion,
clear,
if (m) "-xmpf" else "-xpf",
"${SymbolUtil.QUOTE}$src${SymbolUtil.QUOTE}",
"-C",
"${SymbolUtil.QUOTE}$dst${SymbolUtil.QUOTE}",
)
} else {
// zstd -d -c "$src" | tar "$exclusion" -xmpf - -C "$dst"
// zstd -d -c "$src" | tar --totals "$exclusion" $clear -xmpf - -C "$dst"
BaseUtil.execute(
"zstd",
"-d",
"-c",
"${SymbolUtil.QUOTE}$src${SymbolUtil.QUOTE}",
"|",
"tar",
"--totals",
exclusion,
if (m) "-xmpf" else "-xpf",
clear,
"-xmpf",
"-",
"-C",
"${SymbolUtil.QUOTE}$dst${SymbolUtil.QUOTE}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringArrayResource
import androidx.compose.ui.res.stringResource
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.xayah.core.datastore.KeyCleanRestoring
import com.xayah.core.datastore.KeyRestorePermissions
import com.xayah.core.datastore.KeyRestoreSsaid
import com.xayah.core.datastore.readKillAppOption
Expand Down Expand Up @@ -80,14 +81,12 @@ fun PageRestoreSettings() {
}
}

/**
* Switchable(
* key = KeyCleanRestoring,
* defValue = false,
* title = stringResource(id = R.string.clean_restoring),
* checkedText = stringResource(id = R.string.clean_restoring_desc),
* )
*/
Switchable(
key = KeyCleanRestoring,
defValue = false,
title = stringResource(id = R.string.clean_restoring),
checkedText = stringResource(id = R.string.clean_restoring_desc),
)

Switchable(
key = KeyRestorePermissions,
Expand Down

0 comments on commit 52ac6b3

Please sign in to comment.