-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload.sh
executable file
·44 lines (38 loc) · 1.43 KB
/
upload.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
BASE_URL="https://archipel.labolyon.fr/"
echo "Statrting site update archipel.labolyon.fr"
echo "
{
\"@context\": {\"@vocab\": \"http://schema.org/\", \"@language\": \"fr\"},
\"@type\": \"UpdateAction\",
\"result\": \"Site mise à jour\",
\"agent\": {
\"@type\": \"Person\",
\"name\": \"$(whoami)\"
},
\"object\": {\"@id\": \"$BASE_URL\"},
\"endTime\": \"$(date +"%Y-%m-%dT%H:%M:%S%z")\"
}
" > archipel.labolyon.fr/last-update.json
for filename in $(find ./archipel.labolyon.fr/ -type f | grep -v .git); do
fileurl="$BASE_URL${filename#'./archipel.labolyon.fr/'}"
mimetype=$(file --mime-type "$filename" | cut -d' ' -f2)
echo "$filename" "$mimetype"
curl -n -X PUT --data-binary "@$filename" --header "Content-Type: $mimetype" "$fileurl"
done
echo "Starting site update archipelproject.net"
BASE_URL="https://archipelproject.net/"
echo "
{
\"@context\": {\"@vocab\": \"http://schema.org/\", \"@language\": \"fr\"},
\"@type\": \"UpdateAction\",
\"result\": \"Site mise à jour\",
\"agent\": {
\"@type\": \"Person\",
\"name\": \"$(whoami)\"
},
\"object\": {\"@id\": \"$BASE_URL\"},
\"endTime\": \"$(date +"%Y-%m-%dT%H:%M:%S%z")\"
}
" > archipelproject.net/last-update.json
rsync -av --exclude=".*" archipelproject.net/* epickiwi@archipelproject.net:/var/www/archipelproject.net/
echo "Last update by $(whoami), report available at ${BASE_URL}last-update.json"