working on dat cross-distro support....

This commit is contained in:
brent s. 2015-07-12 03:04:09 -04:00
parent 67aba34ed1
commit 52cb0ea321
30 changed files with 138 additions and 3 deletions

View File

@ -7,6 +7,8 @@
#DEBUG
#set -x

echo "Starting at $(date)..."

## Import settings
if [ -f "build.conf" ];
then
@ -109,6 +111,7 @@ EOF

## FUNCTIONS ##

source lib/00-depcheck.func.sh
source lib/02-im_batman.func.sh
source lib/03-holla_atcha_boi.func.sh
source lib/04-release_me.func.sh
@ -194,4 +197,4 @@ fi

# yay! we're done!
rm -f ${LOCKFILE}
echo "Finished successfully!"
echo "Finished successfully at $(date)!"

View File

@ -1,5 +1,7 @@
#!/bin/bash

echo "Started at $(date)..."

## Import settings
if [ -f "build.conf" ];
then
@ -82,3 +84,5 @@ do
done

rm -f ${LOCKFILE}

echo "Finished successfully at $(date)!"

View File

@ -132,6 +132,11 @@ I_AM_A_RACECAR="no"
# The following should not be changed unless you are ABSOLUTELY, 100% SURE and COMPLETELY POSITIVE
# about what you are doing!!!

# This can be used to override automatic distro-detection.
# If you DO set this, be sure that you have a matching profile in
# ${BASEDIR}/lib/prereqs/<Distro>/meta !!
HOST_DIST=""

# This used to be defined statically, but is now dynamically appended. Please don't alter this
# unless you renamed the chroot directory paths.
CHROOTDIR="${BASEDIR}/"

View File

@ -1,3 +1,35 @@
#!/bin/bash

# placeholder...
function so_check_me_out {

if [[ -n ${HOST_DIST} ]];
then
if [[ ! -f ${BASEDIR}/lib/prereqs/${HOST_DIST}/meta || ! -f ${BASEDIR}/lib/prereqs/${HOST_DIST}/pkgs ]];
then
echo "ERROR: You have specified ${HOST_DIST} as your host system's distro, but it is missing a meta and/or pkgs profile."
exit 1
fi
fi

if [[ -z ${HOST_DIST} ]];
then
for dist_profile in $(find ${BASEDIR}/lib/prereqs -type f -name 'meta');
do
source ${dist_profile}
if [[ ${SUPPORTED} != "yes" ]];
then
continue
fi
eval "${CHECK_METHOD}" > /dev/null 2>&1
if [[ "${?}" == "0" ]];
then
export HOST_DIST=${NAME}
echo "Detected distro as ${HOST_DIST}."
break 2
fi
done
fi

# So we've validated the distro. Here, check for packages and install if necessary. maybe use an array, but it'd be better to soft-fail if one of the packages is missing.

}

View File

