This repository was archived by the owner on Mar 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuploadbeta
executable file
·65 lines (59 loc) · 1.76 KB
/
uploadbeta
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
#!/usr/bin/env bash
# Usage:
# uploadbeta [release] [cleanup]
# default values
USERNAME=${2:-$LOGNAME}
DEFAULT_RELEASE="2.6.3.B1"
RELEASE=${1:-$DEFAULT_RELEASE}
HOST="[email protected]"
DIR="/var/www/www.tiddlywiki.com/htdocs"
OWNER="www-data:www-data"
PERM="664"
# 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
FILES="empty.$RELEASE.html compressed.$RELEASE.html index.$RELEASE.html index.$RELEASE.xml TiddlySaver.jar"
scp $FILES "$HOST:./tmp/"
# transfer files to their respective folders
echo
echo "transferring files"
echo
COMMANDS="ssh $HOST"
# Empty
COMMANDS="$COMMANDS sudo cp ./tmp/empty.$RELEASE.html $DIR/beta/empty.html;"
setPermissions "$DIR/beta/empty.html"
# Compressed
COMMANDS="$COMMANDS sudo mv ./tmp/compressed.$RELEASE.html $DIR/beta/compressed.html;"
setPermissions "$DIR/beta/compressed.html"
# Index
COMMANDS="$COMMANDS sudo mv ./tmp/index.$RELEASE.html $DIR/beta/index.html;"
setPermissions "$DIR/beta/index.html"
# RSS
COMMANDS="$COMMANDS sudo mv ./tmp/index.$RELEASE.xml $DIR/beta/index.xml;"
setPermissions "$DIR/beta/index.xml"
# Upgrade
COMMANDS="$COMMANDS sudo mv ./tmp/empty.$RELEASE.html $DIR/beta/upgrade.html;"
setPermissions "$DIR/beta/upgrade.html"
# TiddlySaver
COMMANDS="$COMMANDS sudo mv ./tmp/TiddlySaver.jar $DIR/beta/TiddlySaver.jar;"
setPermissions "$DIR/beta/TiddlySaver.jar"
# execute
$COMMANDS
# cleanup
if [ "$2" = "true" ]; then
echo "cleaning up (removing cooked files)"
echo "removing index.$RELEASE.html"
rm "index.$RELEASE.html"
echo "removing empty.$RELEASE.html"
rm "empty.$RELEASE.html"
echo "removing TiddlySaver.jar"
rm "TiddlySaver.jar"
fi