diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ca365aa --- /dev/null +++ b/.gitignore @@ -0,0 +1,36 @@ +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +# Archives +*.zip + +# Swap files +*.swp + diff --git a/SPECS/asmdisks.spec b/asmdisks.spec similarity index 89% rename from SPECS/asmdisks.spec rename to asmdisks.spec index 99d6f42..a436472 100644 --- a/SPECS/asmdisks.spec +++ b/asmdisks.spec @@ -1,6 +1,6 @@ Name: asmdisks Summary: Replacement for Oracle ASMLib using UDEV -Version: 1.4.4 +Version: 1.4.5 Release: 1%{?prerel:.~%prerel} BuildArch: noarch License: GPLv3+ @@ -25,7 +25,7 @@ Also supports EMC Powerpath and EMC DSSD volumes. rm -rf %{buildroot} mkdir %{buildroot} -%makeinstall +%make_install %files %defattr(0444,root,root) @@ -33,9 +33,7 @@ mkdir %{buildroot} %doc /usr/share/doc/%{name}/README %defattr(0644,root,root) /etc/bash_completion.d/asm.bash -/usr/share/man/man1/asm.1.gz -/usr/share/man/man1/asmstat.1.gz -/usr/share/man/man1/wipedisk.1.gz +/usr/share/man/man1/*.gz %defattr(0755,root,root) /usr/bin/asm /usr/bin/asmstat diff --git a/src/Makefile b/src/Makefile index 0359e2b..5d70374 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,35 +4,37 @@ # Author : Bart Sjerps # License : GPLv3+ # --------------------------------------------------------------------------- +NAME := $(RPM_PACKAGE_NAME) +VERSION = $(shell rpm -q --qf '%{version}\n' --specfile ../$(NAME).spec) +SRCDIR = $(shell rpm --eval %_sourcedir) -version = 1.4.4 -prefix = /usr/local -bindir = $(prefix)/bin -mandir = $(prefix)/share/man -docdir = $(prefix)/share/doc +files := $(shell find files/ -type f | cut -d/ -f2-) +dirs := $(shell find files/ -type d | cut -d/ -f2-) -sysconfdir = /etc +man1 = $(wildcard bin/*) +man8 = $(wildcard sbin/*) -all: - -src: - tar -jcvf $(HOME)/SOURCES/asmdisks-$(version).tbz2 --transform "s|^|asmdisks/|" * +man1dir = $(DESTDIR)/usr/share/man/man1 +man8dir = $(DESTDIR)/usr/share/man/man8 -rpm: src - cd ../SPECS ; rpmbuild -ba asmdisks.spec +.PHONY: all install man -install: - install -d 0755 $(bindir) - install -d 0755 $(sysconfdir)/bash_completion.d - install -d 0755 $(mandir)/man1 - install -d 0755 $(docdir)/asmdisks - install -m 0755 bin/asm bin/asmstat bin/diskheader bin/wipedisk $(bindir) - install -m 0644 bin/asm.bash $(sysconfdir)/bash_completion.d - install -m 0644 man/* $(mandir)/man1/ - install -m 0444 doc/* $(docdir)/asmdisks/ - -clean: - rm $(HOME)/SOURCES/asmdisks-$(version).tbz2 +all: -.PHONY: install +man: + install -m 0755 -d $(man1dir) + install -m 0755 -d $(man8dir) + $(foreach exe,$(man1),$(exe) --mandump > $(man1dir)/$(notdir $(exe)).1 ;echo mandump $(exe);) + $(foreach exe,$(man8),$(exe) --mandump > $(man8dir)/$(notdir $(exe)).8 ;echo mandump $(exe);) + find $(man1dir) $(man8dir) -type f | xargs -L1 gzip + +install: man + install -d 0755 $(DESTDIR)/usr/bin + install -d 0755 $(DESTDIR)/usr/share/doc/asmdisks + + install -m 0755 -pt $(DESTDIR)/usr/bin bin/* + install -m 0755 -pt $(DESTDIR)/usr/share/doc/asmdisks doc/* + + for d in $(dirs); do install -m 0755 -d $(DESTDIR)/$$d ; done + for f in $(files); do install -m 0644 -pt $(DESTDIR)/$$(dirname $$f)/ files/$$f ; done diff --git a/src/bin/asm b/src/bin/asm index aee101c..eb33ff2 100755 --- a/src/bin/asm +++ b/src/bin/asm @@ -3,6 +3,8 @@ # Title : asm # Description : Manage disks and volumes for Oracle ASM # Author : Bart Sjerps +# Version : 1 +# Manual : asmdisks # License : GPLv3+ # --------------------------------------------------------------------------- # This program is free software: you can redistribute it and/or modify @@ -17,6 +19,7 @@ # more details. # --------------------------------------------------------------------------- # Revision history: +# 2018-08-20 : Embedded manpage # 2018-04-06 : Add $PATH to support remote and scripted execution # 2017-12-14 : Bugfix for import function # 2017-10-04 : Bugfix for SCSI id's with whitespace (Linux TGTD) @@ -33,9 +36,6 @@ # 2014-11-06 : Added import, rename and -h/-? option # 2014-10-22 : Created # --------------------------------------------------------------------------- -# Additional info: -# Man page: : Yes -# Bash completion : Yes #============================================================================ # Configuration parameters: # --------------------------------------------------------------------------- @@ -59,24 +59,266 @@ trap "cleanup" EXIT INT TERM HUP # --------------------------------------------------------------------------- usage() { cat <<- EOF - Usage: $(basename $0) [-n] [-t] - - -n - no headings - -t - use TAB separator (for scripting) instead of column formatted (implies -n) - - Actions: - createdisk