mirror of
https://github.com/whyour/qinglong.git
synced 2025-11-22 16:38:33 +08:00
移除用户判断
This commit is contained in:
parent
72d4c8bfd4
commit
45fac29804
|
|
@ -3,8 +3,6 @@ import fs from 'fs/promises';
|
|||
import os from 'os';
|
||||
import chokidar from 'chokidar';
|
||||
import config from '../config/index';
|
||||
import { promiseExec } from '../config/util';
|
||||
import { W_OK } from 'constants';
|
||||
import Logger from './logger';
|
||||
|
||||
async function linkToNodeModule(src: string, dst?: string) {
|
||||
|
|
@ -19,24 +17,11 @@ async function linkToNodeModule(src: string, dst?: string) {
|
|||
} catch (error) { }
|
||||
}
|
||||
|
||||
async function ensureDirWritable(dir: string) {
|
||||
try {
|
||||
await fs.access(dir, W_OK);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function linkCommand() {
|
||||
const homeDir = os.homedir();
|
||||
let userBinDir = path.join(homeDir, 'bin');
|
||||
|
||||
try {
|
||||
if (!(await ensureDirWritable(homeDir))) {
|
||||
const commandPath = await promiseExec('which node');
|
||||
userBinDir = path.dirname(commandPath);
|
||||
}
|
||||
await fs.mkdir(userBinDir, { recursive: true });
|
||||
await linkCommandToDir(userBinDir);
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Add ~/bin to PATH for non-root users
|
||||
export PATH="$HOME/bin:$PATH"
|
||||
|
||||
dir_shell=/ql/shell
|
||||
. $dir_shell/share.sh
|
||||
|
||||
export_ql_envs() {
|
||||
# Export BACK_PORT from QlPort for backend server to use
|
||||
export BACK_PORT="${ql_port}"
|
||||
# Export GRPC_PORT from QlGrpcPort for gRPC server to use
|
||||
export GRPC_PORT="${ql_grpc_port}"
|
||||
}
|
||||
|
||||
|
|
@ -17,7 +14,6 @@ log_with_style() {
|
|||
local level="$1"
|
||||
local message="$2"
|
||||
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
|
||||
printf "\n[%s] [%7s] %s\n" "${timestamp}" "${level}" "${message}"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user