Update alpine-rclone
This commit is contained in:
parent
02019ebf0f
commit
72ac3792ea
@ -20,21 +20,27 @@ color
|
|||||||
catch_errors
|
catch_errors
|
||||||
|
|
||||||
function update_script() {
|
function update_script() {
|
||||||
header_info
|
header_info
|
||||||
msg_info "Updating Alpine Packages"
|
check_container_storage
|
||||||
$STD apk update
|
check_container_resources
|
||||||
$STD apk upgrade
|
|
||||||
msg_ok "Updated Alpine Packages"
|
|
||||||
|
|
||||||
msg_info "Updating Rclone"
|
if [ ! -d /opt/rclone ]; then
|
||||||
$STD apk upgrade rclone
|
msg_error "No ${APP} Installation Found!"
|
||||||
msg_ok "Updated Rclone"
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
msg_info "Restarting Rclone"
|
RELEASE=$(curl -s https://api.github.com/repos/rclone/rclone/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
$STD rc-service rclone restart || true
|
if [ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ] || [ ! -f /opt/${APP}_version.txt ]; then
|
||||||
msg_ok "Restarted Rclone"
|
msg_info "Updating ${APP} LXC"
|
||||||
|
temp_file=$(mktemp)
|
||||||
|
curl -fsSL "https://github.com/rclone/rclone/releases/download/v${RELEASE}/rclone-v${RELEASE}-linux-amd64.zip" -o $temp_file
|
||||||
|
$STD unzip -o $temp_file '*/**' -d /opt/rclone
|
||||||
|
msg_ok "Updated Successfully"
|
||||||
|
else
|
||||||
|
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
start
|
start
|
||||||
|
@ -15,8 +15,8 @@ update_os
|
|||||||
|
|
||||||
msg_info "Installing dependencies"
|
msg_info "Installing dependencies"
|
||||||
$STD apk add --no-cache \
|
$STD apk add --no-cache \
|
||||||
unzip \
|
unzip \
|
||||||
apache2-utils
|
apache2-utils
|
||||||
msg_ok "Installed dependencies"
|
msg_ok "Installed dependencies"
|
||||||
|
|
||||||
msg_info "Installing rclone"
|
msg_info "Installing rclone"
|
||||||
@ -29,9 +29,9 @@ cd /opt/rclone
|
|||||||
PASSWORD=$(head -c 16 /dev/urandom | xxd -p -c 16)
|
PASSWORD=$(head -c 16 /dev/urandom | xxd -p -c 16)
|
||||||
$STD htpasswd -cb -B login.pwd admin $PASSWORD
|
$STD htpasswd -cb -B login.pwd admin $PASSWORD
|
||||||
{
|
{
|
||||||
echo "rclone-Credentials"
|
echo "rclone-Credentials"
|
||||||
echo "rclone User Name: admin"
|
echo "rclone User Name: admin"
|
||||||
echo "rclone Password: $PASSWORD"
|
echo "rclone Password: $PASSWORD"
|
||||||
} >>~/rclone.creds
|
} >>~/rclone.creds
|
||||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||||
rm -f $temp_file
|
rm -f $temp_file
|
||||||
@ -61,3 +61,8 @@ msg_ok "Started rclone"
|
|||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
|
|
||||||
|
msg_info "Cleaning up"
|
||||||
|
rm -rf "$temp_file"
|
||||||
|
$STD apk cache clean
|
||||||
|
msg_ok "Cleaned"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user