forked from starostinak/rm_reads
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from gtamazian/binary-package
Routines and fixes for bionary packages
- Loading branch information
Showing
4 changed files
with
94 additions
and
18 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
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
set -o pipefail | ||
|
||
if [ $# -lt 1 ]; then | ||
echo Please specify the output file name. | ||
echo For example: ./create_package ~/Desktop/cookiecutter_osx.tar.gz | ||
exit 1 | ||
fi | ||
|
||
OUTPUT_FILE="$1" | ||
PACKAGE_NAME=$( basename "$OUTPUT_FILE" ) | ||
PACKAGE_NAME=$( echo "$PACKAGE_NAME" | sed "s/\..*//" ) | ||
|
||
TEMPDIR=$( mktemp -d "/tmp/${PACKAGE_NAME}.XXXXXX" ) || exit 1 | ||
|
||
# compile binary files | ||
cd src | ||
make | ||
cd .. | ||
|
||
# copy executable files | ||
mkdir "${TEMPDIR}/bin" | ||
for FILE in cookiecutter extract remove separate rm_reads; do | ||
cp "./src/${FILE}" "${TEMPDIR}/bin/${FILE}" | ||
done | ||
|
||
# copy demo and data directories | ||
for DIR in data demo; do | ||
cp -R "$DIR" "${TEMPDIR}/${DIR}" | ||
done | ||
|
||
# adjust the path for executable files in the demo script | ||
sed -i "s#default='.'#default='..\/bin/'#" \ | ||
${TEMPDIR}/demo/run_demo_analysis.py | ||
|
||
# copy LICENSE and README files | ||
for FILE in LICENSE README.md; do | ||
cp "$FILE" "${TEMPDIR}/${FILE}" | ||
done | ||
|
||
# create a gzipped TAR archive | ||
TEMPFILE=$( tempfile ) | ||
tar -C "/tmp" -cvf "${TEMPFILE}.tar" $( basename "$TEMPDIR" ) | ||
gzip -9 "${TEMPFILE}.tar" | ||
mv "${TEMPFILE}.tar.gz" "$OUTPUT_FILE" | ||
|
||
# remove compiled files | ||
cd src | ||
make clean | ||
cd .. | ||
|
||
rm -r "$TEMPDIR" | ||
|
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