diff --git a/SOURCES/testfile b/SOURCES/testfile deleted file mode 100644 index e69de29..0000000 diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..713b8ef --- /dev/null +++ b/src/Makefile @@ -0,0 +1,28 @@ +#============================================================================ +# Title : Makefile +# Description : Makefile for asmdisks +# Author : Bart Sjerps +# License : GPLv3+ +# --------------------------------------------------------------------------- + +prefix = /usr/local +bindir = $(prefix)/bin +mandir = $(prefix)/share/man +docdir = $(prefix)/share/doc + +sysconfdir = /etc + +all: + +install: + install -d 0755 $(bindir) + install -d 0755 $(sysconfdir)/bash_completion.d + install -d 0755 $(mandir)/man1 + install -d 0755 $(docdir) + 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)/ + +.PHONY: install + diff --git a/src/bin/asm b/src/bin/asm new file mode 100755 index 0000000..aee101c --- /dev/null +++ b/src/bin/asm @@ -0,0 +1,561 @@ +#!/bin/bash +#============================================================================ +# Title : asm +# Description : Manage disks and volumes for Oracle ASM +# Author : Bart Sjerps +# License : GPLv3+ +# --------------------------------------------------------------------------- +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License at for +# more details. +# --------------------------------------------------------------------------- +# Revision history: +# 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) +# 2017-09-13 : AWK Bugfix for SCSI id's starting with '0' +# 2017-03-14 : ScaleIO support +# 2017-01-30 : bugfix for rename +# 2016-11-09 : DSSD udev bugfix +# 2016-10-19 : Overhaul, many fixes and improvements +# 2016-09-11 : EL7 support, bootdisk detection & tempdir usage +# 2016-08-18 : Added EMC DSSD support, output for larger volume sizes +# 2015-03-10 : Support for EMC Powerpath +# 2015-03-05 : Rewrite of listdisks & create, added multi option +# 2015-02-24 : Added TAB separator option for scripting, small bugfix +# 2014-11-06 : Added import, rename and -h/-? option +# 2014-10-22 : Created +# --------------------------------------------------------------------------- +# Additional info: +# Man page: : Yes +# Bash completion : Yes +#============================================================================ +# Configuration parameters: +# --------------------------------------------------------------------------- + +rulesfile=/etc/udev/rules.d/99-asm.rules + +# Ensure it works from a scripted or remote ssh environment +export PATH=$PATH:/sbin + +#============================================================================ +# Initialization - Logging - Etc. +# --------------------------------------------------------------------------- + +# Create temporary workdir - cleanup the mess when script ends good or bad +readonly WORKDIR=$(/bin/mktemp --tmpdir -d) +cleanup() { /bin/rm -rf ${WORKDIR:-/none} ; exit ${rc:-99} ; } +trap "cleanup" EXIT INT TERM HUP + +#============================================================================ +# Usage: +# --------------------------------------------------------------------------- +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