diff --git a/bin/build.sh b/bin/build.sh index 76ff90e..4260199 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -120,7 +120,7 @@ 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 -if [[ "${HOST_DIST}" == "CentOS" || "${HOST_DIST}" == "RHEL" ]]; +if [[ "${HOST_DIST}" == "CentOS" || "${HOST_DIST}" == "RHEL" || "${HOST_DIST}" == "SUSE" ]]; source ${BASEDIR}/lib/07-centos_is_stupid.func.sh fi source ${BASEDIR}/lib/08-will_it_blend.func.sh @@ -154,7 +154,7 @@ fi if [[ ${1} == "update" ]]; then mentos - if [[ "${HOST_DIST}" == "CentOS" || "${HOST_DIST}" == "RHEL" ]]; + if [[ -f "${CHROOTDIR}root.x86_64/root/chroot" || -f "${CHROOTDIR}root.i686/root/chroot" ]]; centos_is_stupid fi will_it_blend 32 @@ -176,15 +176,21 @@ if [[ ${1} == "build" || -z ${1} || ${1} == "all" ]]; then if [[ "${MULTIARCH}" == "y" ]]; then - centos_is_stupid + if [[ -f "${CHROOTDIR}root.x86_64/root/chroot" || -f "${CHROOTDIR}root.i686/root/chroot" ]]; + centos_is_stupid + fi will_it_blend 64 will_it_blend 32 yo_dj any else - centos_is_stupid + if [[ -f "${CHROOTDIR}root.x86_64/root/chroot" || -f "${CHROOTDIR}root.i686/root/chroot" ]]; + centos_is_stupid + fi will_it_blend 64 yo_dj 64 - centos_is_stupid + if [[ -f "${CHROOTDIR}root.x86_64/root/chroot" || -f "${CHROOTDIR}root.i686/root/chroot" ]]; + centos_is_stupid + fi will_it_blend 32 yo_dj 32 fi diff --git a/lib/00-depcheck.func.sh b/lib/00-depcheck.func.sh index 9f503af..ca57d95 100755 --- a/lib/00-depcheck.func.sh +++ b/lib/00-depcheck.func.sh @@ -13,6 +13,7 @@ function so_check_me_out { fi fi + set +e if [[ -z "${HOST_DIST}" ]]; then for dist_profile in $(find "${BASEDIR}"/lib/prereqs -type f -name 'meta'); @@ -20,7 +21,7 @@ function so_check_me_out { source ${dist_profile} if [[ "${SUPPORTED}" != "yes" ]]; then - continue + continue fi eval "${CHECK_METHOD}" > /dev/null 2>&1 if [[ "${?}" == "0" ]]; @@ -30,6 +31,7 @@ function so_check_me_out { break 2 fi done + set -e fi # Sanity is important. @@ -40,7 +42,8 @@ function so_check_me_out { fi ## TWEAKS GO HERE. ## - # stupid gentoo. good riddance. + # stupid gentoo. good riddance. + set +e if [[ "${HOST_DIST}" == "Gentoo" ]]; then grep -q 'app-arch/lzma' /etc/portage/package.accept_keywords @@ -49,6 +52,21 @@ function so_check_me_out { echo 'app-arch/lzma' >> /etc/portage/package.accept_keywords fi fi + set -e + + # For some reason, I can't get "yes y | " to parse correctly with eval. And Arch isn't smart enough + # to figuure out that if I enable the multilib repos, *I wat multilib gcc*. Fuck it. We'll just remove it first. + if [[ "${HOST_DIST}" == "Arch" || "${HOST_DIST}" == "Antergos" || "${HOST_DIST}" == "Manjaro" ]]; + then + for pkg_override in gcc gcc-libs; + do + pacman -Q ${pkg_override} >> "${LOGFILE}.${FUNCNAME}" 2>&1 + if [[ "${?}" == "0" ]]; + then + pacman -R --noconfirm ${pkg_override} >> "${LOGFILE}.${FUNCNAME}" 2>&1 + 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. @@ -85,11 +103,13 @@ function so_check_me_out { 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." + exit 1 fi fi done < ${PKGLIST} set -e + rm -f "${LOCKFILE}" } so_check_me_out diff --git a/lib/07-centos_is_stupid.func.sh b/lib/07-centos_is_stupid.func.sh index 944713f..19ca659 100644 --- a/lib/07-centos_is_stupid.func.sh +++ b/lib/07-centos_is_stupid.func.sh @@ -22,6 +22,7 @@ function centos_is_stupid { echo fi # We used to fetch and compile mksquashfs from source here, but no longer- because a new enough version is *finally* in CentOS repos as of CentOS 7. + # This also lets us cut out the crufty version check and replace it with the one above. fi # UGH. And you know what? Fuck SUSE too. @@ -38,7 +39,60 @@ function centos_is_stupid { curl -sLo /tmp/${XORRISO_RPM} "http://download.opensuse.org/repositories/home:/Knolleblau/openSUSE_${SUSE_VER}/x86_64/${XORRISO_RPM}" zypper install --no-confirm -l /tmp/${XORRISO_RPM} >> "${LOGFILE}.${FUNCNAME}" 2>&1 echo "Done." + echo fi fi + + # And a double fuck-you to SLED/SLES. + if [[ "${HOST_DIST}" == "SUSE" ]]; + then + source /etc/os-release + source ${BASEDIR}/lib/prereqs/SUSE/meta + SUSE_VER="${VERSION_ID}" + SUSE_REL="${ID}" + SDK_PKGS=(binutils-devel git xz-devel xz-devel-32bit zlib-devel zlib-devel-32bit) + + 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 + + zypper search binutils-devel | egrep -q '^[[:space:]]*|[[:space:]]*binutils-devel[[:space:]]*' + if [[ "${?}" != "0" ]]; + then + echo + echo "In order to install some of the necessary packages on the host, you will need to add the SLE SDK repository." + echo "It can be downloaded by visiting http://download.suse.com/ and search for 'SUSE Linux Enterprise Software Development Kit'" + echo "(or add it to your subscriptions)." + echo "See https://www.suse.com/documentation/${SUSE_REL}-${SUSE_VER}/book_sle_deployment/data/sec_add-ons_sdk.html for more information." + exit 1 + else + for pkgname in "${SDK_PKGS[@]}"; + 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 + fi + fi + } diff --git a/lib/prereqs/Arch/pkgs b/lib/prereqs/Arch/pkgs index faeb1db..868374b 100644 --- a/lib/prereqs/Arch/pkgs +++ b/lib/prereqs/Arch/pkgs @@ -14,6 +14,5 @@ rsync sed squashfs-tools syslinux -xorriso xz zlib diff --git a/lib/prereqs/Fedora/pkgs b/lib/prereqs/Fedora/pkgs index ab94131..e79d042 100644 --- a/lib/prereqs/Fedora/pkgs +++ b/lib/prereqs/Fedora/pkgs @@ -14,6 +14,7 @@ sed squashfs-tools syslinux syslinux-devel +tar xorriso xz xz-devel diff --git a/lib/prereqs/SUSE/meta b/lib/prereqs/SUSE/meta index 6c2ae1b..56a6331 100644 --- a/lib/prereqs/SUSE/meta +++ b/lib/prereqs/SUSE/meta @@ -6,3 +6,4 @@ PKG_MGR='zypper install --no-confirm -l ${pkgname}' PRE_RUN='zypper refresh' PKG_CHK='rpm -q ${pkgname} | egrep "^${pkgname}-[0-9]"' URL='https://www.suse.com/' +# See the centos_is_stupid function. we do some tweaks there since -devel pkgs require the SDK on SLES/SLED. diff --git a/lib/prereqs/openSUSE/pkgs b/lib/prereqs/openSUSE/pkgs index 534b61e..49b7539 100644 --- a/lib/prereqs/openSUSE/pkgs +++ b/lib/prereqs/openSUSE/pkgs @@ -1,5 +1,4 @@ binutils -binutils-devel curl gcc gcc-32bit @@ -16,7 +15,3 @@ sed squashfs syslinux xz -xz-devel -xz-devel-32bit -zlib-devel -zlib-devel-32bit