brsh 1.3.0 → 2.0.0
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/.github/workflows/busybox-compat.yml +166 -0
- package/.github/workflows/release.yml +40 -0
- package/.releaserc.json +18 -0
- package/CHANGELOG.md +355 -0
- package/bin/brsh-cmd.js +78 -0
- package/bin/exportFileSystem.js +81 -156
- package/busybox-testsuite/cat.tests +49 -0
- package/busybox-testsuite/cp.tests +206 -0
- package/busybox-testsuite/grep.tests +237 -0
- package/busybox-testsuite/testing.sh +180 -0
- package/dist/brsh.css +2 -0
- package/dist/shell.es.js +5667 -0
- package/dist/shell.es.js.map +1 -0
- package/dist/shell.min.js +14 -219
- package/dist/shell.min.js.map +1 -147
- package/dist/terminal.es.js +6228 -0
- package/dist/terminal.es.js.map +1 -0
- package/dist/terminal.min.js +113 -18
- package/dist/terminal.min.js.map +1 -21
- package/index.js +231 -56
- package/lib/Command.js +12 -1
- package/lib/Context.js +12 -4
- package/lib/FileSystem.js +99 -6
- package/lib/NodeFileSystem.js +238 -0
- package/lib/Result.js +6 -0
- package/lib/ScriptCommand.js +193 -15
- package/lib/Terminal.js +192 -11
- package/lib/WasmCommand.js +252 -0
- package/lib/buildFilesystemStructure.js +58 -0
- package/lib/builtins/cat.js +67 -9
- package/lib/builtins/echo.js +36 -5
- package/lib/builtins/false.js +13 -0
- package/lib/builtins/grep.js +267 -0
- package/lib/builtins/index.js +9 -2
- package/lib/builtins/ls.js +86 -18
- package/lib/builtins/test.js +105 -0
- package/lib/builtins/true.js +10 -0
- package/lib/local/chmod.js +72 -0
- package/lib/local/cp.js +156 -0
- package/lib/local/index.js +9 -1
- package/lib/local/jsfunction.js +58 -0
- package/lib/local/mkdir.js +44 -0
- package/lib/local/mv.js +96 -0
- package/lib/local/pwd.js +13 -0
- package/lib/local/read.js +107 -0
- package/lib/local/rm.js +71 -0
- package/lib/local/which.js +2 -2
- package/package.json +31 -34
- package/test/builtins.test.js +505 -0
- package/test/exportFileSystem.test.js +226 -0
- package/test/helpers.js +35 -0
- package/test/local-commands.test.js +593 -0
- package/test/node-filesystem.test.js +133 -0
- package/test/scripts.test.js +277 -0
- package/test/shell.test.js +245 -0
- package/test/streaming.test.js +113 -0
- package/vite.config.shell.js +21 -0
- package/vite.config.terminal.js +27 -0
- package/vitest.config.js +15 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# Copyright 2005 by Rob Landley <rob@landley.net>
|
|
4
|
+
# Licensed under GPLv2, see file LICENSE in this source tree.
|
|
5
|
+
|
|
6
|
+
# AUDIT:
|
|
7
|
+
|
|
8
|
+
. ./testing.sh
|
|
9
|
+
|
|
10
|
+
# testing "test name" "commands" "expected result" "file input" "stdin"
|
|
11
|
+
# file input will be file called "input"
|
|
12
|
+
# test can create a file "actual" instead of writing to stdout
|
|
13
|
+
|
|
14
|
+
# Test exit status
|
|
15
|
+
|
|
16
|
+
testing "grep (exit with error)" "grep nonexistent 2> /dev/null ; echo \$?" \
|
|
17
|
+
"1\n" "" ""
|
|
18
|
+
testing "grep (exit success)" "grep grep '$0' > /dev/null 2>&1 ; echo \$?" "0\n" \
|
|
19
|
+
"" ""
|
|
20
|
+
# Test various data sources and destinations
|
|
21
|
+
|
|
22
|
+
testing "grep (default to stdin)" "grep two" "two\n" "" \
|
|
23
|
+
"one\ntwo\nthree\nthree\nthree\n"
|
|
24
|
+
testing "grep - (specify stdin)" "grep two -" "two\n" "" \
|
|
25
|
+
"one\ntwo\nthree\nthree\nthree\n"
|
|
26
|
+
testing "grep input (specify file)" "grep two input" "two\n" \
|
|
27
|
+
"one\ntwo\nthree\nthree\nthree\n" ""
|
|
28
|
+
|
|
29
|
+
# GNU grep 2.5.3 outputs a new line character after the located string
|
|
30
|
+
# even if there is no new line character in the input
|
|
31
|
+
testing "grep (no newline at EOL)" "grep bug input" "bug\n" "bug" ""
|
|
32
|
+
|
|
33
|
+
>empty
|
|
34
|
+
testing "grep two files" "grep two input empty 2>/dev/null" \
|
|
35
|
+
"input:two\n" "one\ntwo\nthree\nthree\nthree\n" ""
|
|
36
|
+
rm empty
|
|
37
|
+
|
|
38
|
+
testing "grep - infile (specify stdin and file)" "grep two - input" \
|
|
39
|
+
"(standard input):two\ninput:two\n" "one\ntwo\nthree\n" \
|
|
40
|
+
"one\ntwo\ntoo\nthree\nthree\n"
|
|
41
|
+
|
|
42
|
+
# Check if we see the correct return value if both stdin and non-existing file
|
|
43
|
+
# are given.
|
|
44
|
+
testing "grep - nofile (specify stdin and nonexisting file)" \
|
|
45
|
+
"grep two - nonexistent 2> /dev/null ; echo \$?" \
|
|
46
|
+
"(standard input):two\n(standard input):two\n2\n" \
|
|
47
|
+
"" "one\ntwo\ntwo\nthree\nthree\nthree\n"
|
|
48
|
+
testing "grep -q - nofile (specify stdin and nonexisting file, no match)" \
|
|
49
|
+
"grep -q nomatch - nonexistent 2> /dev/null ; echo \$?" \
|
|
50
|
+
"2\n" "" "one\ntwo\ntwo\nthree\nthree\nthree\n"
|
|
51
|
+
# SUSv3: If the -q option is specified, the exit status shall be zero
|
|
52
|
+
# if an input line is selected, even if an error was detected.
|
|
53
|
+
testing "grep -q - nofile (specify stdin and nonexisting file, match)" \
|
|
54
|
+
"grep -q two - nonexistent ; echo \$?" \
|
|
55
|
+
"0\n" "" "one\ntwo\ntwo\nthree\nthree\nthree\n"
|
|
56
|
+
|
|
57
|
+
# Test various command line options
|
|
58
|
+
# -s no error messages
|
|
59
|
+
testing "grep -s nofile (nonexisting file, no match)" \
|
|
60
|
+
"grep -s nomatch nonexistent ; echo \$?" "2\n" "" ""
|
|
61
|
+
testing "grep -s nofile - (stdin and nonexisting file, match)" \
|
|
62
|
+
"grep -s domatch nonexistent - ; echo \$?" \
|
|
63
|
+
"(standard input):domatch\n2\n" "" "nomatch\ndomatch\nend\n"
|
|
64
|
+
|
|
65
|
+
optional EXTRA_COMPAT
|
|
66
|
+
testing "grep handles NUL in files" "grep -a foo input" "\0foo\n" "\0foo\n\n" ""
|
|
67
|
+
testing "grep handles NUL on stdin" "grep -a foo" "\0foo\n" "" "\0foo\n\n"
|
|
68
|
+
|
|
69
|
+
testing "grep matches NUL" "grep . input > /dev/null 2>&1 ; echo \$?" \
|
|
70
|
+
"0\n" "\0\n" ""
|
|
71
|
+
SKIP=
|
|
72
|
+
|
|
73
|
+
# -e regex
|
|
74
|
+
testing "grep handles multiple regexps" "grep -e one -e two input ; echo \$?" \
|
|
75
|
+
"one\ntwo\n0\n" "one\ntwo\n" ""
|
|
76
|
+
testing "grep -F handles multiple expessions" "grep -F -e one -e two input ; echo \$?" \
|
|
77
|
+
"one\ntwo\n0\n" "one\ntwo\n" ""
|
|
78
|
+
testing "grep -F handles -i" "grep -F -i foo input ; echo \$?" \
|
|
79
|
+
"FOO\n0\n" "FOO\n" ""
|
|
80
|
+
|
|
81
|
+
# -f file/-
|
|
82
|
+
testing "grep can read regexps from stdin" "grep -f - input ; echo \$?" \
|
|
83
|
+
"two\nthree\n0\n" "tw\ntwo\nthree\n" "tw.\nthr\n"
|
|
84
|
+
|
|
85
|
+
# -x (whole line match)
|
|
86
|
+
testing "grep -x (full match)" "grep -x foo input ; echo \$?" \
|
|
87
|
+
"foo\n0\n" "foo\n" ""
|
|
88
|
+
testing "grep -x (partial match 1)" "grep -x foo input ; echo \$?" \
|
|
89
|
+
"1\n" "foo bar\n" ""
|
|
90
|
+
testing "grep -x (partial match 2)" "grep -x foo input ; echo \$?" \
|
|
91
|
+
"1\n" "bar foo\n" ""
|
|
92
|
+
testing "grep -x -F (full match)" "grep -x -F foo input ; echo \$?" \
|
|
93
|
+
"foo\n0\n" "foo\n" ""
|
|
94
|
+
testing "grep -x -F (partial match 1)" "grep -x -F foo input ; echo \$?" \
|
|
95
|
+
"1\n" "foo bar\n" ""
|
|
96
|
+
testing "grep -x -F (partial match 2)" "grep -x -F foo input ; echo \$?" \
|
|
97
|
+
"1\n" "bar foo\n" ""
|
|
98
|
+
|
|
99
|
+
# -L "show filenames which do not match" has inverted exitcode (if it printed something, it's "success")
|
|
100
|
+
testing "grep -L exitcode 0" "grep -L qwe input; echo \$?" \
|
|
101
|
+
"input\n0\n" "asd\n" ""
|
|
102
|
+
testing "grep -L exitcode 0 #2" "grep -L qwe input -; echo \$?" \
|
|
103
|
+
"(standard input)\n0\n" "qwe\n" "asd\n"
|
|
104
|
+
testing "grep -L exitcode 1" "grep -L qwe input; echo \$?" \
|
|
105
|
+
"1\n" "qwe\n" ""
|
|
106
|
+
|
|
107
|
+
optional EGREP
|
|
108
|
+
testing "grep -E supports extended regexps" "grep -E fo+" "foo\n" "" \
|
|
109
|
+
"b\ar\nfoo\nbaz"
|
|
110
|
+
testing "grep is also egrep" "egrep foo" "foo\n" "" "foo\nbar\n"
|
|
111
|
+
testing "egrep is not case insensitive" \
|
|
112
|
+
"egrep foo ; [ \$? -ne 0 ] && echo yes" "yes\n" "" "FOO\n"
|
|
113
|
+
testing "grep -E -o prints all matches" \
|
|
114
|
+
"grep -E -o '([[:xdigit:]]{2}[:-]){5}[[:xdigit:]]{2}'" \
|
|
115
|
+
"00:19:3E:00:AA:5E\n00:1D:60:3D:3A:FB\n00:22:43:49:FB:AA\n" \
|
|
116
|
+
"" "00:19:3E:00:AA:5E 00:1D:60:3D:3A:FB 00:22:43:49:FB:AA\n"
|
|
117
|
+
SKIP=
|
|
118
|
+
|
|
119
|
+
testing "grep -o does not loop forever" \
|
|
120
|
+
'grep -o "[^/]*$"' \
|
|
121
|
+
"test\n" \
|
|
122
|
+
"" "/var/test\n"
|
|
123
|
+
testing "grep -o does not loop forever on zero-length match" \
|
|
124
|
+
'grep -o "" | head -n1' \
|
|
125
|
+
"" \
|
|
126
|
+
"" "test\n"
|
|
127
|
+
|
|
128
|
+
testing "grep -f EMPTY_FILE" \
|
|
129
|
+
"grep -f input" \
|
|
130
|
+
"" \
|
|
131
|
+
"" \
|
|
132
|
+
"test\n"
|
|
133
|
+
|
|
134
|
+
testing "grep -v -f EMPTY_FILE" \
|
|
135
|
+
"grep -v -f input" \
|
|
136
|
+
"test\n" \
|
|
137
|
+
"" \
|
|
138
|
+
"test\n"
|
|
139
|
+
|
|
140
|
+
testing "grep -vxf EMPTY_FILE" \
|
|
141
|
+
"grep -vxf input" \
|
|
142
|
+
"test\n" \
|
|
143
|
+
"" \
|
|
144
|
+
"test\n"
|
|
145
|
+
|
|
146
|
+
testing "grep -Fw matches only words" \
|
|
147
|
+
"grep -Fw foo input" \
|
|
148
|
+
"" \
|
|
149
|
+
"foop\n" \
|
|
150
|
+
""
|
|
151
|
+
|
|
152
|
+
testing "grep -Fw doesn't stop on 1st mismatch" \
|
|
153
|
+
"grep -Fw foo input" \
|
|
154
|
+
"foop foo\n" \
|
|
155
|
+
"foop foo\n" \
|
|
156
|
+
""
|
|
157
|
+
|
|
158
|
+
testing "grep -w doesn't stop on 1st mismatch" \
|
|
159
|
+
"grep -w foo input" \
|
|
160
|
+
"foop foo\n" \
|
|
161
|
+
"foop foo\n" \
|
|
162
|
+
""
|
|
163
|
+
|
|
164
|
+
testing "grep -w ^str doesn't match str not at the beginning" \
|
|
165
|
+
"grep -w ^str input" \
|
|
166
|
+
"" \
|
|
167
|
+
"strstr\n" \
|
|
168
|
+
""
|
|
169
|
+
|
|
170
|
+
testing "grep -w ^ doesn't hang" \
|
|
171
|
+
"grep -w ^ input" \
|
|
172
|
+
"" \
|
|
173
|
+
"anything\n" \
|
|
174
|
+
""
|
|
175
|
+
|
|
176
|
+
testing "grep -w word doesn't match wordword" \
|
|
177
|
+
"grep -w word input" \
|
|
178
|
+
"" \
|
|
179
|
+
"wordword\n" \
|
|
180
|
+
""
|
|
181
|
+
|
|
182
|
+
testing "grep -F -w w doesn't match ww" \
|
|
183
|
+
"grep -F -w w input" \
|
|
184
|
+
"" \
|
|
185
|
+
"ww\n" \
|
|
186
|
+
""
|
|
187
|
+
|
|
188
|
+
testing "grep -w word match second word" \
|
|
189
|
+
"grep -w word input" \
|
|
190
|
+
"bword,word\n""wordb,word\n""bwordb,word\n" \
|
|
191
|
+
"bword,word\n""wordb,word\n""bwordb,word\n" \
|
|
192
|
+
""
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
testing "grep -x -v -e EXP1 -e EXP2 finds nothing if either EXP matches" \
|
|
196
|
+
"grep -x -v -e '.*aa.*' -e 'bb.*'; echo \$?" \
|
|
197
|
+
"1\n" \
|
|
198
|
+
"" \
|
|
199
|
+
" aa bb cc\n"
|
|
200
|
+
|
|
201
|
+
testing "grep PATTERN can be a newline-delimited list" \
|
|
202
|
+
'grep -Fv "$(printf "foo\nbar\n")"' \
|
|
203
|
+
"baz\n" \
|
|
204
|
+
"" \
|
|
205
|
+
"foo\nbar\nbaz\n"
|
|
206
|
+
|
|
207
|
+
testing "grep -e PATTERN can be a newline-delimited list" \
|
|
208
|
+
'grep -Fv -e "$(printf "foo\nbar\n")"' \
|
|
209
|
+
"baz\n" \
|
|
210
|
+
"" \
|
|
211
|
+
"foo\nbar\nbaz\n"
|
|
212
|
+
|
|
213
|
+
# -r on symlink to dir should recurse into dir
|
|
214
|
+
mkdir -p grep.testdir/foo
|
|
215
|
+
echo bar > grep.testdir/foo/file
|
|
216
|
+
ln -s foo grep.testdir/symfoo
|
|
217
|
+
testing "grep -r on symlink to dir" \
|
|
218
|
+
"grep -r . grep.testdir/symfoo" \
|
|
219
|
+
"grep.testdir/symfoo/file:bar\n" \
|
|
220
|
+
"" ""
|
|
221
|
+
rm -Rf grep.testdir
|
|
222
|
+
|
|
223
|
+
# But -r on dir/symlink_to_dir should not recurse into symlink_to_dir
|
|
224
|
+
mkdir -p grep.testdir/foo
|
|
225
|
+
echo bar > grep.testdir/foo/file
|
|
226
|
+
ln -s foo grep.testdir/symfoo
|
|
227
|
+
testing "grep -r on dir/symlink to dir" \
|
|
228
|
+
"grep -r . grep.testdir" \
|
|
229
|
+
"grep.testdir/foo/file:bar\n" \
|
|
230
|
+
"" ""
|
|
231
|
+
rm -Rf grep.testdir
|
|
232
|
+
|
|
233
|
+
# testing "test name" "commands" "expected result" "file input" "stdin"
|
|
234
|
+
# file input will be file called "input"
|
|
235
|
+
# test can create a file "actual" instead of writing to stdout
|
|
236
|
+
|
|
237
|
+
exit $FAILCOUNT
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# Simple test harness infrastructure for BusyBox
|
|
2
|
+
#
|
|
3
|
+
# Copyright 2005 by Rob Landley
|
|
4
|
+
#
|
|
5
|
+
# License is GPLv2, see LICENSE in the busybox tarball for full license text.
|
|
6
|
+
|
|
7
|
+
# This file defines two functions, "testing" and "optional"
|
|
8
|
+
# and a couple more...
|
|
9
|
+
|
|
10
|
+
# The following environment variables may be set to enable optional behavior
|
|
11
|
+
# in "testing":
|
|
12
|
+
# VERBOSE - Print the diff -u of each failed test case.
|
|
13
|
+
# DEBUG - Enable command tracing.
|
|
14
|
+
# SKIP - do not perform this test (this is set by "optional")
|
|
15
|
+
#
|
|
16
|
+
# The "testing" function takes five arguments:
|
|
17
|
+
# $1) Test description
|
|
18
|
+
# $2) Command(s) to run. May have pipes, redirects, etc
|
|
19
|
+
# $3) Expected result on stdout
|
|
20
|
+
# $4) Data to be written to file "input"
|
|
21
|
+
# $5) Data to be written to stdin
|
|
22
|
+
#
|
|
23
|
+
# The exit value of testing is the exit value of $2 it ran.
|
|
24
|
+
#
|
|
25
|
+
# The environment variable "FAILCOUNT" contains a cumulative total of the
|
|
26
|
+
# number of failed tests.
|
|
27
|
+
|
|
28
|
+
# The "optional" function is used to skip certain tests, ala:
|
|
29
|
+
# optional FEATURE_THINGY
|
|
30
|
+
#
|
|
31
|
+
# The "optional" function checks the environment variable "OPTIONFLAGS",
|
|
32
|
+
# which is either empty (in which case it always clears SKIP) or
|
|
33
|
+
# else contains a colon-separated list of features (in which case the function
|
|
34
|
+
# clears SKIP if the flag was found, or sets it to 1 if the flag was not found).
|
|
35
|
+
|
|
36
|
+
export FAILCOUNT=0
|
|
37
|
+
export SKIP=
|
|
38
|
+
|
|
39
|
+
# Helper for helpers. Oh my...
|
|
40
|
+
|
|
41
|
+
test x"$ECHO" != x"" || {
|
|
42
|
+
ECHO="echo"
|
|
43
|
+
test x"`echo -ne`" = x"" || {
|
|
44
|
+
# Compile and use a replacement 'echo' which understands -e -n
|
|
45
|
+
ECHO="$PWD/echo-ne"
|
|
46
|
+
test -x "$ECHO" || {
|
|
47
|
+
gcc -Os -o "$ECHO" ../scripts/echo.c || exit 1
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export ECHO
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# Helper functions
|
|
54
|
+
|
|
55
|
+
optional()
|
|
56
|
+
{
|
|
57
|
+
SKIP=
|
|
58
|
+
while test "$1"; do
|
|
59
|
+
case $1 in
|
|
60
|
+
"!"*)
|
|
61
|
+
case "${OPTIONFLAGS}" in
|
|
62
|
+
*:${1#!}:*) SKIP=1; return;;
|
|
63
|
+
esac
|
|
64
|
+
shift
|
|
65
|
+
;;
|
|
66
|
+
*)
|
|
67
|
+
case "${OPTIONFLAGS}" in
|
|
68
|
+
*:$1:*) ;;
|
|
69
|
+
*) SKIP=1; return ;;
|
|
70
|
+
esac
|
|
71
|
+
shift
|
|
72
|
+
;;
|
|
73
|
+
esac
|
|
74
|
+
done
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
# The testing function
|
|
78
|
+
|
|
79
|
+
testing()
|
|
80
|
+
{
|
|
81
|
+
NAME="$1"
|
|
82
|
+
[ -n "$1" ] || NAME="$2"
|
|
83
|
+
|
|
84
|
+
if [ $# -ne 5 ]
|
|
85
|
+
then
|
|
86
|
+
echo "Test $NAME has wrong number of arguments: $# (must be 5)" >&2
|
|
87
|
+
exit 1
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
[ -z "$DEBUG" ] || set -x
|
|
91
|
+
|
|
92
|
+
if [ -n "$SKIP" ]
|
|
93
|
+
then
|
|
94
|
+
echo "SKIPPED: $NAME"
|
|
95
|
+
return 0
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
$ECHO -ne "$3" > expected
|
|
99
|
+
$ECHO -ne "$4" > input
|
|
100
|
+
[ -z "$VERBOSE" ] || echo ======================
|
|
101
|
+
[ -z "$VERBOSE" ] || echo "echo -ne '$4' >input"
|
|
102
|
+
[ -z "$VERBOSE" ] || echo "echo -ne '$5' | $2"
|
|
103
|
+
$ECHO -ne "$5" | eval "$2" > actual
|
|
104
|
+
RETVAL=$?
|
|
105
|
+
|
|
106
|
+
if cmp expected actual >/dev/null 2>/dev/null
|
|
107
|
+
then
|
|
108
|
+
echo "PASS: $NAME"
|
|
109
|
+
else
|
|
110
|
+
FAILCOUNT=$(($FAILCOUNT + 1))
|
|
111
|
+
echo "FAIL: $NAME"
|
|
112
|
+
[ -z "$VERBOSE" ] || diff -u expected actual
|
|
113
|
+
fi
|
|
114
|
+
rm -f input expected actual
|
|
115
|
+
|
|
116
|
+
[ -z "$DEBUG" ] || set +x
|
|
117
|
+
|
|
118
|
+
return $RETVAL
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
# Recursively grab an executable and all the libraries needed to run it.
|
|
122
|
+
# Source paths beginning with / will be copied into destpath, otherwise
|
|
123
|
+
# the file is assumed to already be there and only its library dependencies
|
|
124
|
+
# are copied.
|
|
125
|
+
|
|
126
|
+
mkchroot()
|
|
127
|
+
{
|
|
128
|
+
[ $# -lt 2 ] && return
|
|
129
|
+
|
|
130
|
+
$ECHO -n .
|
|
131
|
+
|
|
132
|
+
dest=$1
|
|
133
|
+
shift
|
|
134
|
+
for i in "$@"
|
|
135
|
+
do
|
|
136
|
+
#bashism: [ "${i:0:1}" == "/" ] || i=$(which $i)
|
|
137
|
+
i=$(which $i) # no-op for /bin/prog
|
|
138
|
+
[ -f "$dest/$i" ] && continue
|
|
139
|
+
if [ -e "$i" ]
|
|
140
|
+
then
|
|
141
|
+
d=`echo "$i" | grep -o '.*/'` &&
|
|
142
|
+
mkdir -p "$dest/$d" &&
|
|
143
|
+
cat "$i" > "$dest/$i" &&
|
|
144
|
+
chmod +x "$dest/$i"
|
|
145
|
+
else
|
|
146
|
+
echo "Not found: $i"
|
|
147
|
+
fi
|
|
148
|
+
mkchroot "$dest" $(ldd "$i" | egrep -o '/.* ')
|
|
149
|
+
done
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
# Set up a chroot environment and run commands within it.
|
|
153
|
+
# Needed commands listed on command line
|
|
154
|
+
# Script fed to stdin.
|
|
155
|
+
|
|
156
|
+
dochroot()
|
|
157
|
+
{
|
|
158
|
+
mkdir tmpdir4chroot
|
|
159
|
+
mount -t ramfs tmpdir4chroot tmpdir4chroot
|
|
160
|
+
mkdir -p tmpdir4chroot/{etc,sys,proc,tmp,dev}
|
|
161
|
+
cp -L testing.sh tmpdir4chroot
|
|
162
|
+
|
|
163
|
+
# Copy utilities from command line arguments
|
|
164
|
+
|
|
165
|
+
$ECHO -n "Setup chroot"
|
|
166
|
+
mkchroot tmpdir4chroot $*
|
|
167
|
+
echo
|
|
168
|
+
|
|
169
|
+
mknod tmpdir4chroot/dev/tty c 5 0
|
|
170
|
+
mknod tmpdir4chroot/dev/null c 1 3
|
|
171
|
+
mknod tmpdir4chroot/dev/zero c 1 5
|
|
172
|
+
|
|
173
|
+
# Copy script from stdin
|
|
174
|
+
|
|
175
|
+
cat > tmpdir4chroot/test.sh
|
|
176
|
+
chmod +x tmpdir4chroot/test.sh
|
|
177
|
+
chroot tmpdir4chroot /test.sh
|
|
178
|
+
umount -l tmpdir4chroot
|
|
179
|
+
rmdir tmpdir4chroot
|
|
180
|
+
}
|
package/dist/brsh.css
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.terminal__cursor{display:inline-block}.terminal__cursor.blink{animation:1s step-end .5s infinite blink}.terminal__line{white-space:pre-wrap;min-height:1.15em;line-height:1.15em}@keyframes blink{0%,to{opacity:0}50%{opacity:1}}.ansi-black-fg{color:#000}.ansi-black-bg{background:#000}.ansi-red-fg{color:#b00}.ansi-red-bg{background:#b00}.ansi-green-fg{color:#0b0}.ansi-green-bg{background:#0b0}.ansi-yellow-fg{color:#bb0}.ansi-yellow-bg{background:#bb0}.ansi-blue-fg{color:#00b}.ansi-blue-bg{background:#00b}.ansi-magenta-fg{color:#b0b}.ansi-magenta-bg{background:#b0b}.ansi-cyan-fg{color:#0bb}.ansi-cyan-bg{background:#0bb}.ansi-white-fg{color:#fff}.ansi-white-bg{background:#fff}.ansi-bright-black-fg{color:#555}.ansi-bright-black-bg{background:#555}.ansi-bright-red-fg{color:#f55}.ansi-bright-red-bg{background:#f55}.ansi-bright-green-fg{color:#0f0}.ansi-bright-green-bg{background:#0f0}.ansi-bright-yellow-fg{color:#ff5}.ansi-bright-yellow-bg{background:#ff5}.ansi-bright-blue-fg{color:#55f}.ansi-bright-blue-bg{background:#55f}.ansi-bright-magenta-fg{color:#f5f}.ansi-bright-magenta-bg{background:#f5f}.ansi-bright-cyan-fg{color:#5ff}.ansi-bright-cyan-bg{background:#5ff}.ansi-bright-white-fg{color:#fff}.ansi-bright-white-bg{background:#fff}
|
|
2
|
+
/*$vite$:1*/
|