-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Allow for Linux distribution and feature selection
Prepare for supporting multiple Linux distributions by making all features conditional and defining configurable options for feature selection. Provide the ability to enable all features for a particular Linux distribution, and attempt to autodetect the distribution on which the package is being built. Signed-off-by: Michael Brown <[email protected]>
- Loading branch information
Showing
5 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,76 @@ | ||
# Configure autoconf | ||
# | ||
AC_INIT([sanbootable], [0.1], [[email protected]]) | ||
AC_CONFIG_SRCDIR([src/initramfs/iscsi.initramfs]) | ||
AC_CONFIG_AUX_DIR([build-aux]) | ||
AM_INIT_AUTOMAKE([foreign subdir-objects tar-ustar]) | ||
|
||
# Define distribution selections | ||
# | ||
AC_ARG_ENABLE([ubuntu], | ||
AS_HELP_STRING([--enable-ubuntu], | ||
[enable all Ubuntu features])) | ||
|
||
# Define individual feature selections | ||
# | ||
AC_ARG_ENABLE([finalrd], | ||
AS_HELP_STRING([--disable-finalrd], | ||
[disable finalrd hook])) | ||
AC_ARG_ENABLE([grub-initrd-fallback], | ||
AS_HELP_STRING([--disable-grub-initrd-fallback], | ||
[disable GRUB initrd fallback hook])) | ||
AC_ARG_ENABLE([initramfs], | ||
AS_HELP_STRING([--disable-initramfs], | ||
[disable initramfs hook])) | ||
|
||
# Determine current distribution if none explicitly specified | ||
# | ||
AS_IF([test "x$enable_ubuntu" = "x"], [ | ||
AS_IF([test -e /etc/lsb-release], [source /etc/lsb-release]) | ||
AS_IF(AS_EXECUTABLE_P([/usr/bin/lsb_release]), | ||
[DISTRIB_ID=$(/usr/bin/lsb_release -s -i)]) | ||
AS_IF([test "x$DISTRIB_ID" = "xUbuntu"], [default_ubuntu=yes]) | ||
]) | ||
|
||
# Test for individual distribution selections | ||
# | ||
AS_IF([test "x$enable_ubuntu" = "x"], | ||
[enable_ubuntu=$default_ubuntu]) | ||
|
||
# Disable all features by default | ||
# | ||
default_finalrd=no | ||
default_grub_initrd_fallback=no | ||
default_initramfs=no | ||
|
||
# Set feature defaults per distribution | ||
# | ||
AS_IF([test "x$enable_ubuntu" = "xyes"], [ | ||
default_finalrd=yes | ||
default_grub_initrd_fallback=yes | ||
default_initramfs=yes | ||
]) | ||
|
||
# Test for individual feature selections | ||
# | ||
AS_IF([test "x$enable_finalrd" = "x"], | ||
[enable_finalrd=$default_finalrd]) | ||
AS_IF([test "x$enable_grub_initrd_fallback" = "x"], | ||
[enable_grub_initrd_fallback=$default_grub_initrd_fallback]) | ||
AS_IF([test "x$enable_initramfs" = "x"], | ||
[enable_initramfs=$default_initramfs]) | ||
|
||
# Define automake conditionals | ||
# | ||
AM_CONDITIONAL([FINALRD], | ||
[test "x$enable_finalrd" = "xyes"]) | ||
AM_CONDITIONAL([GRUBINITRDFALLBACK], | ||
[test "x$enable_grub_initrd_fallback" = "xyes"]) | ||
AM_CONDITIONAL([INITRAMFS], | ||
[test "x$enable_initramfs" = "xyes"]) | ||
|
||
# Generate output files | ||
# | ||
AC_CONFIG_FILES([ | ||
Makefile | ||
src/Makefile | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
if FINALRD | ||
|
||
finalrddir = @datadir@/finalrd | ||
|
||
dist_finalrd_SCRIPTS = open-iscsi-sanbootable.finalrd | ||
|
||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
if GRUBINITRDFALLBACK | ||
|
||
grubinitrdfallbackdir = @prefix@/lib/systemd/system/grub-initrd-fallback.service.d | ||
|
||
dist_bin_SCRIPTS = initrdfail-sanbootable | ||
|
||
dist_grubinitrdfallback_DATA = initrdfail-sanbootable.conf | ||
|
||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
if INITRAMFS | ||
|
||
iscsiconfdir = @sysconfdir@/iscsi | ||
|
||
dist_iscsiconf_SCRIPTS = iscsi.initramfs | ||
|
||
endif |