-
Notifications
You must be signed in to change notification settings - Fork 3
/
package.sh
executable file
·35 lines (28 loc) · 996 Bytes
/
package.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
#!/bin/bash
# Variables
remote_destination="/var/www/html/crunchtools.com/wp-content/files/crunchtools"
copy_latest() {
echo "Copying $1.${version}.tgz to server"
scp $1.${version}.tgz scott@crunchtools.com:$remote_destination/$1
if [ `ssh scott@crunchtools.com "ls -tr $remote_destination/$1 | tail -n 1"` == beaver.${version}.tgz ]
then
echo "Success"
fi
}
link_latest() {
latest_version=`ssh scott@crunchtools.com "ls $remote_destination/$1/* | grep -v current | tail -n 1"`
echo "Latest Version: $latest_version"
ssh scott@crunchtools.com ln -fs $latest_version $remote_destination/$1/$1-current.$2
latest_link=`ssh scott@crunchtools.com "ls -ltrh $remote_destination/$1 | tail -n 1"`
echo "Latest Link: $latest_link"
}
if [ "$1" == "beaver" ]
then
hg update beaver
version=`cat beaver/version`
tar cvvzf beaver.${version}.tgz beaver/
copy_latest beaver
link_latest beaver tgz
else
echo "No package specified"
fi