diff --git a/netboot/Makefile b/netboot/Makefile index af7521b1..2c847758 100644 --- a/netboot/Makefile +++ b/netboot/Makefile @@ -2,16 +2,27 @@ include ../common.mak +SCRIPTS = mk-s390image mk-pxelinux-ramfs NETBOOT_SAMPLEDIR=$(TOOLS_DATADIR)/netboot all: -install: all - $(INSTALL) -d -m 755 $(DESTDIR)$(NETBOOT_SAMPLEDIR) - $(INSTALL) -m 755 mk-s390image mk-pxelinux-ramfs \ - $(DESTDIR)$(NETBOOT_SAMPLEDIR) - $(INSTALL) -m 644 Dockerfile Makefile.pxelinux.0 README.md \ - mk-s390image.1 \ +install: install-scripts + $(INSTALL) -g $(GROUP) -o $(OWNER) -m 644 \ + Dockerfile Makefile.pxelinux.0 README.md mk-s390image.1 \ $(DESTDIR)$(NETBOOT_SAMPLEDIR) -.PHONY: all install clean +install-scripts: $(SCRIPTS) + @if [ ! -d $(DESTDIR)$(NETBOOT_SAMPLEDIR) ]; then \ + mkdir -p $(DESTDIR)$(NETBOOT_SAMPLEDIR); \ + chown $(OWNER).$(GROUP) $(DESTDIR)$(NETBOOT_SAMPLEDIR); \ + chmod 755 $(DESTDIR)$(NETBOOT_SAMPLEDIR); \ + fi; \ + for i in $^; do \ + $(SED) -e 's/%S390_TOOLS_VERSION%/$(S390_TOOLS_RELEASE)/' \ + < $$i >$(DESTDIR)$(NETBOOT_SAMPLEDIR)/$$i; \ + chown $(OWNER).$(GROUP) $(DESTDIR)$(NETBOOT_SAMPLEDIR)/$$i; \ + chmod 755 $(DESTDIR)$(NETBOOT_SAMPLEDIR)/$$i; \ + done + +.PHONY: all install clean install-scripts diff --git a/netboot/mk-pxelinux-ramfs b/netboot/mk-pxelinux-ramfs index cb0c28ee..64ebde1c 100755 --- a/netboot/mk-pxelinux-ramfs +++ b/netboot/mk-pxelinux-ramfs @@ -54,9 +54,18 @@ OPTIONS -b Search installed busybox in directory BUSYBOX_DIR -k Use KERNEL_VERSION instead of currently running kernel -h Print this help, then exit +-v Print version information, then exit EOF } +printversion() +{ + cat <<-EOD + $cmd: version %S390_TOOLS_VERSION% + Copyright IBM Corp. 2017 + EOD +} + # Get shared objects for binary sharedobjs() { @@ -64,7 +73,7 @@ sharedobjs() } # Check args -args=$(getopt b:k:h $*) +args=$(getopt b:k:hv $*) if [ $? = 0 ] then set -- $args @@ -74,6 +83,7 @@ then -b) busyboxdir=$2; shift 2;; -k) kernelversion=$2; shift 2;; -h) usage; exit 0;; + -v) printversion; exit 0;; --) shift; break;; *) echo "$cmd: Unexpected argument $1, exiting..." >&2; exit 1;; esac diff --git a/netboot/mk-s390image b/netboot/mk-s390image index 7083d976..341221da 100755 --- a/netboot/mk-s390image +++ b/netboot/mk-s390image @@ -60,9 +60,18 @@ OPTIONS -p Use PARMFILE with kernel parameters in the image -r Include RAMDISK in the image -h Print this help, then exit +-v Print version information, then exit EOF } +printversion() +{ + cat <<-EOD + $cmd: version %S390_TOOLS_VERSION% + Copyright IBM Corp. 2017 + EOD +} + # Convert decimal number to big endian doubleword dec2be64() { @@ -145,7 +154,7 @@ dobuild() } # check args and build -args=$(getopt "r:p:h" $*) +args=$(getopt "r:p:hv" $*) if [ $? = 0 ] then set -- $args @@ -155,6 +164,7 @@ then -r) ramdisk=$2; shift 2;; -p) parmfile=$2; shift 2;; -h) usage; exit 0;; + -v) printversion; exit 0;; --) shift; break;; *) echo "$cmd: Unexpected argument $1, exiting..." >&2; exit 1;; esac