From 114fbed031db87517ee4dc0b50d8d60f4d8b3a10 Mon Sep 17 00:00:00 2001 From: r00t Date: Mon, 29 Jun 2015 21:46:24 -0400 Subject: [PATCH] adding patches --- extra/pre-build.d/etc/mkinitcpio.conf | 2 +- .../lib/initcpio/hooks/archiso_http_custom | 47 +++++++++++++++++++ .../lib/initcpio/install/archiso_http_custom | 15 ++++++ lib/09-yo_dj.func.sh | 3 ++ src/ipxe_local/patches/ipxe-0002-banner.patch | 12 ++--- 5 files changed, 71 insertions(+), 8 deletions(-) create mode 100644 extra/pre-build.d/usr/lib/initcpio/hooks/archiso_http_custom create mode 100644 extra/pre-build.d/usr/lib/initcpio/install/archiso_http_custom diff --git a/extra/pre-build.d/etc/mkinitcpio.conf b/extra/pre-build.d/etc/mkinitcpio.conf index 4d05b7a..eae845d 100644 --- a/extra/pre-build.d/etc/mkinitcpio.conf +++ b/extra/pre-build.d/etc/mkinitcpio.conf @@ -50,7 +50,7 @@ FILES="" # usr, fsck and shutdown hooks. #HOOKS="base udev autodetect modconf block filesystems keyboard fsck" #HOOKS="base udev memdisk archiso_shutdown archiso modconf net ssh archiso_loop_mnt archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_kms block pcmcia filesystems keyboard livecd" -HOOKS="base udev memdisk archiso_shutdown archiso-custom modconf net ssh archiso_loop_mnt archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_kms block pcmcia filesystems keyboard livecd" +HOOKS="base udev memdisk archiso_shutdown archiso-custom modconf net ssh archiso_loop_mnt archiso_http_custom archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_kms block pcmcia filesystems keyboard livecd" # COMPRESSION # Use this to compress the initramfs image. By default, gzip compression diff --git a/extra/pre-build.d/usr/lib/initcpio/hooks/archiso_http_custom b/extra/pre-build.d/usr/lib/initcpio/hooks/archiso_http_custom new file mode 100644 index 0000000..5c2eb2f --- /dev/null +++ b/extra/pre-build.d/usr/lib/initcpio/hooks/archiso_http_custom @@ -0,0 +1,47 @@ +# vim: set ft=sh: + +run_hook() { + if [[ -n "${ip}" && -n "${archiso_http_srv}" ]]; then + + archiso_http_srv=$(eval echo ${archiso_http_srv}) + [[ -z "${archiso_http_spc}" ]] && archiso_http_spc="75%" + + mount_handler="archiso_pxe_http_mount_handler" + fi +} + +# Fetch a file with CURL +# +# $1 URL +# $2 Destination directory inside httpspace/${archisobasedir} +_curl_get() { + local _url="${1}" + local _dst="${2}" + + msg ":: Downloading '${_url}'" + if ! curl -L -fs -o "/run/archiso/httpspace/${archisobasedir}${_dst}/${_url##*/}" --create-dirs "${_url}"; then + echo "ERROR: Downloading failed." + #echo " Falling back to interactive prompt" + #echo " You can try to fix the problem manually, log out when you are finished" + #launch_interactive_shell + fi +} + +archiso_pxe_http_mount_handler () { + newroot="${1}" + + msg ":: Mounting /run/archiso/httpspace (tmpfs) filesystem, size='${archiso_http_spc}'" + mkdir -p "/run/archiso/httpspace" + mount -t tmpfs -o size="${archiso_http_spc}",mode=0755 httpspace "/run/archiso/httpspace" + + _curl_get "${archiso_http_srv}${archisobasedir}/${arch}/airootfs.sfs" "/${arch}" + + if [[ "${checksum}" == "y" ]]; then + _curl_get "${archiso_http_srv}${archisobasedir}/${arch}/airootfs.md5" "/${arch}" + fi + + mkdir -p "/run/archiso/bootmnt" + mount -o bind /run/archiso/httpspace /run/archiso/bootmnt + + archiso_mount_handler ${newroot} +} diff --git a/extra/pre-build.d/usr/lib/initcpio/install/archiso_http_custom b/extra/pre-build.d/usr/lib/initcpio/install/archiso_http_custom new file mode 100644 index 0000000..4e02f98 --- /dev/null +++ b/extra/pre-build.d/usr/lib/initcpio/install/archiso_http_custom @@ -0,0 +1,15 @@ +#!/bin/bash + +build() { + add_runscript + + add_binary curl +} + +help() { +cat<> "${LOGFILE}.${FUNCNAME}" 2>&1 + ## Build the mini-ISO ## + cd ${BASEDIR}/src/ipxe/src + for i in $(find ${BASEDIR}/ #isohybrid ${ISOFILENAME} cd ${ISODIR} diff --git a/src/ipxe_local/patches/ipxe-0002-banner.patch b/src/ipxe_local/patches/ipxe-0002-banner.patch index d457eec..f9e7870 100644 --- a/src/ipxe_local/patches/ipxe-0002-banner.patch +++ b/src/ipxe_local/patches/ipxe-0002-banner.patch @@ -26,15 +26,13 @@ index 4bcb64d..74b5b77 100644 */ - printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD PRODUCT_SHORT_NAME " %s" + printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD PRODUCT_SHORT_NAME - NORMAL " -- " PRODUCT_TAG_LINE " -- " +- NORMAL " -- " PRODUCT_TAG_LINE " -- " - CYAN PRODUCT_URI NORMAL "\nFeatures:", product_version ); + CYAN PRODUCT_URI NORMAL "\n" -+ BOLD "Arch" BLUE "Linux" NORMAL " -- make it simple and lightweight -- " -+ BOLD BLUE "http://archlinux.org" NORMAL "\n" -+ "Version %s compiled on " __DATE__ ", " __TIME__ "\n" -+ "Features:", product_version ); - for_each_table_entry ( feature, FEATURES ) - printf ( " %s", feature->name ); ++ BOLD BLUE "http://bdisk.square-r00t.net/" NORMAL "\n" ++ "%s" +- for_each_table_entry ( feature, FEATURES ) +- printf ( " %s", feature->name ); printf ( "\n" ); -- 2.3.0