halfway there. now i just need to build the package lists.

This commit is contained in:
brent s. 2015-07-14 01:29:27 -04:00
parent 52cb0ea321
commit 0153d38a33
28 changed files with 145 additions and 106 deletions

View File

@ -74,6 +74,8 @@ do
fi
done

source ${BASEDOR/}lib/00-depcheck.func.sh

if [ ! -f "./BUILDNO" ];
then
echo '0' > ./BUILDNO
@ -88,7 +90,7 @@ BUILD="$(cat BUILDNO)"
BUILD="$(expr ${BUILD} + 1)"
echo ${BUILD} > ./BUILDNO
BUILDTIME="$(date)"
BUILD_MACHINE="$(hostname -f)"
BUILD_MACHINE="$(hostname -f) (${HOST_DIST})"
#BUILD_USERNAME="${SUDO_USER}"
#BUILD_USERNAME="$(who am i | awk '{print $1}')"
set +e ; logname > /dev/null 2>&1
@ -111,18 +113,18 @@ 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
source lib/05-facehugger.func.sh
source lib/06-chroot_wrapper.func.sh
source lib/07-jenny_craig.func.sh
source lib/08-centos_is_stupid.func.sh
source lib/09-will_it_blend.func.sh
source lib/10-stuffy.func.sh
source lib/11-yo_dj.func.sh
source lib/12-mentos.func.sh
#source ${BASEDIR}/lib/00-depcheck.func.sh ## this should be called like, VERYYYY first thing, right after sanity/safety checks and such.
#source ${BASEDIR}/lib/01-mk.chroot.func.sh ## this is called automatically and only if no chroot exists
source ${BASEDIR}/lib/02-holla_atcha_boi.func.sh
source ${BASEDIR}/lib/03-release_me.func.sh
source ${BASEDIR}/lib/04-facehugger.func.sh
source ${BASEDIR}/lib/05-chroot_wrapper.func.sh
source ${BASEDIR}/lib/06-jenny_craig.func.sh
source ${BASEDIR}/lib/07-centos_is_stupid.func.sh
source ${BASEDIR}/lib/08-will_it_blend.func.sh
source ${BASEDIR}/lib/09-stuffy.func.sh
source ${BASEDIR}/lib/10-yo_dj.func.sh
source ${BASEDIR}/lib/11-mentos.func.sh

## The Business-End(TM) ##


View File

@ -11,25 +11,69 @@ function so_check_me_out {
fi
fi

if [[ -z ${HOST_DIST} ]];
if [[ -z "${HOST_DIST}" ]];
then
for dist_profile in $(find ${BASEDIR}/lib/prereqs -type f -name 'meta');
for dist_profile in $(find "${BASEDIR}"/lib/prereqs -type f -name 'meta');
do
source ${dist_profile}
if [[ ${SUPPORTED} != "yes" ]];
if [[ "${SUPPORTED}" != "yes" ]];
then
continue
fi
eval "${CHECK_METHOD}" > /dev/null 2>&1
if [[ "${?}" == "0" ]];
then
export HOST_DIST=${NAME}
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.
# Sanity is important.
if [[ -z "${HOST_DIST}" ]];
then
echo "ERROR: Your distro was not found/detected, or is flagged as unsupported."
exit 1
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.

DISTRO_DIR="${BASEDIR}/lib/prereqs/${HOST_DIST}"
META="${DISTRO_DIR}/meta"
PKGLIST="${DISTRO_DIR}/pkgs"

if [[ "${PRE_RUN}" != 'none' ]];
then
echo "Now updating your local package cache..."
set +e
eval "${PRE_RUN}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
if [[ "${?}" != "0" ]];
then
echo "ERROR: Syncing your local package cache via ${PRE_RUN} command failed."
echo "Please ensure you are connected to the Internet/have repositories configured correctly."
exit 1
fi
fi

while read pkgname;
do
eval "${PKG_CHK}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
if [[ "${?}" != "0" ]];
then
echo "Installing ${pkgname}..."
eval "${PKG_MGR}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
if [[ "${?}" != "0" ]];
then
echo "ERROR: ${pkgname} was not found to be installed and we can't install it."
echo "This usually means you aren't connected to the Internet or your package repositories"
echo "are not configured correctly. Review the list of packages in ${PKGLIST} and ensure"
echo "they are all available to be installed."
fi
fi
done < ${PKGLIST}

set -e
}

so_check_me_out

View File

