This repository was archived by the owner on Feb 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathpackage-builder.sh
More file actions
executable file
·66 lines (47 loc) · 1.51 KB
/
Copy pathpackage-builder.sh
File metadata and controls
executable file
·66 lines (47 loc) · 1.51 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
#!/bin/sh
if [[ -z $1 ]]; then
echo "-------------------------------------"
echo "Usage: <package-name> <architecture>"
echo "-------------------------------------"
echo "You must specify a package name and an architecture."
echo "Achitecture options are \"32\" for 32 bit and \"64\" for 64 bit"
echo "-------------------------------------"
echo "64 bit package names are:"
ls x86_64/ | sed 's/ /\n/g'
echo "-------------------------------------"
echo "32 bit package names are:"
ls i686/ | sed 's/.i686//g'
exit 1
fi
# install some build dependencies
sudo dnf -y install wget cpio mock pykickstart fedpkg libvirt fedora-packager rpmdevtools
# turn selinux off if it's enabled
sudo setenforce 0
# make a destination folder for our packages
mkdir -p packages
# Setup tree
mkdir -p SOURCES
mkdir -p SPECS
mkdir -p SRPMS
mkdir -p BUILD
mkdir -p BUILDROOT
# enter the repository of the package to build:
if [[ "$2" == "32" ]]; then
export BUILDARCH="i686"
cd i686/$1.i686
else
export BUILDARCH="x86_64"
cd x86_64/$1
fi
# build the package
rpmbuild -bb --define "_srcrpmdir $(pwd)/../../packages " --undefine=_disable_source_fetch --target="$BUILDARCH" *.spec --define "_topdir $(pwd)/../.." --define "_rpmdir $(pwd)/../../packages"
# enter main dir
cd ../../
# Clean
rm -r BUILD
rm -r BUILDROOT
# Move rpms to packages
mv packages/x86_64/* packages/ || echo 'not a 64 bit package , this is ok!'
mv packages/i686/* packages/ || echo 'not a 32 bit package , this is ok!'
# re-enable selinux if needed
sudo setenforce 1