Fixing SUS Path Execution Errors

- Simplify SuSFS configuration management
This commit is contained in:
ShirkNeko
2025-06-21 00:21:14 +08:00
parent f69eb5c115
commit 519401cf39
4 changed files with 589 additions and 1203 deletions

View File

@@ -8,6 +8,40 @@ import android.annotation.SuppressLint
*/ */
object ScriptGenerator { object ScriptGenerator {
// 常量定义
@SuppressLint("SdCardPath")
private const val DEFAULT_ANDROID_DATA_PATH = "/sdcard/Android/data"
@SuppressLint("SdCardPath")
private const val DEFAULT_SDCARD_PATH = "/sdcard"
private const val DEFAULT_UNAME = "default"
private const val DEFAULT_BUILD_TIME = "default"
private const val LOG_DIR = "/data/adb/ksu/log"
// 日志相关的通用脚本片段
private fun generateLogSetup(logFileName: String): String = """
# 日志目录
LOG_DIR="$LOG_DIR"
LOG_FILE="${'$'}LOG_DIR/$logFileName"
# 创建日志目录
mkdir -p "${'$'}LOG_DIR"
# 获取当前时间
get_current_time() {
date '+%Y-%m-%d %H:%M:%S'
}
""".trimIndent()
// 二进制文件检查的通用脚本片段
private fun generateBinaryCheck(targetPath: String): String = """
# 检查SuSFS二进制文件
SUSFS_BIN="$targetPath"
if [ ! -f "${'$'}SUSFS_BIN" ]; then
echo "$(get_current_time): SuSFS二进制文件未找到: ${'$'}SUSFS_BIN" >> "${'$'}LOG_FILE"
exit 1
fi
""".trimIndent()
/** /**
* 生成service.sh脚本内容 * 生成service.sh脚本内容
*/ */
@@ -29,59 +63,77 @@ object ScriptGenerator {
appendLine("# SuSFS Service Script") appendLine("# SuSFS Service Script")
appendLine("# 在系统服务启动后执行") appendLine("# 在系统服务启动后执行")
appendLine() appendLine()
appendLine("# 日志目录") appendLine(generateLogSetup("susfs_service.log"))
appendLine("LOG_DIR=\"/data/adb/ksu/log\"")
appendLine("LOG_FILE=\"\$LOG_DIR/susfs_service.log\"")
appendLine() appendLine()
appendLine("# 创建日志目录") appendLine(generateBinaryCheck(targetPath))
appendLine("mkdir -p \"\$LOG_DIR\"")
appendLine()
appendLine("# 获取当前时间")
appendLine("get_current_time() {")
appendLine(" date '+%Y-%m-%d %H:%M:%S'")
appendLine("}")
appendLine()
appendLine("# 检查SuSFS二进制文件")
appendLine("SUSFS_BIN=\"$targetPath\"")
appendLine("if [ ! -f \"\$SUSFS_BIN\" ]; then")
appendLine(" echo \"$(get_current_time): SuSFS二进制文件未找到: \$SUSFS_BIN\" >> \"\$LOG_FILE\"")
appendLine(" exit 1")
appendLine("fi")
appendLine() appendLine()
// 设置日志启用状态 // 设置日志启用状态
generateLogSettingSection(enableLog)
// 设置路径
generatePathSettingSection(androidDataPath, sdcardPath)
// 添加SUS路径
generateSusPathsSection(susPaths)
// 添加Kstat配置
generateKstatSection(kstatConfigs, addKstatPaths)
// 设置uname和构建时间
generateUnameSection(unameValue, buildTimeValue, executeInPostFsData)
// 隐藏BL相关配置
generateHideBlSection()
appendLine("echo \"$(get_current_time): Service脚本执行完成\" >> \"${'$'}LOG_FILE\"")
}
}
private fun StringBuilder.generateLogSettingSection(enableLog: Boolean) {
appendLine("# 设置日志启用状态") appendLine("# 设置日志启用状态")
val logValue = if (enableLog) 1 else 0 val logValue = if (enableLog) 1 else 0
appendLine("\"\$SUSFS_BIN\" enable_log $logValue") appendLine("\"${'$'}SUSFS_BIN\" enable_log $logValue")
appendLine("echo \"$(get_current_time): 日志功能设置为: ${if (enableLog) "启用" else "禁用"}\" >> \"\$LOG_FILE\"") appendLine("echo \"$(get_current_time): 日志功能设置为: ${if (enableLog) "启用" else "禁用"}\" >> \"${'$'}LOG_FILE\"")
appendLine() appendLine()
}
private fun StringBuilder.generatePathSettingSection(
androidDataPath: String,
sdcardPath: String
) {
// 设置Android Data路径 // 设置Android Data路径
if (androidDataPath != "/sdcard/Android/data") { if (androidDataPath != DEFAULT_ANDROID_DATA_PATH) {
appendLine("# 设置Android Data路径") appendLine("# 设置Android Data路径")
appendLine("\"\$SUSFS_BIN\" set_android_data_root_path '$androidDataPath'") appendLine("\"${'$'}SUSFS_BIN\" set_android_data_root_path '$androidDataPath'")
appendLine("echo \"$(get_current_time): Android Data路径设置为: $androidDataPath\" >> \"\$LOG_FILE\"") appendLine("echo \"$(get_current_time): Android Data路径设置为: $androidDataPath\" >> \"${'$'}LOG_FILE\"")
appendLine() appendLine()
} }
// 设置SD卡路径 // 设置SD卡路径
if (sdcardPath != "/sdcard") { if (sdcardPath != DEFAULT_SDCARD_PATH) {
appendLine("# 设置SD卡路径") appendLine("# 设置SD卡路径")
appendLine("\"\$SUSFS_BIN\" set_sdcard_root_path '$sdcardPath'") appendLine("\"${'$'}SUSFS_BIN\" set_sdcard_root_path '$sdcardPath'")
appendLine("echo \"$(get_current_time): SD卡路径设置为: $sdcardPath\" >> \"\$LOG_FILE\"") appendLine("echo \"$(get_current_time): SD卡路径设置为: $sdcardPath\" >> \"${'$'}LOG_FILE\"")
appendLine() appendLine()
} }
}
// 添加SUS路径 private fun StringBuilder.generateSusPathsSection(susPaths: Set<String>) {
if (susPaths.isNotEmpty()) { if (susPaths.isNotEmpty()) {
appendLine("# 添加SUS路径") appendLine("# 添加SUS路径")
susPaths.forEach { path -> susPaths.forEach { path ->
appendLine("\"\$SUSFS_BIN\" add_sus_path '$path'") appendLine("\"${'$'}SUSFS_BIN\" add_sus_path '$path'")
appendLine("echo \"$(get_current_time): 添加SUS路径: $path\" >> \"\$LOG_FILE\"") appendLine("echo \"$(get_current_time): 添加SUS路径: $path\" >> \"${'$'}LOG_FILE\"")
} }
appendLine() appendLine()
} }
}
private fun StringBuilder.generateKstatSection(
kstatConfigs: Set<String>,
addKstatPaths: Set<String>
) {
// 添加Kstat静态配置 // 添加Kstat静态配置
if (kstatConfigs.isNotEmpty()) { if (kstatConfigs.isNotEmpty()) {
appendLine("# 添加Kstat静态配置") appendLine("# 添加Kstat静态配置")
@@ -90,8 +142,8 @@ object ScriptGenerator {
if (parts.size >= 13) { if (parts.size >= 13) {
val path = parts[0] val path = parts[0]
val params = parts.drop(1).joinToString("' '", "'", "'") val params = parts.drop(1).joinToString("' '", "'", "'")
appendLine("\"\$SUSFS_BIN\" add_sus_kstat_statically $params") appendLine("\"${'$'}SUSFS_BIN\" add_sus_kstat_statically $params")
appendLine("echo \"$(get_current_time): 添加Kstat静态配置: $path\" >> \"\$LOG_FILE\"") appendLine("echo \"$(get_current_time): 添加Kstat静态配置: $path\" >> \"${'$'}LOG_FILE\"")
} }
} }
appendLine() appendLine()
@@ -101,103 +153,117 @@ object ScriptGenerator {
if (addKstatPaths.isNotEmpty()) { if (addKstatPaths.isNotEmpty()) {
appendLine("# 添加Kstat路径") appendLine("# 添加Kstat路径")
addKstatPaths.forEach { path -> addKstatPaths.forEach { path ->
appendLine("\"\$SUSFS_BIN\" add_sus_kstat '$path'") appendLine("\"${'$'}SUSFS_BIN\" add_sus_kstat '$path'")
appendLine("echo \"$(get_current_time): 添加Kstat路径: $path\" >> \"\$LOG_FILE\"") appendLine("echo \"$(get_current_time): 添加Kstat路径: $path\" >> \"${'$'}LOG_FILE\"")
} }
appendLine() appendLine()
} }
}
// 设置uname和构建时间 - 只有不在service中执行 private fun StringBuilder.generateUnameSection(
if (!executeInPostFsData && (unameValue != "default" || buildTimeValue != "default")) { unameValue: String,
buildTimeValue: String,
executeInPostFsData: Boolean
) {
if (!executeInPostFsData && (unameValue != DEFAULT_UNAME || buildTimeValue != DEFAULT_BUILD_TIME)) {
appendLine("# 设置uname和构建时间") appendLine("# 设置uname和构建时间")
appendLine("\"\$SUSFS_BIN\" set_uname '$unameValue' '$buildTimeValue'") appendLine("\"${'$'}SUSFS_BIN\" set_uname '$unameValue' '$buildTimeValue'")
appendLine("echo \"$(get_current_time): 设置uname为: $unameValue, 构建时间为: $buildTimeValue\" >> \"\$LOG_FILE\"") appendLine("echo \"$(get_current_time): 设置uname为: $unameValue, 构建时间为: $buildTimeValue\" >> \"${'$'}LOG_FILE\"")
appendLine() appendLine()
} }
}
appendLine("# 隐弱BL 来自 Shamiko 脚本") private fun StringBuilder.generateHideBlSection() {
appendLine("check_reset_prop() {") appendLine("# 隐藏BL 来自 Shamiko 脚本")
appendLine("local NAME=$1") appendLine(
appendLine("local EXPECTED=$2") """
appendLine("local VALUE=$(resetprop \$NAME)") check_reset_prop() {
appendLine("[ -z \$VALUE ] || [ \$VALUE = \$EXPECTED ] || resetprop \$NAME \$EXPECTED") local NAME=$1
appendLine("}") local EXPECTED=$2
appendLine() local VALUE=$(resetprop ${'$'}NAME)
appendLine("check_missing_prop() {") [ -z ${'$'}VALUE ] || [ ${'$'}VALUE = ${'$'}EXPECTED ] || resetprop ${'$'}NAME ${'$'}EXPECTED
appendLine(" local NAME=$1") }
appendLine(" local EXPECTED=$2")
appendLine(" local VALUE=$(resetprop \$NAME)") check_missing_prop() {
appendLine(" [ -z \$VALUE ] && resetprop \$NAME \$EXPECTED") local NAME=$1
appendLine("}") local EXPECTED=$2
appendLine() local VALUE=$(resetprop ${'$'}NAME)
appendLine("check_missing_match_prop() {") [ -z ${'$'}VALUE ] && resetprop ${'$'}NAME ${'$'}EXPECTED
appendLine(" local NAME=$1") }
appendLine(" local EXPECTED=$2")
appendLine(" local VALUE=$(resetprop \$NAME)") check_missing_match_prop() {
appendLine(" [ -z \$VALUE ] || [ \$VALUE = \$EXPECTED ] || resetprop \$NAME \$EXPECTED") local NAME=$1
appendLine(" [ -z \$VALUE ] && resetprop \$NAME \$EXPECTED") local EXPECTED=$2
appendLine("}") local VALUE=$(resetprop ${'$'}NAME)
appendLine() [ -z ${'$'}VALUE ] || [ ${'$'}VALUE = ${'$'}EXPECTED ] || resetprop ${'$'}NAME ${'$'}EXPECTED
appendLine("contains_reset_prop() {") [ -z ${'$'}VALUE ] && resetprop ${'$'}NAME ${'$'}EXPECTED
appendLine("local NAME=$1") }
appendLine("local CONTAINS=$2")
appendLine("local NEWVAL=$3") contains_reset_prop() {
appendLine("[[ \"$(resetprop \$NAME)\" = *\"\$CONTAINS\"* ]] && resetprop \$NAME \$NEWVAL") local NAME=$1
appendLine("}") local CONTAINS=$2
local NEWVAL=$3
[[ "$(resetprop ${'$'}NAME)" = *"${'$'}CONTAINS"* ]] && resetprop ${'$'}NAME ${'$'}NEWVAL
}
""".trimIndent())
appendLine() appendLine()
appendLine("resetprop -w sys.boot_completed 0") appendLine("resetprop -w sys.boot_completed 0")
appendLine() appendLine()
appendLine("check_missing_prop \"ro.boot.vbmeta.invalidate_on_error\" \"yes\"")
appendLine("check_missing_prop \"ro.boot.vbmeta.avb_version\" \"1.2\"") // 添加所有系统属性重置
appendLine("check_missing_prop \"ro.boot.vbmeta.hash_alg\" \"sha256\"") val systemProps = listOf(
"ro.boot.vbmeta.invalidate_on_error" to "yes",
"ro.boot.vbmeta.avb_version" to "1.2",
"ro.boot.vbmeta.hash_alg" to "sha256",
"ro.boot.vbmeta.device_state" to "locked",
"ro.boot.verifiedbootstate" to "green",
"ro.boot.flash.locked" to "1",
"ro.boot.veritymode" to "enforcing",
"ro.boot.warranty_bit" to "0",
"ro.warranty_bit" to "0",
"ro.debuggable" to "0",
"ro.force.debuggable" to "0",
"ro.secure" to "1",
"ro.adb.secure" to "1",
"ro.build.type" to "user",
"ro.build.tags" to "release-keys",
"ro.vendor.boot.warranty_bit" to "0",
"ro.vendor.warranty_bit" to "0",
"vendor.boot.vbmeta.device_state" to "locked",
"vendor.boot.verifiedbootstate" to "green",
"sys.oem_unlock_allowed" to "0",
"ro.secureboot.lockstate" to "locked",
"ro.boot.realmebootstate" to "green",
"ro.boot.realme.lockstate" to "1",
"ro.crypto.state" to "encrypted"
)
systemProps.forEach { (prop, value) ->
when {
prop.startsWith("ro.boot.vbmeta") && prop.endsWith("_on_error") ->
appendLine("check_missing_prop \"$prop\" \"$value\"")
prop.contains("device_state") || prop.contains("verifiedbootstate") ->
appendLine("check_missing_match_prop \"$prop\" \"$value\"")
else ->
appendLine("check_reset_prop \"$prop\" \"$value\"")
}
}
appendLine() appendLine()
appendLine("check_missing_match_prop \"ro.boot.vbmeta.device_state\" \"locked\"") appendLine("# Hide adb debugging traces")
appendLine("check_missing_match_prop \"ro.boot.verifiedbootstate\" \"green\"")
appendLine("check_missing_match_prop \"ro.boot.flash.locked\" \"1\"")
appendLine("check_missing_match_prop \"ro.boot.veritymode\" \"enforcing\"")
appendLine("check_missing_match_prop \"ro.boot.warranty_bit\" \"0\"")
appendLine("check_reset_prop \"ro.boot.vbmeta.device_state\" \"locked\"")
appendLine("check_reset_prop \"ro.boot.verifiedbootstate\" \"green\"")
appendLine("check_reset_prop \"ro.boot.flash.locked\" \"1\"")
appendLine("check_reset_prop \"ro.boot.veritymode\" \"enforcing\"")
appendLine("check_reset_prop \"ro.boot.warranty_bit\" \"0\"")
appendLine("check_reset_prop \"ro.warranty_bit\" \"0\"")
appendLine("check_reset_prop \"ro.debuggable\" \"0\"")
appendLine("check_reset_prop \"ro.force.debuggable\" \"0\"")
appendLine("check_reset_prop \"ro.secure\" \"1\"")
appendLine("check_reset_prop \"ro.adb.secure\" \"1\"")
appendLine("check_reset_prop \"ro.build.type\" \"user\"")
appendLine("check_reset_prop \"ro.build.tags\" \"release-keys\"")
appendLine("check_reset_prop \"ro.vendor.boot.warranty_bit\" \"0\"")
appendLine("check_reset_prop \"ro.vendor.warranty_bit\" \"0\"")
appendLine("check_reset_prop \"vendor.boot.vbmeta.device_state\" \"locked\"")
appendLine("check_reset_prop \"vendor.boot.verifiedbootstate\" \"green\"")
appendLine("check_reset_prop \"sys.oem_unlock_allowed\" \"0\"")
appendLine()
appendLine("#Hide adb debugging traces")
appendLine("resetprop \"sys.usb.adb.disabled\" \" \"") appendLine("resetprop \"sys.usb.adb.disabled\" \" \"")
appendLine() appendLine()
appendLine("# MIUI specific")
appendLine("check_reset_prop \"ro.secureboot.lockstate\" \"locked\"") appendLine("# Hide recovery boot mode")
appendLine()
appendLine("# Realme specific")
appendLine("check_reset_prop \"ro.boot.realmebootstate\" \"green\"")
appendLine("check_reset_prop \"ro.boot.realme.lockstate\" \"1\"")
appendLine()
appendLine("# Hide that we booted from recovery when magisk is in recovery mode")
appendLine("contains_reset_prop \"ro.bootmode\" \"recovery\" \"unknown\"") appendLine("contains_reset_prop \"ro.bootmode\" \"recovery\" \"unknown\"")
appendLine("contains_reset_prop \"ro.boot.bootmode\" \"recovery\" \"unknown\"") appendLine("contains_reset_prop \"ro.boot.bootmode\" \"recovery\" \"unknown\"")
appendLine("contains_reset_prop \"vendor.boot.bootmode\" \"recovery\" \"unknown\"") appendLine("contains_reset_prop \"vendor.boot.bootmode\" \"recovery\" \"unknown\"")
appendLine() appendLine()
appendLine("# Hide cloudphone detection") appendLine("# Hide cloudphone detection")
appendLine("[ -n \"$(resetprop ro.kernel.qemu)\" ] && resetprop ro.kernel.qemu \"\"") appendLine("[ -n \"$(resetprop ro.kernel.qemu)\" ] && resetprop ro.kernel.qemu \"\"")
appendLine() appendLine()
appendLine("# fake encryption status")
appendLine("check_reset_prop \"ro.crypto.state\" \"encrypted\"")
appendLine()
appendLine("echo \"$(get_current_time): Service脚本执行完成\" >> \"\$LOG_FILE\"")
}
} }
/** /**
@@ -214,37 +280,22 @@ object ScriptGenerator {
appendLine("# SuSFS Post-FS-Data Script") appendLine("# SuSFS Post-FS-Data Script")
appendLine("# 在文件系统挂载后但在系统完全启动前执行") appendLine("# 在文件系统挂载后但在系统完全启动前执行")
appendLine() appendLine()
appendLine("# 日志目录") appendLine(generateLogSetup("susfs_post_fs_data.log"))
appendLine("LOG_DIR=\"/data/adb/ksu/log\"")
appendLine("LOG_FILE=\"\$LOG_DIR/susfs_post_fs_data.log\"")
appendLine() appendLine()
appendLine("# 创建日志目录") appendLine(generateBinaryCheck(targetPath))
appendLine("mkdir -p \"\$LOG_DIR\"")
appendLine() appendLine()
appendLine("# 获取当前时间") appendLine("echo \"$(get_current_time): Post-FS-Data脚本开始执行\" >> \"${'$'}LOG_FILE\"")
appendLine("get_current_time() {")
appendLine(" date '+%Y-%m-%d %H:%M:%S'")
appendLine("}")
appendLine()
appendLine("# 检查SuSFS二进制文件")
appendLine("SUSFS_BIN=\"$targetPath\"")
appendLine("if [ ! -f \"\$SUSFS_BIN\" ]; then")
appendLine(" echo \"$(get_current_time): SuSFS二进制文件未找到: \$SUSFS_BIN\" >> \"\$LOG_FILE\"")
appendLine(" exit 1")
appendLine("fi")
appendLine()
appendLine("echo \"$(get_current_time): Post-FS-Data脚本开始执行\" >> \"\$LOG_FILE\"")
appendLine() appendLine()
// 设置uname和构建时间 - 只有在选择在post-fs-data中执行时才执行 // 设置uname和构建时间 - 只有在选择在post-fs-data中执行时才执行
if (executeInPostFsData && (unameValue != "default" || buildTimeValue != "default")) { if (executeInPostFsData && (unameValue != DEFAULT_UNAME || buildTimeValue != DEFAULT_BUILD_TIME)) {
appendLine("# 设置uname和构建时间") appendLine("# 设置uname和构建时间")
appendLine("\"\$SUSFS_BIN\" set_uname '$unameValue' '$buildTimeValue'") appendLine("\"${'$'}SUSFS_BIN\" set_uname '$unameValue' '$buildTimeValue'")
appendLine("echo \"$(get_current_time): 设置uname为: $unameValue, 构建时间为: $buildTimeValue\" >> \"\$LOG_FILE\"") appendLine("echo \"$(get_current_time): 设置uname为: $unameValue, 构建时间为: $buildTimeValue\" >> \"${'$'}LOG_FILE\"")
appendLine() appendLine()
} }
appendLine("echo \"$(get_current_time): Post-FS-Data脚本执行完成\" >> \"\$LOG_FILE\"") appendLine("echo \"$(get_current_time): Post-FS-Data脚本执行完成\" >> \"${'$'}LOG_FILE\"")
} }
} }
@@ -261,34 +312,19 @@ object ScriptGenerator {
appendLine("# SuSFS Post-Mount Script") appendLine("# SuSFS Post-Mount Script")
appendLine("# 在所有分区挂载完成后执行") appendLine("# 在所有分区挂载完成后执行")
appendLine() appendLine()
appendLine("# 日志目录") appendLine(generateLogSetup("susfs_post_mount.log"))
appendLine("LOG_DIR=\"/data/adb/ksu/log\"")
appendLine("LOG_FILE=\"\$LOG_DIR/susfs_post_mount.log\"")
appendLine() appendLine()
appendLine("# 创建日志目录") appendLine("echo \"$(get_current_time): Post-Mount脚本开始执行\" >> \"${'$'}LOG_FILE\"")
appendLine("mkdir -p \"\$LOG_DIR\"")
appendLine() appendLine()
appendLine("# 获取当前时间") appendLine(generateBinaryCheck(targetPath))
appendLine("get_current_time() {")
appendLine(" date '+%Y-%m-%d %H:%M:%S'")
appendLine("}")
appendLine()
appendLine("echo \"$(get_current_time): Post-Mount脚本开始执行\" >> \"\$LOG_FILE\"")
appendLine()
appendLine("# 检查SuSFS二进制文件")
appendLine("SUSFS_BIN=\"$targetPath\"")
appendLine("if [ ! -f \"\$SUSFS_BIN\" ]; then")
appendLine(" echo \"$(get_current_time): SuSFS二进制文件未找到: \$SUSFS_BIN\" >> \"\$LOG_FILE\"")
appendLine(" exit 1")
appendLine("fi")
appendLine() appendLine()
// 添加SUS挂载 // 添加SUS挂载
if (susMounts.isNotEmpty()) { if (susMounts.isNotEmpty()) {
appendLine("# 添加SUS挂载") appendLine("# 添加SUS挂载")
susMounts.forEach { mount -> susMounts.forEach { mount ->
appendLine("\"\$SUSFS_BIN\" add_sus_mount '$mount'") appendLine("\"${'$'}SUSFS_BIN\" add_sus_mount '$mount'")
appendLine("echo \"$(get_current_time): 添加SUS挂载: $mount\" >> \"\$LOG_FILE\"") appendLine("echo \"$(get_current_time): 添加SUS挂载: $mount\" >> \"${'$'}LOG_FILE\"")
} }
appendLine() appendLine()
} }
@@ -301,14 +337,14 @@ object ScriptGenerator {
if (parts.size == 2) { if (parts.size == 2) {
val path = parts[0] val path = parts[0]
val mode = parts[1] val mode = parts[1]
appendLine("\"\$SUSFS_BIN\" add_try_umount '$path' $mode") appendLine("\"${'$'}SUSFS_BIN\" add_try_umount '$path' $mode")
appendLine("echo \"$(get_current_time): 添加尝试卸载: $path (模式: $mode)\" >> \"\$LOG_FILE\"") appendLine("echo \"$(get_current_time): 添加尝试卸载: $path (模式: $mode)\" >> \"${'$'}LOG_FILE\"")
} }
} }
appendLine() appendLine()
} }
appendLine("echo \"$(get_current_time): Post-Mount脚本执行完成\" >> \"\$LOG_FILE\"") appendLine("echo \"$(get_current_time): Post-Mount脚本执行完成\" >> \"${'$'}LOG_FILE\"")
} }
} }
@@ -321,28 +357,13 @@ object ScriptGenerator {
appendLine("# SuSFS Boot-Completed Script") appendLine("# SuSFS Boot-Completed Script")
appendLine("# 在系统完全启动后执行") appendLine("# 在系统完全启动后执行")
appendLine() appendLine()
appendLine("# 日志目录") appendLine(generateLogSetup("susfs_boot_completed.log"))
appendLine("LOG_DIR=\"/data/adb/ksu/log\"")
appendLine("LOG_FILE=\"\$LOG_DIR/susfs_boot_completed.log\"")
appendLine() appendLine()
appendLine("# 创建日志目录") appendLine("echo \"$(get_current_time): Boot-Completed脚本开始执行\" >> \"${'$'}LOG_FILE\"")
appendLine("mkdir -p \"\$LOG_DIR\"")
appendLine() appendLine()
appendLine("# 获取当前时间") appendLine(generateBinaryCheck(targetPath))
appendLine("get_current_time() {")
appendLine(" date '+%Y-%m-%d %H:%M:%S'")
appendLine("}")
appendLine() appendLine()
appendLine("echo \"$(get_current_time): Boot-Completed脚本开始执行\" >> \"\$LOG_FILE\"") appendLine("echo \"$(get_current_time): Boot-Completed脚本执行完成\" >> \"${'$'}LOG_FILE\"")
appendLine()
appendLine("# 检查SuSFS二进制文件")
appendLine("SUSFS_BIN=\"$targetPath\"")
appendLine("if [ ! -f \"\$SUSFS_BIN\" ]; then")
appendLine(" echo \"$(get_current_time): SuSFS二进制文件未找到: \$SUSFS_BIN\" >> \"\$LOG_FILE\"")
appendLine(" exit 1")
appendLine("fi")
appendLine()
appendLine("echo \"$(get_current_time): Boot-Completed脚本执行完成\" >> \"\$LOG_FILE\"")
} }
} }

View File

@@ -450,6 +450,9 @@
<string name="susfs_add_sus_path">添加SUS路径</string> <string name="susfs_add_sus_path">添加SUS路径</string>
<string name="susfs_add_sus_mount">添加SUS挂载</string> <string name="susfs_add_sus_mount">添加SUS挂载</string>
<string name="susfs_add_try_umount">添加尝试卸载</string> <string name="susfs_add_try_umount">添加尝试卸载</string>
<string name="susfs_sus_path_added_success">SUS 路径添加成功</string>
<string name="susfs_path_not_found_error">路径未找到错误</string>
<string name="susfs_unknown_error">未知错误</string>
<string name="susfs_path_label">路径</string> <string name="susfs_path_label">路径</string>
<string name="susfs_mount_path_label">挂载路径</string> <string name="susfs_mount_path_label">挂载路径</string>
<string name="susfs_path_placeholder">例如: /system/addon.d</string> <string name="susfs_path_placeholder">例如: /system/addon.d</string>

View File

@@ -452,6 +452,9 @@
<string name="susfs_add_sus_path">Add SUS Path</string> <string name="susfs_add_sus_path">Add SUS Path</string>
<string name="susfs_add_sus_mount">Add SUS Mount</string> <string name="susfs_add_sus_mount">Add SUS Mount</string>
<string name="susfs_add_try_umount">Add Try Umount</string> <string name="susfs_add_try_umount">Add Try Umount</string>
<string name="susfs_sus_path_added_success">SUS path added successfully</string>
<string name="susfs_path_not_found_error">Path not found error</string>
<string name="susfs_unknown_error">Unknown error</string>
<string name="susfs_path_label">Path</string> <string name="susfs_path_label">Path</string>
<string name="susfs_mount_path_label">Mount Path</string> <string name="susfs_mount_path_label">Mount Path</string>
<string name="susfs_path_placeholder">e.g.: /system/addon.d</string> <string name="susfs_path_placeholder">e.g.: /system/addon.d</string>