File size: 1,115 Bytes
8d7ec14
 
 
 
 
0eac0d6
d966592
 
0eac0d6
 
e29b3e9
0eac0d6
 
8d7ec14
 
 
 
 
 
 
 
0eac0d6
8d7ec14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash

# if == "1" running
OUT_CLOUD=$1

# file add
NAME=$2
if [ -z "$NAME" ]; then
  NAME=""
else
  NAME="${NAME}_"
fi

if command -v zip >/dev/null 2>&1; then
	:
else
    apt-get install zip -y
    pip install pcloud
fi

CURRENT_DATE=$(date +"%Y%m%d_%H%M%S")
ZIP_FILENAME="output_${NAME}${CURRENT_DATE}.zip"
W_PATH="/workspace"
if [ -d "/workspace/firstContainer" ]; then
  W_PATH="/workspace/firstContainer"
fi

cd "$W_PATH"

if [ -d "$W_PATH/SD/output" ]; then
	echo "Creating archive. Please wait..."
	zip -q -r "$W_PATH/$ZIP_FILENAME" "$W_PATH/SD/output"
	echo "archive file : $ZIP_FILENAME"
fi

if [ -d "$W_PATH/output" ]; then
	echo "Creating archive. Please wait..."
	zip -q -r "$W_PATH/$ZIP_FILENAME" "$W_PATH/output"
	echo "archive file : $ZIP_FILENAME"
fi

PD="'$(echo eDg3NjV4eHhAZ21haWwuY29t | base64 --decode)', 'Number'"

if [ -f "$W_PATH/$ZIP_FILENAME" ]; then
	export ZIP_FILENAME
    if [ "$OUT_CLOUD" = "1" ]; then
        python3.10 -c "import os; from pcloud import PyCloud; pc = PyCloud($PD); pc.uploadfile(files=['$W_PATH/$ZIP_FILENAME', '$W_PATH/$ZIP_FILENAME'], path='/')"
    fi
fi