-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·41 lines (35 loc) · 1.04 KB
/
entrypoint.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
#!/bin/sh -l
# Run rclone for files and directories from different cloud storage providers.
if [ "${DEBUG}" = "false" ]; then
# Carry on, but do quit on errors
set -e
elif [ "${DEBUG}" = "true" ]; then
# Verbose debugging
set -exuo xtrace
export LOG_LEVEL=debug
export ACTIONS_STEP_DEBUG=true
fi
if [ -z "${CONFIG_FILE}" ]; then
# Get default location for the configuration file
CONFIG_FILE=$(rclone config file | grep 'rclone.conf' | awk '{print $1}')
fi
if [ -n "${RCLONE_CONF}" ]; then
# Write user set rclone configuration
echo "${RCLONE_CONF}" >"${CONFIG_FILE}"
else
# Unable to proceed if rclone configuration not set
echo "The configuration for the rclone is not set"
exit 1
fi
if [ ! -x "$(command -v rclone)" ]; then
# Unable to proceed as executable rclone not found
echo 'Failed to install rclone or has non-executable permissions' >&2
exit 1
fi
if [ "${SELF_UPDATE}" = "true" ]; then
# Update rclone to the latest version
rclone selfupdate
fi
# Run rclone
rclone=$(sh -c "rclone $*")
echo "rclone=${rclone}" >>"${GITHUB_OUTPUT}"