forked from TiddlyWiki/TiddlyWikiClassic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uploadalpha
executable file
·56 lines (51 loc) · 1.96 KB
/
uploadalpha
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
#!/usr/bin/env bash
# Usage:
# uploadalpha [release] [username]
# default values
USERNAME=${2:-$LOGNAME}
DEFAULT_RELEASE=`cat ALPHA`
RELEASE=${1:-$DEFAULT_RELEASE}
HOST="$USERNAME@tiddlywiki.com"
DIR="/var/www/www.tiddlywiki.com/htdocs"
OWNER="www-data:www-data"
PERM="664"
TW_DIR="cooked"
# setPermissions()
# Usage:
# setPermissions file
function setPermissions() {
COMMANDS="$COMMANDS sudo chown $OWNER $1;"
COMMANDS="$COMMANDS sudo chmod $PERM $1;"
}
# upload files to temporary folder
echo
echo "uploading files"
echo
cd
FILES="$TW_DIR/tiddlywiki.$RELEASE.html $TW_DIR/tiddlywiki_compressed.$RELEASE.html $TW_DIR/tiddlywiki_externaljs.$RELEASE.html $TW_DIR/tiddlywiki_externaljs_tiddlyspace.$RELEASE.html $TW_DIR/twcore.$RELEASE.js jquery/jquery.js jquery/plugins/jQuery.twStylesheet.js"
scp $FILES "$HOST:./tmp/"
# transfer files to their respective folders
echo
echo "transferring files"
echo
stty -echo
COMMANDS="ssh $HOST"
# Empty
COMMANDS="$COMMANDS sudo cp ./tmp/tiddlywiki.$RELEASE.html $DIR/alpha/empty.html;"
setPermissions "$DIR/alpha/empty.html"
# Compressed
COMMANDS="$COMMANDS sudo mv ./tmp/tiddlywiki_compressed.$RELEASE.html $DIR/alpha/tiddlywiki_compressed.html;"
setPermissions "$DIR/alpha/tiddlywiki_compressed.html"
COMMANDS="$COMMANDS sudo mv ./tmp/tiddlywiki_externaljs.$RELEASE.html $DIR/alpha/tiddlywiki_externaljs.html;"
setPermissions "$DIR/alpha/tiddlywiki_externaljs.html"
COMMANDS="$COMMANDS sudo mv ./tmp/tiddlywiki_externaljs_tiddlyspace.$RELEASE.html $DIR/alpha/tiddlywiki_externaljs_tiddlyspace.html;"
setPermissions "$DIR/alpha/tiddlywiki_externaljs_tiddlyspace.html"
COMMANDS="$COMMANDS sudo mv ./tmp/twcore.$RELEASE.js $DIR/alpha/twcore.js;"
setPermissions "$DIR/alpha/twcore.js"
COMMANDS="$COMMANDS sudo mv ./tmp/jquery.js $DIR/alpha/jquery.js;"
setPermissions "$DIR/alpha/jquery.js"
COMMANDS="$COMMANDS sudo mv ./tmp/jQuery.twStylesheet.js $DIR/alpha/jQuery.twStylesheet.js;"
setPermissions "$DIR/alpha/jQuery.twStylesheet.js"
# execute
$COMMANDS
stty echo