2017-04-28 19:29:25 +03:00
#!/usr/bin/bash
2017-09-06 20:53:46 +03:00
pkg_upgrade( ) {
2018-07-19 20:45:12 +03:00
echo " Running yum -y distro-sync... $( date) "
2018-05-14 21:00:44 +03:00
yum -y distro-sync
2018-07-19 20:45:12 +03:00
echo " Done yum -y distro-sync! $( date) "
2017-09-06 20:53:46 +03:00
}
2017-04-28 19:29:25 +03:00
make( ) {
2017-05-05 22:56:53 +03:00
/usr/bin/make -j $( getconf _NPROCESSORS_ONLN) " $@ "
2017-04-28 19:29:25 +03:00
}
build( ) {
env NOCONFIGURE = 1 ./autogen.sh
2018-01-18 20:27:42 +03:00
./configure --prefix= /usr --libdir= /usr/lib64 --sysconfdir= /etc " $@ "
2017-09-19 17:40:35 +03:00
make V = 1
2017-04-28 19:29:25 +03:00
}
2017-09-19 17:40:35 +03:00
pkg_install( ) {
2018-07-19 20:45:12 +03:00
echo " Running yum -y install... $( date) "
2017-09-19 17:40:35 +03:00
yum -y install " $@ "
2018-07-19 20:45:12 +03:00
echo " Done running yum -y install! $( date) "
2017-04-28 19:29:25 +03:00
}
2017-09-19 17:40:35 +03:00
pkg_install_if_os( ) {
os = $1
shift
( . /etc/os-release;
if test " ${ os } " = " ${ ID } " ; then
pkg_install " $@ "
else
echo " Skipping installation on OS ${ ID } : $@ "
fi
)
}
2017-07-17 20:40:25 +03:00
2017-09-19 17:40:35 +03:00
pkg_builddep( ) {
2018-07-19 20:45:12 +03:00
echo " Running builddep... $( date) "
2017-09-19 17:40:35 +03:00
# This is sadly the only case where it's a different command
if test -x /usr/bin/dnf; then
dnf builddep -y " $@ "
2017-07-17 20:40:25 +03:00
else
2017-09-19 17:40:35 +03:00
yum-builddep -y " $@ "
2017-07-17 20:40:25 +03:00
fi
2018-07-19 20:45:12 +03:00
echo " Done running builddep! $( date) "
2017-09-19 17:40:35 +03:00
}
2017-04-28 19:29:25 +03:00
2017-09-19 17:40:35 +03:00
pkg_install_builddeps( ) {
pkg = $1
if test -x /usr/bin/dnf; then
2018-07-19 20:45:12 +03:00
pkg_install dnf-plugins-core 'dnf-command(builddep)'
2017-09-19 17:40:35 +03:00
# Base buildroot
pkg_install @buildsys-build
else
2018-07-19 20:45:12 +03:00
pkg_install yum-utils
2017-09-19 17:40:35 +03:00
# Base buildroot, copied from the mock config sadly
2018-07-19 20:45:12 +03:00
pkg_install bash bzip2 coreutils cpio diffutils system-release findutils gawk gcc gcc-c++ grep gzip info make patch redhat-rpm-config rpm-build sed shadow-utils tar unzip util-linux which xz
2017-09-19 17:40:35 +03:00
fi
2017-04-28 19:29:25 +03:00
# builddeps+runtime deps
2017-09-19 17:40:35 +03:00
pkg_builddep $pkg
pkg_install $pkg
2017-04-28 19:29:25 +03:00
rpm -e $pkg
}