summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2012-04-26 19:52:15 +0200
committerDaniel Baumann <daniel@debian.org>2012-04-26 22:28:48 +0200
commitbbd9c284e4a7ac212ba50b014a79a091007c2539 (patch)
treea9e67e5eabd0fe7c2cef1e98e9a80fb4756fe39a
parentd2be2946dbe2fe059fa6c523c495694b2cfcba68 (diff)
downloadvyos-live-build-bbd9c284e4a7ac212ba50b014a79a091007c2539.tar.gz
vyos-live-build-bbd9c284e4a7ac212ba50b014a79a091007c2539.zip
Adding support for including firmware packages automatically within debian-installer.
-rwxr-xr-xfunctions/defaults.sh11
-rwxr-xr-xscripts/build/lb_binary_debian-installer46
-rwxr-xr-xscripts/build/lb_config12
3 files changed, 66 insertions, 3 deletions
diff --git a/functions/defaults.sh b/functions/defaults.sh
index f4e251797..c90b22075 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -1189,6 +1189,17 @@ Set_defaults ()
;;
esac
+ # Setting firmware option
+ case "${LB_MODE}" in
+ progress)
+ LB_FIRMWARE_BINARY="${LB_FIRMWARE_BINARY:-true}"
+ ;;
+
+ *)
+ LB_FIRMWARE_BINARY="${LB_FIRMWARE_BINARY:-false}"
+ ;;
+ esac
+
# Setting swap file
LB_SWAP_FILE_SIZE="${LB_SWAP_FILE_SIZE:-512}"
diff --git a/scripts/build/lb_binary_debian-installer b/scripts/build/lb_binary_debian-installer
index c72c4fac9..f31eb282d 100755
--- a/scripts/build/lb_binary_debian-installer
+++ b/scripts/build/lb_binary_debian-installer
@@ -397,6 +397,48 @@ then
;;
esac
+ # Include firmware packages
+ if [ "${LB_FIRMWARE_BINARY}" = "true" ]
+ then
+ # Assumption: firmware packages install files into /lib/firmware
+
+ # Get all firmware packages names
+ FIRMWARE_PACKAGES="$(wget ${WGET_OPTIONS} ${LB_PARENT_MIRROR_CHROOT}/dists/${LB_PARENT_DISTRIBUTION}/Contents-${LB_ARCHITECTURES}.gz -O - | gunzip -c | awk '/^lib\/firmware/ { print $2 }' | sort -u)"
+
+ if [ "${LB_DERIVATIVE}" = "true" ]
+ then
+ FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(wget ${WGET_OPTIONS} ${LB_MIRROR_CHROOT}/dists/${LB_DISTRIBUTION}/Contents-${LB_ARCHITECTURES}.gz -O - | gunzip -c | awk '/^lib\/firmware/ { print $2 }' | sort -u)"
+ fi
+
+ # Filter out contrib packages if contrib is not enabled
+ if ! echo ${LB_ARCHIVE_AREAS} | grep -qs contrib
+ then
+ for _PACKAGE in ${FIRMWARE_PACKAGES}
+ do
+ _FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES} $(echo ${_PACKAGE} | grep -v '^contrib/')"
+ done
+
+ FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES}"
+ fi
+
+ # Filter out non-free packages if non-free is not enabled
+ if ! echo ${LB_ARCHIVE_AREAS} | grep -qs non-free
+ then
+ for _PACKAGE in ${FIRMWARE_PACKAGES}
+ do
+ _FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES} $(echo ${_PACKAGE} | grep -v '^non-free/')"
+ done
+
+ FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES}"
+ fi
+
+ # Drop section and keep package names only
+ for _PACKAGE in ${FIRMWARE_PACKAGES}
+ do
+ DI_FIRMWARE_PACKAGES="${DI_FIRMWARE_PACKAGES} $(echo ${_PACKAGE} | awk -F/ '{ print $NF }')"
+ done
+ fi
+
# Set apt command prefix
_LB_APT_COMMAND="apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb -o APT::Install-Recommends=false --download-only"
@@ -429,10 +471,10 @@ then
# Download .debs of the required packages
Chroot chroot ${_LB_APT_COMMAND} install ${DI_REQ_PACKAGES}
- Chroot chroot ${_LB_APT_COMMAND} install ${DI_PACKAGES}
+ Chroot chroot ${_LB_APT_COMMAND} install ${DI_PACKAGES} ${DI_FIRMWARE_PACKAGES}
else
# Download .debs of the required packages
- Chroot chroot ${_LB_APT_COMMAND} install ${DI_PACKAGES}
+ Chroot chroot ${_LB_APT_COMMAND} install ${DI_PACKAGES} ${DI_FIRMWARE_PACKAGES}
# Revert dpkg status file
mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
diff --git a/scripts/build/lb_config b/scripts/build/lb_config
index 11a4e1f19..81c2db2f0 100755
--- a/scripts/build/lb_config
+++ b/scripts/build/lb_config
@@ -135,6 +135,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
\t [--security true|false]\n\
\t [--source true|false]\n\
\t [-s|--source-images iso|net|tar|hdd]\n\
+\t [--firmware-binary true|false]\n\
\t [--swap-file-path PATH]\n\
\t [--swap-file-size MB]\n\
\t [--syslinux-theme THEME_SUFFIX]\n\
@@ -169,7 +170,7 @@ Local_arguments ()
grub-splash:,isohybrid-options:,hdd-label:,hdd-size:,iso-application:,iso-preparer:,iso-publisher:,
iso-volume:,jffs2-eraseblock:,memtest:,net-root-filesystem:,net-root-mountoptions:,
net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:,
- net-cow-server:,net-tarball:,swap-file-path:,swap-file-size:,syslinux-theme:,
+ net-cow-server:,net-tarball:,firmware-binary:,swap-file-path:,swap-file-size:,syslinux-theme:,
win32-loader:,source:,source-images:,breakpoints,conffile:,debug,force,
help,ignore-system-defaults,quiet,usage,verbose,version,bootstrap-qemu-static:,bootstrap-qemu-arch:,
bootstrap-qemu-exclude:"
@@ -748,6 +749,11 @@ Local_arguments ()
shift 2
;;
+ --firmware-binary)
+ LB_FIRMWARE_BINARY="${2}"
+ shift 2
+ ;;
+
--swap-file-path)
LB_SWAP_FILE_PATH="${2}"
shift 2
@@ -1393,6 +1399,10 @@ LB_NET_COW_SERVER="${LB_NET_COW_SERVER}"
# (Default: ${LB_NET_TARBALL})
LB_NET_TARBALL="${LB_NET_TARBALL}"
+# \$LB_FIRMWARE_BINARY: include firmware packages in debian-installer
+# (Default: ${LB_FIRMWARE_BINARY})
+LB_FIRMWARE_BINARY="${LB_FIRMWARE_BINARY}"
+
# \$LB_SWAP_FILE_PATH: set swap file path
# (Default: ${LB_SWAP_FILE_PATH})
LB_SWAP_FILE_PATH="${LB_SWAP_FILE_PATH}"