Skip to content

Commit 6aecaf0

Browse files
new
1 parent bd5e031 commit 6aecaf0

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

fetch-config.sh

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,30 @@ else
77
VERSION_MAJOR="${VERSION}"
88
fi
99

10-
mkdir -p .fetch_config
11-
cd .fetch_config || exit
12-
13-
# get config file from ubuntu ppa
14-
DEB_FILE=$(curl https://kernel.ubuntu.com/\~kernel-ppa/mainline/v${VERSION_MAJOR}/amd64/ | grep -P -o 'linux-headers-.*?-generic.*?_amd64.deb' | awk 'NR==1{print $1}')
15-
echo "Fetching ${DEB_FILE} from https://kernel.ubuntu.com/~kernel-ppa/mainline/v${VERSION_MAJOR}/amd64/${DEB_FILE}"
16-
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v${VERSION_MAJOR}/amd64/${DEB_FILE}
17-
ar x ${DEB_FILE}
18-
if [ -f "data.tar.xz" ]; then
19-
tar xf data.tar.xz
20-
elif [ -f "data.tar.zst" ]; then
21-
cat data.tar.zst | zstd -d | tar xf -
10+
if [ -f config-${VERSION} ]; then
11+
cp config-${VERSION} .config
2212
else
23-
echo "No data.tar.xz or data.tar.zst found"
24-
exit 1
13+
mkdir -p .fetch_config
14+
cd .fetch_config || exit
15+
16+
# get config file from ubuntu ppa
17+
DEB_FILE=$(curl https://kernel.ubuntu.com/\~kernel-ppa/mainline/v${VERSION_MAJOR}/amd64/ | grep -P -o 'linux-headers-.*?-generic.*?_amd64.deb' | awk 'NR==1{print $1}')
18+
echo "Fetching ${DEB_FILE} from https://kernel.ubuntu.com/~kernel-ppa/mainline/v${VERSION_MAJOR}/amd64/${DEB_FILE}"
19+
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v${VERSION_MAJOR}/amd64/${DEB_FILE}
20+
ar x ${DEB_FILE}
21+
if [ -f "data.tar.xz" ]; then
22+
tar xf data.tar.xz
23+
elif [ -f "data.tar.zst" ]; then
24+
cat data.tar.zst | zstd -d | tar xf -
25+
else
26+
echo "No data.tar.xz or data.tar.zst found"
27+
exit 1
28+
fi
29+
30+
cd ..
31+
cp .fetch_config/usr/src/linux-headers-*/.config ./.config
2532
fi
2633

27-
cd ..
28-
cp .fetch_config/usr/src/linux-headers-*/.config ./.config
2934
GCC_VERSION=$(cat .config | sed -n 's/CONFIG_CC_VERSION_TEXT=".*\s\(.*\)"$/\1/p')
3035
GCC_VERSION_MAJOR=$(echo "${GCC_VERSION}" | sed -En 's/(.*).[0-9]+/\1/p')
3136

0 commit comments

Comments
 (0)