fix: condig dir perm (#299)

This commit is contained in:
lollipopkit
2024-04-01 19:35:05 -06:00
parent 765404f55d
commit 78e156bfb2
2 changed files with 14 additions and 15 deletions

View File

@@ -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,
};
}

View File

@@ -1,3 +1,5 @@
import 'package:toolbox/core/extension/context/locale.dart';
import '../../res/build_data.dart'; import '../../res/build_data.dart';
import '../server/system.dart'; import '../server/system.dart';
@@ -30,9 +32,9 @@ enum ShellFunc {
static const srvBoxDir = '$_homeVar/$_srvBoxDir'; static const srvBoxDir = '$_homeVar/$_srvBoxDir';
static const _installShellPath = '$_homeVar/$_srvBoxDir/$_scriptFile'; static const _installShellPath = '$_homeVar/$_srvBoxDir/$_scriptFile';
/// Issue #168 // Issue #299, chmod ~/.config to avoid permission issue
/// Use `sh` for compatibility
static const installShellCmd = """ static const installShellCmd = """
chmod +x ~/.config &> /dev/null
mkdir -p $_homeVar/$_srvBoxDir mkdir -p $_homeVar/$_srvBoxDir
cat > $_installShellPath cat > $_installShellPath
chmod +x $_installShellPath chmod +x $_installShellPath
@@ -63,7 +65,6 @@ chmod +x $_installShellPath
return 'status'; return 'status';
// case ShellFunc.docker: // case ShellFunc.docker:
// // `dockeR` -> avoid conflict with `docker` command // // `dockeR` -> avoid conflict with `docker` command
// // 以防止循环递归
// return 'dockeR'; // return 'dockeR';
case ShellFunc.process: case ShellFunc.process:
return 'process'; return 'process';
@@ -259,3 +260,13 @@ const _bsdStatusCmd = [
//'sysctl -a | grep temperature', //'sysctl -a | grep temperature',
'hostname', '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,
};
}