This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetch-src
executable file
·55 lines (45 loc) · 1.8 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
48
49
50
51
52
53
54
#!/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="41850" cl_file="linux-6.9.3-1439.src.rpm"
kn_file="linux-6.9.3.tar.xz"
xm_file="6.9.3-xanmod1.tar.gz"
cl_url="https://cdn.download.clearlinux.org/releases"
kn_url="https://cdn.kernel.org/pub/linux/kernel/v6.x"
xm_url="https://github.com/xanmod/linux/archive/refs/tags"
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
if [[ ! -s "$xm_file" ]]; then
rm -f [0-9]*-xanmod*.tar.gz
wget "${xm_url}/${xm_file}" || exit 1
fi
}
echo "Fetch kernel sources"
cd ./rpmbuild || exit 1
fetch
echo "done."