@ -1,30 +0,0 @@
function im_batman {
set +e # false errors are bad mmk
# Detect the distro and set some vars
if [ -f "/usr/bin/yum" ]; # CentOS/Redhat, etc.
then
OS_STRING='RHEL-like'
DISTRO='RHEL'
INST_CMD='yum -y install '
elif [ -f "/usr/bin/pacman" ]; # Arch, Manjaro, etc.
then
OS_STRING='Arch-like'
DISTRO='Arch'
INST_CMD='pacman -S '
elif [ -f "/usr/bin/emerge" ]; # Gentoo
then
OS_STRING='Gentoo-like'
DISTRO='Gentoo'
INST_CMD='emerge '
elif [ -f "/usr/bin/apt-get" ]; # Debian, Ubuntu (and derivatives), etc.
then
OS_STRING='Debian-like'
DISTRO="Debian"
INST_CMD='apt-get install '
else
echo 'Sorry, I cannot detect which distro you are running. Please report this along with what distro you are running. Dying now.'
exit 1
fi

set -e # and turn this back on lolz
}

View File

@ -1,7 +1,7 @@
function yo_dj () {
ARCH="${1}"
echo "Building the actual .iso image. This may take a while."
im_batman
#im_batman ## WHYTF IS THIS HERE?!
ISOFILENAME="${UXNAME}-${VERSION}.iso"
#MINIFILENAME="${UXNAME}-${VERSION}-mini.iso"
MINIFILENAME="${UXNAME}-mini.iso"

View File

@ -0,0 +1,7 @@
NAME='Antergos'
SUPPORTED='yes'
CHECK_METHOD='egrep "^NAME=\"Antergos Linux\"" /etc/os-release'
PKG_MGR='pacman --noconfirm -S ${pkgname}'
PRE_RUN='pacman -Syyy'
PKG_CHK='pacman -Q ${pkgname}'
URL='http://antergos.com/'

View File

View File

@ -1,6 +1,7 @@
NAME='Arch'
SUPPORTED='yes'
CHECK_METHOD='egrep "^NAME=\"Arch Linux\"" /etc/os-release'
PKG_MGR='pacman -S'
PKG_MGR='pacman --noconfirm -S ${pkgname}'
PRE_RUN='pacman -Syyy'
PKG_CHK='pacman -Q'
PKG_CHK='pacman -Q ${pkgname}'
URL='https://www.archlinux.org/'

View File

@ -1,6 +1,7 @@
NAME='CentOS'
SUPPORTED='yes'
CHECK_METHOD='egrep '^CentOS' /etc/redhat-release'
PKG_MGR='yum -y install'
CHECK_METHOD='egrep "^CentOS" /etc/redhat-release'
PKG_MGR='yum -y install ${pkgname}'
PRE_RUN='none'
PKG_CHK='rpm -q'
PKG_CHK='rpm -q ${pkgname} | egrep "^${pkgname}-[0-9]"'
URL='http://centos.org/'

View File

@ -1,6 +1,8 @@
NAME='Debian'
SUPPORTED='yes'
CHECK_METHOD='cat /etc/debian_version'
PKG_MGR='apt-get -y install'
CHECK_METHOD='egrep "^[0-9.]*$" /etc/debian_version'
CHECK_METHOD='egrep "^NAME=\"Debian\ GNU/Linux\"" /etc/os-release'
PKG_MGR='apt-get -y install ${pkgname}'
PRE_RUN='apt-get update'
PKG_CHK='dpkg-query -l'
PKG_CHK='dpkg-query -l ${pkgname}'
URL='http://www.debian.org/'

View File

@ -1,6 +1,7 @@
NAME='Fedora'
SUPPORTED='yes'
CHECK_METHOD='egrep '^Fedora' /etc/redhat-release'
PKG_MGR='yum -y install'
PKG_MGR='yum -y install ${pkgname}'
PRE_RUN='none'
PKG_CHK='rpm -q'
PKG_CHK='rpm -q ${pkgname} | egrep "^${pkgname}-[0-9]"'
URL='https://getfedora.org/'

View File

@ -1,6 +1,7 @@
NAME=
SUPPORTED=
CHECK_METHOD=
PKG_MGR=
PRE_RUN=
PKG_CHK=
NAME='Gentoo'
SUPPORTED='yes'
CHECK_METHOD='egrep "^Gentoo\ Base\ System" /etc/gentoo-release'
PKG_MGR='emerge -qD ${pkgname}'
PRE_RUN='emerge -q --sync'
PKG_CHK='emerge -qp @installed 2>/dev/null | egrep -E "/${pkgname}-[0-9.]+"'
URL='https://www.gentoo.org/'

View File

@ -14,5 +14,6 @@ PKG_MGR=<a command used to prefix installation of packages e.g. for RHEL, "yum -
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">
URL=<the URL for the distro. optional, as it isn't really used as any active part of the scripts- at least not presently.>

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.

View File

@ -1,6 +1,7 @@
NAME=
SUPPORTED=
CHECK_METHOD=
PKG_MGR=
PRE_RUN=
PKG_CHK=
NAME='Mageia'
SUPPORTED='yes'
CHECK_METHOD='egrep "^Mageia\ release\ " /etc/mageia-release'
PKG_MGR='urpmi ${pkgname}'
PRE_RUN='urpmi.update -a'
PKG_CHK='rpm -q ${pkgname} | egrep "^${pkgname}-[0-9]"'
URL='https://www.mageia.org/'

View File

@ -1,6 +1,7 @@
NAME=
SUPPORTED=
CHECK_METHOD=
PKG_MGR=
PRE_RUN=
PKG_CHK=
NAME='Manjaro'
SUPPORTED='yes'
CHECK_METHOD='egrep "^NAME=\"Manjaro Linux\"" /etc/os-release'
PKG_MGR='pacman --noconfirm -S ${pkgname}'
PRE_RUN='pacman -Syyyu'
PKG_CHK='pacman -Q ${pkgname}'
URL='https://manjaro.org/'

View File

@ -1,6 +1,7 @@
NAME=
SUPPORTED=
CHECK_METHOD=
PKG_MGR=
PRE_RUN=
PKG_CHK=
NAME='Mint'
SUPPORTED='yes'
CHECK_METHOD='egrep "^DESCRIPTION=\"Linux\ Mint\"" /etc/linuxmint/info'
PKG_MGR='apt-get -y install ${pkgname}'
PRE_RUN='apt-get -y update'
PKG_CHK='dpkg-query -l ${pkgname}'
URL='http://www.linuxmint.com/'

View File

@ -1,6 +1,8 @@
NAME=
SUPPORTED=
CHECK_METHOD=
PKG_MGR=
PRE_RUN=
PKG_CHK=
NAME=RHEL
SUPPORTED=yes
# Red Hat Enterprise Linux Server release 6.5 (Santiago)
CHECK_METHOD='egrep "^Red\ Hat\ Enterprise\ Linux" /etc/redhat-release'
PKG_MGR='yum -y install'
PRE_RUN='none'
PKG_CHK='rpm -q ${pkgname} | egrep "^${pkgname}-[0-9]"'
URL='http://www.redhat.com/en/technologies/linux-platforms/enterprise-linux'

View File

@ -1,6 +1,8 @@
NAME=
NAME='SUSE'
SUPPORTED=
CHECK_METHOD=
PKG_MGR=
PRE_RUN=
PKG_CHK=
# Both SLED and SLES. We can probably safely combine them.
CHECK_METHOD='egrep "^NAME=\"SLE(D|S)\"" /etc/os-release'
PKG_MGR='zypper install -l ${pkgname}'
PRE_RUN='none'
PKG_CHK='rpm -q ${pkgname} | egrep "^${pkgname}-[0-9]"'
URL='https://www.suse.com/'

View File

@ -1,6 +1,7 @@
NAME=
SUPPORTED=
CHECK_METHOD=
PKG_MGR=
PRE_RUN=
PKG_CHK=
NAME='Ubuntu'
SUPPORTED='yes'
CHECK_METHOD='egrep "^DISTRIB_ID=Ubuntu$" /etc/lsb-release'
PKG_MGR='apt-get -y install ${pkgname}'
PRE_RUN='apt-get -y update'
PKG_CHK='dpkg-query -l ${pkgname} | egrep "^ii[[:space:]]*${pkgname}"'
URL='http://www.ubuntu.com/'

View File

@ -1,6 +1,7 @@
NAME=
SUPPORTED=
CHECK_METHOD=
PKG_MGR=
PRE_RUN=
PKG_CHK=
NAME='openSUSE'
SUPPORTED='yes'
CHECK_METHOD=''
PKG_MGR=''
PRE_RUN=''
PKG_CHK=''
URL='https://www.opensuse.org/'