forked from jkstill/oracle-script-lib
-
Notifications
You must be signed in to change notification settings - Fork 6
/
distribution.sh
executable file
·99 lines (73 loc) · 2.01 KB
/
distribution.sh
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
:
SQLDIR=/home/jkstill/oracle/oracle-script-lib/sql
TARFILE=~/ftp/sql_scripts.tar
ZIPFILE=~/ftp/sql_scripts_windows.zip
rm -f ${TARFILE}.gz
FILES=$(grep ^@ INDEX*| cut -f2 -d@ | cut -f1 -d:)
cd $SQLDIR || {
echo Could not chdir to $SQLDIR
exit 3
}
# maintain symlinks as needed
for f in $(grep ^@ ../INDEX.ashmasters| cut -f2 -d@ | cut -f1 -d:)
do
ln -s ../../ashmasters/$f . 2>/dev/null
done
# no longer getting snapper due to licensing - does not allow public distribution
# get current version of snapper from Tanel Poder
#wget http://blog.tanelpoder.com/files/scripts/snapper.sql
#wget http://blog.tanelpoder.com/files/scripts/snapper4.sql
# remove old backup copies of snapper that were created by wget - keep one available
#rm -f snapper.sql.[2-9]
#rm -f snapper4.sql.[2-9]
# get current version of ashtop from Tanel Poder
#wget http://blog.tanelpoder.com/files/scripts/ashtop.sql
wget https://github.com/tanelpoder/tpt-oracle/blob/master/ash/ashtop.sql
# remove old backup copies of snapper that were created by wget - keep one available
rm -f ashtop.sql.[2-9]
# h dereferences symbolic links and gets the file instead of the link
CMD="tar chvf $TARFILE ../INDEX* $FILES"
#echo CMD:$CMD
$CMD
gzip $TARFILE
echo
TARFILE=${TARFILE}.gz
echo created ${TARFILE}
echo
TMPDIR=/tmp/sqldist.$$
mkdir $TMPDIR
cd $TMPDIR || {
echo Could not chdir to $TMPDIR
exit 1
}
tar xvfz $TARFILE
unix2dos *.sql
unix2dos INDEX
zip $ZIPFILE INDEX* *.sql
rm -f $TMPDIR/INDEX*
rm -f $TMPDIR/*.sql
rm -f $TMPDIR/distribution.sh
cd
rmdir $TMPDIR
: <<'JKS-DOC'
# skipping dropbox
dropboxDir=/home/jkstill/Dropbox/Public/oracle/SQL-Library
echo
echo Copying files to Dropbox - $dropboxDir
echo Make sure Dropbox is running
echo Start as jkstill with 'nohup ~/.dropbox-dist/dropboxd &'
echo
[ -d "$dropboxDir" ] || {
echo
echo Cannot copy to dropbox - please start the dropbox daemon
echo
echo eg. ~/.dropbox-dist/dropboxd
echo
exit 1
}
cp $TARFILE $dropboxDir
cp $ZIPFILE $dropboxDir
JKS-DOC
echo Files:
echo " $TARFILE"
echo " $ZIPFILE"