Skip to content

Commit e86c608

Browse files
committed
Add BCC examples and change dir structure in setup.sh
1 parent cb1ad15 commit e86c608

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tools/setup.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ mkdir -p examples
144144
cd examples || exit 1
145145

146146
echo "Fetching example files list..."
147-
FILES=$(curl -s "https://api.github.com/repos/pythonbpf/Python-BPF/contents/examples" | grep -o '"path": "examples/[^"]*"' | awk -F'"' '{print $4}')
147+
FILES=$(curl -s "https://api.github.com/repos/pythonbpf/Python-BPF/contents/examples" | grep -E -o '"path": "examples/[^"]*(\.md|\.ipynb|\.py)"' | awk -F'"' '{print $4}')
148+
BCC_EXAMPLES=$(curl -s "https://api.github.com/repos/pythonbpf/Python-BPF/contents/BCC-Examples" | grep -E -o '"path": "BCC-Examples/[^"]*(\.md|\.ipynb|\.py)"' | awk -F'"' '{print $4}')
148149

149150
if [ -z "$FILES" ]; then
150151
echo "Failed to fetch file list from repository. Using fallback method..."
@@ -166,11 +167,20 @@ if [ -z "$FILES" ]; then
166167
curl -s -O "https://raw.githubusercontent.com/pythonbpf/Python-BPF/master/examples/$example"
167168
done
168169
else
170+
mkdir examples && cd examples
169171
for file in $FILES; do
170172
filename=$(basename "$file")
171173
echo "Downloading: $filename"
172174
curl -s -o "$filename" "https://raw.githubusercontent.com/pythonbpf/Python-BPF/master/$file"
173175
done
176+
cd ..
177+
mkdir BCC-Examples && cd BCC-Examples
178+
for file in $BCC_EXAMPLES; do
179+
filename=$(basename "$file")
180+
echo "Downloading: $filename"
181+
curl -s -o "$filename" "https://raw.githubusercontent.com/pythonbpf/Python-BPF/master/$file"
182+
done
183+
cd ..
174184
fi
175185

176186
cd "$WORK_DIR" || exit 1

0 commit comments

Comments
 (0)