downloads/sbupdate-title
... ...
@@ -0,0 +1,56 @@
1
+#!/usr/bin/env bash
2
+#
3
+# key 8ec1aa8 2023-08-15 10:40:31 -0400
4
+
5
+arch=$1
6
+title=$2
7
+
8
+if [ $# -eq 0 ] ; then
9
+ echo "usage: sbupdate-title <x86_64-linux || i386-mac> <application name>"
10
+ exit 0
11
+else
12
+ echo "Updating ${arch}/${title}"
13
+fi
14
+
15
+if [ -e ${HOME}/.sbgridrc ] ; then
16
+ SYNC_SERVER="sync.sbgrid.org"
17
+ source ${HOME}/.sbgridrc
18
+else
19
+ echo "${HOME}/.sbgridrc not found. This script cannot continue"
20
+ exit 1
21
+fi
22
+
23
+if [ $(uname) == "Linux" ] ; then
24
+ rsync_cmd="${INSTALL_TARGET}/x86_64-linux/system/rsync/current/bin/rsync"
25
+elif [ $(uname) == "Darwin" ] ; then
26
+ rsync_cmd="${INSTALL_TARGET}/i386-mac/system/rsync/current/bin/rsync"
27
+else
28
+ echo "Unsupported OS. Exiting"
29
+ exit 0
30
+fi
31
+
32
+if [ ! -x "${rsync_cmd}" ] ; then
33
+ echo "Cannot find a usable rync. Exiting."
34
+ exit 1
35
+elif [ ! -e "${INSTALL_TARGET}" ] ; then
36
+ echo "Cannot find installation target. Exiting."
37
+ exit 1
38
+else
39
+ export RSYNC_PASSWORD="${SB_SITEKEY}"
40
+ export USER="${SB_SITENAME}"
41
+ logdir="$HOME/.sbgrid/logs"
42
+
43
+ mkdir -p ${logdir}
44
+ mkdir -p "/${INSTALL_TARGET}/${arch}/${title}/"
45
+
46
+ now=$(date +%Y%m%d)
47
+ rsync_args="-zrlptODPv --log-file=${logdir}/sbgrid-admin-${now}.log --delete-during"
48
+ ${rsync_cmd} ${rsync_args} "rsync://$SYNC_SERVER/$SB_SITENAME/main/programs/${arch}/${title}/" "/${INSTALL_TARGET}/${arch}/${title}/"
49
+
50
+ if [ $? != 0 ] ; then
51
+ echo "Update likely failed"
52
+ echo "Please send ${logdir}/sbgrid-admin-${now}.log to bugs@sbgrid.org with a breif description of your issue."
53
+ else
54
+ echo "Update successful"
55
+ fi
56
+fi