@whyour/qinglong 0.19.0 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/shell/share.sh
CHANGED
|
@@ -134,31 +134,6 @@ gen_random_num() {
|
|
|
134
134
|
echo $((${RANDOM} % $divi))
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
link_shell_sub() {
|
|
138
|
-
local link_path="$1"
|
|
139
|
-
local original_path="$2"
|
|
140
|
-
if [[ ! -L $link_path ]] || [[ $(readlink -f $link_path) != $original_path ]]; then
|
|
141
|
-
rm -f $link_path 2>/dev/null
|
|
142
|
-
ln -sf $original_path $link_path
|
|
143
|
-
fi
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
link_shell() {
|
|
147
|
-
if [[ $is_termux -eq 1 ]]; then
|
|
148
|
-
local path="/data/data/com.termux/files/usr/bin/"
|
|
149
|
-
elif [[ $PATH == */usr/local/bin* ]] && [[ -d /usr/local/bin ]]; then
|
|
150
|
-
local path="/usr/local/bin/"
|
|
151
|
-
else
|
|
152
|
-
local path=""
|
|
153
|
-
echo -e "脚本功能受限,请自行添加命令的软连接...\n"
|
|
154
|
-
fi
|
|
155
|
-
if [[ $path ]]; then
|
|
156
|
-
for ((i = 0; i < ${#link_name[*]}; i++)); do
|
|
157
|
-
link_shell_sub "$path${link_name[i]}" "$dir_shell/${original_name[i]}"
|
|
158
|
-
done
|
|
159
|
-
fi
|
|
160
|
-
}
|
|
161
|
-
|
|
162
137
|
define_cmd() {
|
|
163
138
|
local cmd_prefix cmd_suffix
|
|
164
139
|
if type task &>/dev/null; then
|
|
@@ -26,17 +26,20 @@ async function linkCommand() {
|
|
|
26
26
|
{
|
|
27
27
|
src: 'update.sh',
|
|
28
28
|
dest: 'ql',
|
|
29
|
+
tmp: 'ql_tmp',
|
|
29
30
|
},
|
|
30
31
|
{
|
|
31
32
|
src: 'task.sh',
|
|
32
33
|
dest: 'task',
|
|
34
|
+
tmp: 'task_tmp',
|
|
33
35
|
},
|
|
34
36
|
];
|
|
35
37
|
for (const link of linkShell) {
|
|
36
38
|
const source = path_1.default.join(index_1.default.rootPath, 'shell', link.src);
|
|
37
39
|
const target = path_1.default.join(commandDir, link.dest);
|
|
38
|
-
|
|
39
|
-
await promises_1.default.symlink(source,
|
|
40
|
+
const tmpTarget = path_1.default.join(commandDir, link.tmp);
|
|
41
|
+
await promises_1.default.symlink(source, tmpTarget);
|
|
42
|
+
await promises_1.default.rename(tmpTarget, target);
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
45
|
exports.default = async (src = 'deps') => {
|