-
Notifications
You must be signed in to change notification settings - Fork 10
/
kernel_untar_build.sh
executable file
·86 lines (73 loc) · 1.57 KB
/
kernel_untar_build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
set -e
N="$1"
if [ -z "$N" ]; then
N=1
fi
function do_kernel_build {
T=$(mktemp -d -p .)
(
cd "$T"
tar xzvf "$LINUX"
cd linux*
make defconfig
n="$(nproc)"
make -j$((n+1))
)
rm -rfv "$T"
}
function main {
count=0
while true; do
if systemctl status ceph-fuse@-cephfs || [ "$(stat -f --format=%t /cephfs)" = c36400 ]; then
break # shell ! is stupid, can't move to while
fi
sleep 5
if ((++count > 60)); then
exit 1
fi
done
wget -q http://download.ceph.com/qa/linux-5.4.tar.gz
LINUX=$(realpath linux-5.4.tar.gz)
mkdir -p /cephfs/kernels
pushd /cephfs/kernels
if [ "$DISTRIBUTED" ]; then
setfattr -n ceph.dir.pin.distributed -v 1 .
fi
for ((i = 0; i < COUNT; ++i)); do
(do_kernel_build "$i") &> /root/client-output-$i.txt &
done
wait
popd
}
ARGUMENTS='--options d,h,p: --long distributed,help,pin:'
NEW_ARGUMENTS=$(getopt $ARGUMENTS -- "$@")
eval set -- "$NEW_ARGUMENTS"
function usage {
printf "%s: [--distributed|--pin=<max_mds>] <count>\n" "$0"
}
while [ "$#" -ge 0 ]; do
case "$1" in
-d|--distributed)
DISTRIBUTED=1
shift
;;
-h|--help)
usage
exit
;;
-p|--pin)
shift
PIN=1
MAX_MDS="$1"
shift
;;
--)
shift
break
;;
esac
done
COUNT="$1"
shift
main |& tee client-output.txt