-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathknobs.sh
More file actions
executable file
·70 lines (59 loc) · 1.87 KB
/
Copy pathknobs.sh
File metadata and controls
executable file
·70 lines (59 loc) · 1.87 KB
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
#!/bin/sh
# A little script that generate file list of a "make installworld"
# using all knobs in /usr/src/tools/build/options
# Exit if error
set -e
WORKING_DIR=/tmp/knob-list
# Function that delete destdir if exist
clean_destdir () {
if [ -d ${WORKING_DIR}/$1 ]; then
chflags -R noschg ${WORKING_DIR}/$1
rm -rf ${WORKING_DIR}/$1
fi
}
# TODO:
# - Check root ?
#
if [ ! -d /usr/obj/usr/src/ ]; then
echo "You need to do a make buildworld (with an empty make.conf and src.conf) before"
exit 1
fi
# Cleanup
if [ ! -d ${WORKING_DIR} ]; then
mkdir ${WORKING_DIR}
fi
if [ -f ${WORKING_DIR}/WITHOUT.list ]; then
rm ${WORKING_DIR}/WITHOUT.list
fi
# Put all WITHOUT in a file
(
cd /usr/src/tools/build/options/
for WITHOUT_KNOB in WITHOUT_*
do
echo $WITHOUT_KNOB >> ${WORKING_DIR}/WITHOUT.list
done;
)
# Generating the reference file if not allready exist
if [ ! -f ${WORKING_DIR}/WITH_ALL.list ]; then
clean_destdir WITH_ALL
mkdir ${WORKING_DIR}/WITH_ALL
(cd /usr/src; make installworld DESTDIR=${WORKING_DIR}/WITH_ALL)
(cd ${WORKING_DIR}/WITH_ALL; find . > ${WORKING_DIR}/WITH_ALL.list)
clean_destdir WITH_ALL
fi
# Began the long installworld loop
for KNOB in $(cat ${WORKING_DIR}/WITHOUT.list)
do
# This if can be remove (It's a rapid fix because I've udpated my script between 2 runs)
if [ ! -f ${WORKING_DIR}/${KNOB}.list ]; then
clean_destdir $KNOB
mkdir ${WORKING_DIR}/${KNOB}
(cd /usr/src; make installworld ${KNOB}=YES DESTDIR=${WORKING_DIR}/${KNOB})
(cd ${WORKING_DIR}/${KNOB}; find . > ${WORKING_DIR}/${KNOB}.list)
clean_destdir $KNOB
fi
# Generate a more readable file list that show file removed:
if ! diff -u ${WORKING_DIR}/WITH_ALL.list ${WORKING_DIR}/${KNOB}.list | grep -e '-./' > ${WORKING_DIR}/${KNOB}.txt; then
echo "No difference detected: knobs related to a make buildworld, kernel or doesn' have effect yet" >> ${WORKING_DIR}/${KNOB}.txt
fi
done;