This repository has been archived by the owner on Dec 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfetch-src
executable file
·48 lines (39 loc) · 1.6 KB
/
fetch-src
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
#!/bin/bash
# -----------------------------------------------------------------------
# Fetch kernel sources.
# Author: Mario Roy - http://github.com/marioroy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2 or later of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------
cl_rel="42690" cl_file="linux-6.11.9-1491.src.rpm"
kn_file="linux-6.11.11.tar.xz"
cl_url="https://cdn.download.clearlinux.org/releases"
kn_url="https://cdn.kernel.org/pub/linux/kernel/v6.x"
function fetch {
mkdir -p "SOURCES" && cd "SOURCES" || exit 1
if [[ ! -s "$cl_file" ]]; then
# purge src.rpm files
rm -f cmdline config ./*.patch ./*.patch.xz ./*.spec ./*.tar.xz linux-*.src.rpm
wget "${cl_url}/${cl_rel}/clear/source/SRPMS/${cl_file}" || exit 1
# extract src.rpm files
rpm2cpio "$cl_file" | cpio -i -d -u 2>/dev/null
fi
if [[ ! -s "$kn_file" ]]; then
rm -f linux-[0-9]*.tar.xz
wget "${kn_url}/${kn_file}" || exit 1
fi
}
echo "Fetch kernel sources"
cd ./rpmbuild || exit 1
fetch
echo "done."