From 2844f684662423ef15761eb5ff832a825994082a Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Thu, 26 May 2016 17:51:14 +0200 Subject: [PATCH] Rename and add orig script --- build_orig.sh | 83 ++++++++++++++++++++++ README.source => debian/README.source | 0 changelog => debian/changelog | 0 compat => debian/compat | 0 control => debian/control | 0 copyright => debian/copyright | 0 dirs => debian/dirs | 0 docs => debian/docs | 0 megacli.wrapper => debian/megacli.wrapper | 0 rules => debian/rules | 8 +-- {source => debian/source}/format | 0 user_guide.pdf => debian/user_guide.pdf | Bin files.diz | 2 + 13 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 build_orig.sh rename README.source => debian/README.source (100%) rename changelog => debian/changelog (100%) rename compat => debian/compat (100%) rename control => debian/control (100%) rename copyright => debian/copyright (100%) rename dirs => debian/dirs (100%) rename docs => debian/docs (100%) rename megacli.wrapper => debian/megacli.wrapper (100%) rename rules => debian/rules (61%) rename {source => debian/source}/format (100%) rename user_guide.pdf => debian/user_guide.pdf (100%) create mode 100644 files.diz diff --git a/build_orig.sh b/build_orig.sh new file mode 100644 index 0000000..7d817d0 --- /dev/null +++ b/build_orig.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# the directory of the script +DIR=`cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd` +echo "Working directory $DIR" + +# the temp directory used, within $DIR +WORK_DIR=`mktemp -d -p "$DIR"` +echo "Creating temp working directory $WORK_DIR" + +# deletes the temp directory +function cleanup { + rm -rf "$WORK_DIR" + echo "Deleted temp working directory $WORK_DIR" +} + +# register the cleanup function to be called on the EXIT signal +trap cleanup EXIT + +# Download Files specified in files.diz +while IFS=! read type app version outputfile url md5 +do + echo "Downloading $app Version: $version" + #use -O for output file. define $outputfile yourself + wget --no-check-certificate --tries=1 -O $DIR/../$outputfile --timeout=5 "$url" + # use $(..) instead of backticks. + calculated_md5=$(md5sum "$DIR/../$outputfile" | cut -f 1 -d " ") + # compare md5 + case "$calculated_md5" in + "$md5" ) + echo "$DIR/../$outputfile md5 ok" + ;; + *) + echo "$DIR/../$outputfile md5 NOT ok" + exit 1 + ;; + esac +done < "$DIR/files.diz" + +# Extract to specified dir and set some variables +while IFS=! read type app version outputfile url md5 +do + mkdir -p $WORK_DIR/${type} + pushd $WORK_DIR/${type} + unzip $DIR/../$outputfile + popd + mkdir -p $WORK_DIR/${app}-${version}/${type} + dos2unix $WORK_DIR/${type}/*.txt + mv $WORK_DIR/${type}/*.txt $WORK_DIR/${app}-${version} + pushd $WORK_DIR/${app}-${version}/${type} + rpm2cpio $WORK_DIR/${type}/Linux/*.rpm | cpio -idmv + case "${type}" in + "amd64" ) + rm -f opt/MegaRAID/MegaCli/MegaCli + ;; + "i386" ) + rm -f opt/MegaRAID/MegaCli/MegaCli64 + rm -f opt/MegaRAID/MegaCli/libstorelibir-2.so* + ;; + *) + echo "Wrong arch" + exit 1 + ;; + esac + echo "${app}_${version}.orig.tar.gz" > $WORK_DIR/filename.txt + echo "${app}-${version}" > $WORK_DIR/dirname.txt + echo "${version}" > $WORK_DIR/version.txt + popd +done < "$DIR/files.diz" + +FILENAME=`cat $WORK_DIR/filename.txt` +DIRNAME=`cat $WORK_DIR/dirname.txt` +echo "Creating $DIR/../$FILENAME " + +pushd $WORK_DIR +tar -czf $DIR/../$FILENAME $DIRNAME +popd + +VER=`cat $WORK_DIR/version.txt` +echo "Importing $DIR/../$FILENAME as $VER into git" +cleanup +gbp import-orig --pristine-tar -u $VER $DIR/../$FILENAME + +exit 0 diff --git a/README.source b/debian/README.source similarity index 100% rename from README.source rename to debian/README.source diff --git a/changelog b/debian/changelog similarity index 100% rename from changelog rename to debian/changelog diff --git a/compat b/debian/compat similarity index 100% rename from compat rename to debian/compat diff --git a/control b/debian/control similarity index 100% rename from control rename to debian/control diff --git a/copyright b/debian/copyright similarity index 100% rename from copyright rename to debian/copyright diff --git a/dirs b/debian/dirs similarity index 100% rename from dirs rename to debian/dirs diff --git a/docs b/debian/docs similarity index 100% rename from docs rename to debian/docs diff --git a/megacli.wrapper b/debian/megacli.wrapper similarity index 100% rename from megacli.wrapper rename to debian/megacli.wrapper diff --git a/rules b/debian/rules similarity index 61% rename from rules rename to debian/rules index ff6596c..7b09926 100755 --- a/rules +++ b/debian/rules @@ -21,13 +21,13 @@ install: build dh_installdirs install $(CURDIR)/debian/megacli.wrapper $(CURDIR)/debian/megacli/usr/sbin/megacli ifeq ($(DEB_BUILD_ARCH),amd64) - install $(CURDIR)/opt/MegaRAID/MegaCli/MegaCli64 $(CURDIR)/debian/megacli/usr/lib/megacli/megacli.real - install $(CURDIR)/opt/MegaRAID/MegaCli/libstorelibir-2.so.14.07-0 $(CURDIR)/debian/megacli/usr/lib/megacli/libstorelibir-2.so.14.07-0 + install $(CURDIR)/amd64/opt/MegaRAID/MegaCli/MegaCli64 $(CURDIR)/debian/megacli/usr/lib/megacli/megacli.real + install $(CURDIR)/amd64/opt/MegaRAID/MegaCli/libstorelibir-2.so.14.07-0 $(CURDIR)/debian/megacli/usr/lib/megacli/libstorelibir-2.so.14.07-0 endif ifeq ($(DEB_BUILD_ARCH),i386) - install $(CURDIR)/opt/MegaRAID/MegaCli/MegaCli $(CURDIR)/debian/megacli/usr/lib/megacli/megacli.real + install $(CURDIR)/i386/opt/MegaRAID/MegaCli/MegaCli $(CURDIR)/debian/megacli/usr/lib/megacli/megacli.real # Seem to be x64 only - #install $(CURDIR)/opt/MegaRAID/MegaCli/libstorelibir-2.so.14.07-0 $(CURDIR)/debian/megacli/usr/lib/megacli/libstorelibir-2.so.14.07-0 + #install $(CURDIR)/i386/opt/MegaRAID/MegaCli/libstorelibir-2.so.14.07-0 $(CURDIR)/debian/megacli/usr/lib/megacli/libstorelibir-2.so.14.07-0 endif binary-indep: diff --git a/source/format b/debian/source/format similarity index 100% rename from source/format rename to debian/source/format diff --git a/user_guide.pdf b/debian/user_guide.pdf similarity index 100% rename from user_guide.pdf rename to debian/user_guide.pdf diff --git a/files.diz b/files.diz new file mode 100644 index 0000000..89bf6ff --- /dev/null +++ b/files.diz @@ -0,0 +1,2 @@ +amd64!megacli!8.7.14.1!8-07-14_MegaCLI.zip!http://docs.avagotech.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/8-07-14_MegaCLI.zip!bf53eeb0e8ccc09c34f52d7035940c62 +i386!megacli!8.7.14.1!8-07-14_MegaCLI.zip!http://docs.avagotech.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/8-07-14_MegaCLI.zip!bf53eeb0e8ccc09c34f52d7035940c62