manager:Add flag bits to module installations to prevent repeated installations

- Modify the time and location of the susfs self-startup scripts
This commit is contained in:
ShirkNeko
2025-07-12 11:41:58 +08:00
parent bd6eb7fddd
commit 755d454960
2 changed files with 9 additions and 6 deletions

View File

@@ -112,6 +112,7 @@ fun FlashScreen(navigator: DestinationsNavigator, flashIt: FlashIt) {
var showFloatAction by rememberSaveable { mutableStateOf(false) } var showFloatAction by rememberSaveable { mutableStateOf(false) }
// 添加状态跟踪是否已经完成刷写 // 添加状态跟踪是否已经完成刷写
var hasFlashCompleted by rememberSaveable { mutableStateOf(false) } var hasFlashCompleted by rememberSaveable { mutableStateOf(false) }
var hasExecuted by rememberSaveable { mutableStateOf(false) }
val snackBarHost = LocalSnackbarHost.current val snackBarHost = LocalSnackbarHost.current
val scope = rememberCoroutineScope() val scope = rememberCoroutineScope()
@@ -135,18 +136,21 @@ fun FlashScreen(navigator: DestinationsNavigator, flashIt: FlashIt) {
currentModule = 1 currentModule = 1
) )
hasFlashCompleted = false hasFlashCompleted = false
hasExecuted = false
} else if (flashIt !is FlashIt.FlashModules) { } else if (flashIt !is FlashIt.FlashModules) {
hasFlashCompleted = false hasFlashCompleted = false
hasExecuted = false
} }
} }
// 只有在未完成刷写时才执行刷写操作 // 只有在未完成刷写时才执行刷写操作
LaunchedEffect(flashIt, hasFlashCompleted) { LaunchedEffect(flashIt) {
// 如果已经完成刷写或者已有文本内容,则不再执行 if (hasExecuted || hasFlashCompleted || text.isNotEmpty()) {
if (hasFlashCompleted || text.isNotEmpty()) {
return@LaunchedEffect return@LaunchedEffect
} }
hasExecuted = true
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
setFlashingStatus(FlashingStatus.FLASHING) setFlashingStatus(FlashingStatus.FLASHING)

View File

@@ -464,9 +464,6 @@ object ScriptGenerator {
if (config.susPaths.isNotEmpty()) { if (config.susPaths.isNotEmpty()) {
generatePathSettingSection(config.androidDataPath, config.sdcardPath) generatePathSettingSection(config.androidDataPath, config.sdcardPath)
appendLine() appendLine()
appendLine("until [ -d \"/sdcard/Android\" ]; do sleep 1; done")
appendLine("sleep 45")
appendLine()
generateSusPathsSection(config.susPaths) generateSusPathsSection(config.susPaths)
} }
} }
@@ -480,6 +477,8 @@ object ScriptGenerator {
appendLine("# 路径配置") appendLine("# 路径配置")
appendLine("# 设置Android Data路径") appendLine("# 设置Android Data路径")
appendLine("until [ -d \"/sdcard/Android\" ]; do sleep 1; done") appendLine("until [ -d \"/sdcard/Android\" ]; do sleep 1; done")
appendLine("sleep 60")
appendLine()
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()