forked from MetOffice/socrates
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_tar
More file actions
executable file
·53 lines (42 loc) · 1.39 KB
/
make_tar
File metadata and controls
executable file
·53 lines (42 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#! /bin/bash
# Script to make a tar file for external distribution.
stamp=`date +_%y%m`
ESTMP=/tmp
DISTDIR=`pwd`
while [ $# -gt 0 ]
do case $1 in
-d) DISTDIR=$2 ; shift 2 ;;
*) shift ;;
esac
done
MANPATH=./man:$MANPATH
export MANPATH
echo 'Creating tar file of radiation code for external distribution.'
mkdir ${ESTMP}/socrates${stamp}
# Copy package files
cp -r sbin data docs examples idl python man src make ${ESTMP}/socrates${stamp}/
cp README.md CONTRIBUTORS.md COPYRIGHT.txt build_code ${ESTMP}/socrates${stamp}/
# Update _version.txt file
git log -1 > ${ESTMP}/socrates${stamp}/_version.txt
# Remove unwanted files
cd ${ESTMP}/socrates${stamp}/ && find . -name *~ -exec rm -f {} \;
cd ${ESTMP}/socrates${stamp}/ && find . -name \.git* -exec rm -rf {} \; 2> /dev/null
echo 'Building documentation pdfs.'
cd ${ESTMP}/socrates${stamp}/docs/techguide
. ${ESTMP}/socrates${stamp}/docs/techguide/lx > /dev/null
mv socrates_techguide.pdf ../.
cd ..
rm -rf techguide
cd ${ESTMP}/socrates${stamp}/docs/userguide
. ${ESTMP}/socrates${stamp}/docs/userguide/lx > /dev/null
mv socrates_userguide.pdf ../.
cd ..
rm -rf userguide
echo 'Packaging distribution...'
cd ${ESTMP}
tar cJf socrates${stamp}.tar.xz socrates${stamp}/
mv ${ESTMP}/socrates${stamp}.tar.xz ${DISTDIR}/.
echo "Created file ${DISTDIR}/socrates${stamp}.tar.xz"
# Remove tmp directory
rm -rf ${ESTMP}/socrates${stamp} 2> /dev/null
exit 0