forked from v3io/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
igz-tutorials-get.sh
49 lines (43 loc) · 1.33 KB
/
igz-tutorials-get.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
45
46
47
48
#!/usr/bin/env bash
SCRIPT=${BASH_SOURCE[0]}
PRODUCT="Iguazio Data Science Platform"
GIT_REPO="https://github.com/v3io/tutorials.git"
USER=${V3IO_USERNAME}
USAGE="\
$SCRIPT:
Retrieves latest-release ${PRODUCT} tutorial files from the v3io/tutorials GitHub repo.
USAGE: ${SCRIPT} [<username>]
PARAMETERS:
<username> - Username, which determines the directory to which to copy the files - /v3io/users/<username>.
Default = \$V3IO_USERNAME (if set to a non-empty string)
OPTIONS:
h|--help - Display this message and exit."
while :
do
case $1 in
-h | --help) echo -e "$USAGE"; exit 0 ;;
-*) echo "$FUNCNAME: $1: Unknown option"; exit 1 ;;
*) break;
esac
shift
done
if [[ "$#" -eq 1 ]]; then
USER=${1}
else if [ -z ${USER} ]; then
echo -e "$USAGE"
exit 1
fi fi
DEST_DIR="/v3io/users/${USER}"
TEMP_DIR="${DEST_DIR}/temp-igz-tutorials"
# Get updated tutorials
echo "Updating ${PRODUCT} tutorial files in ${DEST_DIR} ..."
git clone ${GIT_REPO} ${TEMP_DIR}
echo "Copying files to ${DEST_DIR}..."
cp -rf ${TEMP_DIR}/getting-started ${DEST_DIR}
cp -rf ${TEMP_DIR}/demos ${DEST_DIR}
cp -rf ${TEMP_DIR}/*.ipynb ${DEST_DIR}
cp -rf ${TEMP_DIR}/assets ${DEST_DIR}
cp -f ${TEMP_DIR}/README.md ${TEMP_DIR}/LICENSE ${DEST_DIR}
rm -rf ${TEMP_DIR}
echo "Deleting temporary ${DEST_DIR} directory ..."
echo "DONE"