@ -7,6 +7,7 @@ function holla_atcha_boi {
RACECAR_CHK=""
fi

so_check_me_out

# Do we have an existing chroot set up yet? If not, create.
if [[ ! -d "root.x86_64/root" || ! -d "root.i686/root" ]];

6
lib/prereqs/Arch/meta Normal file
View File

@ -0,0 +1,6 @@
NAME='Arch'
SUPPORTED='yes'
CHECK_METHOD='egrep "^NAME=\"Arch Linux\"" /etc/os-release'
PKG_MGR='pacman -S'
PRE_RUN='pacman -Syyy'
PKG_CHK='pacman -Q'

0
lib/prereqs/Arch/pkgs Normal file
View File

6
lib/prereqs/CentOS/meta Normal file
View File

@ -0,0 +1,6 @@
NAME='CentOS'
SUPPORTED='yes'
CHECK_METHOD='egrep '^CentOS' /etc/redhat-release'
PKG_MGR='yum -y install'
PRE_RUN='none'
PKG_CHK='rpm -q'

0
lib/prereqs/CentOS/pkgs Normal file
View File

6
lib/prereqs/Debian/meta Normal file
View File

@ -0,0 +1,6 @@
NAME='Debian'
SUPPORTED='yes'
CHECK_METHOD='cat /etc/debian_version'
PKG_MGR='apt-get -y install'
PRE_RUN='apt-get update'
PKG_CHK='dpkg-query -l'

0
lib/prereqs/Debian/pkgs Normal file
View File

6
lib/prereqs/Fedora/meta Normal file
View File

@ -0,0 +1,6 @@
NAME='Fedora'
SUPPORTED='yes'
CHECK_METHOD='egrep '^Fedora' /etc/redhat-release'
PKG_MGR='yum -y install'
PRE_RUN='none'
PKG_CHK='rpm -q'

0
lib/prereqs/Fedora/pkgs Normal file
View File

6
lib/prereqs/Gentoo/meta Normal file
View File

@ -0,0 +1,6 @@
NAME=
SUPPORTED=
CHECK_METHOD=
PKG_MGR=
PRE_RUN=
PKG_CHK=

0
lib/prereqs/Gentoo/pkgs Normal file
View File

18
lib/prereqs/HUMAN Normal file
View File

@ -0,0 +1,18 @@
This directory is used to enable cross-distro support. A list of packages is needed for the *host* to build the ISO. Adding distro support is easy; there simply needs to be the following added:

<basedir>/lib/prereqs/<Distro>/{meta,pkgs}

"pkgs" should contain a list of the specific package names needed to install for that specific distro (as this isn't always standardized).

"meta" is a file consisting of the following variables (enclosed in single or double quotes, please:

NAME=<Distro - this should match the name of the directory this file is in!>
SUPPORTED=<yes or no- yes by default>
CHECK_METHOD=<a command that will be run that should return '0' (success) on *only* this specific distro
(or fully compatible derivatives, i.e. CentOS/RHEL)>
PKG_MGR=<a command used to prefix installation of packages e.g. for RHEL, "yum -y install">
PRE_RUN=<a command to be run before PKG_MGR (e.g. on Ubuntu, "apt-get update"). commonly used to update package caches/metadata.
if your distro does not require this, set PRE_RUN=none >
PKG_CHK=<a command that will be run that should return '0' (success) *only* if any given package in the pkgs file is installed. e.g. for RHEL, "rpm -q">

Oh- and your distro *must be able to install the package*. That means if you need to enable/add additional repositories, be sure to do so ahead of time.

6
lib/prereqs/Mageia/meta Normal file
View File

@ -0,0 +1,6 @@
NAME=
SUPPORTED=
CHECK_METHOD=
PKG_MGR=
PRE_RUN=
PKG_CHK=

0
lib/prereqs/Mageia/pkgs Normal file
View File

6
lib/prereqs/Manjaro/meta Normal file
View File

@ -0,0 +1,6 @@
NAME=
SUPPORTED=
CHECK_METHOD=
PKG_MGR=
PRE_RUN=
PKG_CHK=

0
lib/prereqs/Manjaro/pkgs Normal file
View File

6
lib/prereqs/Mint/meta Normal file
View File

@ -0,0 +1,6 @@
NAME=
SUPPORTED=
CHECK_METHOD=
PKG_MGR=
PRE_RUN=
PKG_CHK=

0
lib/prereqs/Mint/pkgs Normal file
View File

6
lib/prereqs/RHEL/meta Normal file
View File

@ -0,0 +1,6 @@
NAME=
SUPPORTED=
CHECK_METHOD=
PKG_MGR=
PRE_RUN=
PKG_CHK=

0
lib/prereqs/RHEL/pkgs Normal file
View File

6
lib/prereqs/SUSE/meta Normal file
View File

@ -0,0 +1,6 @@
NAME=
SUPPORTED=
CHECK_METHOD=
PKG_MGR=
PRE_RUN=
PKG_CHK=

0
lib/prereqs/SUSE/pkgs Normal file
View File

6
lib/prereqs/Ubuntu/meta Normal file
View File

@ -0,0 +1,6 @@
NAME=
SUPPORTED=
CHECK_METHOD=
PKG_MGR=
PRE_RUN=
PKG_CHK=

0
lib/prereqs/Ubuntu/pkgs Normal file
View File

View File

@ -0,0 +1,6 @@
NAME=
SUPPORTED=
CHECK_METHOD=
PKG_MGR=
PRE_RUN=
PKG_CHK=

View File