From 78e156bfb225262b0b64f510295393b25db5b414 Mon Sep 17 00:00:00 2001 From: lollipopkit Date: Mon, 1 Apr 2024 19:35:05 -0600 Subject: [PATCH] fix: condig dir perm (#299) --- lib/core/extension/status_cmd_type.dart | 12 ------------ lib/data/model/app/shell_func.dart | 17 ++++++++++++++--- 2 files changed, 14 insertions(+), 15 deletions(-) delete mode 100644 lib/core/extension/status_cmd_type.dart diff --git a/lib/core/extension/status_cmd_type.dart b/lib/core/extension/status_cmd_type.dart deleted file mode 100644 index 3b45dd3c..00000000 --- a/lib/core/extension/status_cmd_type.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:toolbox/core/extension/context/locale.dart'; -import 'package:toolbox/data/model/app/shell_func.dart'; - -extension StatusCmdTypeX on StatusCmdType { - String get i18n => switch (this) { - StatusCmdType.sys => l10n.system, - StatusCmdType.host => l10n.host, - StatusCmdType.uptime => l10n.uptime, - StatusCmdType.battery => l10n.battery, - final val => val.name, - }; -} diff --git a/lib/data/model/app/shell_func.dart b/lib/data/model/app/shell_func.dart index 460c57cd..697e2f63 100644 --- a/lib/data/model/app/shell_func.dart +++ b/lib/data/model/app/shell_func.dart @@ -1,3 +1,5 @@ +import 'package:toolbox/core/extension/context/locale.dart'; + import '../../res/build_data.dart'; import '../server/system.dart'; @@ -30,9 +32,9 @@ enum ShellFunc { static const srvBoxDir = '$_homeVar/$_srvBoxDir'; static const _installShellPath = '$_homeVar/$_srvBoxDir/$_scriptFile'; - /// Issue #168 - /// Use `sh` for compatibility + // Issue #299, chmod ~/.config to avoid permission issue static const installShellCmd = """ +chmod +x ~/.config &> /dev/null mkdir -p $_homeVar/$_srvBoxDir cat > $_installShellPath chmod +x $_installShellPath @@ -63,7 +65,6 @@ chmod +x $_installShellPath return 'status'; // case ShellFunc.docker: // // `dockeR` -> avoid conflict with `docker` command - // // 以防止循环递归 // return 'dockeR'; case ShellFunc.process: return 'process'; @@ -259,3 +260,13 @@ const _bsdStatusCmd = [ //'sysctl -a | grep temperature', 'hostname', ]; + +extension StatusCmdTypeX on StatusCmdType { + String get i18n => switch (this) { + StatusCmdType.sys => l10n.system, + StatusCmdType.host => l10n.host, + StatusCmdType.uptime => l10n.uptime, + StatusCmdType.battery => l10n.battery, + final val => val.name, + }; +} \ No newline at end of file