fix rclone and duplicati

This commit is contained in:
CanbiZ 2025-04-14 10:27:55 +02:00
parent c824630e40
commit 0ba9eb1487
3 changed files with 23 additions and 56 deletions

View File

@ -16,6 +16,7 @@ color
catch_errors
function update_script() {
header_info
msg_info "Updating Alpine Packages"
$STD apk update
$STD apk upgrade

View File

@ -20,21 +20,21 @@ color
catch_errors
function update_script() {
header_info
RELEASE=$(curl -s https://api.github.com/repos/rclone/rclone/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ] || [ ! -f /opt/${APP}_version.txt ]; then
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 -j -o "$temp_file" '*/**' -d /opt/rclone
rm -f "$temp_file"
echo "${RELEASE}" >/opt/"${APPLICATION}"_version.txt
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
header_info
msg_info "Updating Alpine Packages"
$STD apk update
$STD apk upgrade
msg_ok "Updated Alpine Packages"
exit 0
msg_info "Updating Rclone"
$STD apk upgrade rclone
msg_ok "Updated Rclone"
msg_info "Restarting Rclone"
$STD rc-service rclone restart || true
msg_ok "Restarted Rclone"
exit 0
}
start

View File

@ -13,51 +13,17 @@ setting_up_container
network_check
update_os
msg_info "Installing dependencies"
$STD apk add --no-cache \
unzip \
apache2-utils
msg_ok "Installed dependencies"
msg_info "Installing Rclone"
$STD apk add --no-cache rclone
msg_ok "Installed Rclone"
msg_info "Installing rclone"
temp_file=$(mktemp)
mkdir -p /opt/rclone
RELEASE=$(curl -s https://api.github.com/repos/rclone/rclone/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
curl -fsSL "https://github.com/rclone/rclone/releases/download/v${RELEASE}/rclone-v${RELEASE}-linux-amd64.zip" -o "$temp_file"
$STD unzip -j "$temp_file" '*/**' -d /opt/rclone
cd /opt/rclone || exit
PASSWORD=$(head -c 16 /dev/urandom | xxd -p -c 16)
$STD htpasswd -cb -B login.pwd admin "$PASSWORD"
{
echo "rclone-Credentials"
echo "rclone User Name: admin"
echo "rclone Password: $PASSWORD"
} >>~/rclone.creds
echo "${RELEASE}" >/opt/"${APPLICATION}"_version.txt
rm -f "$temp_file"
msg_ok "Installed rclone"
msg_info "Enabling rclone Service"
cat <<EOF >/etc/init.d/rclone
#!/sbin/openrc-run
description="rclone Service"
command="/opt/rclone/rclone"
command_args="rcd --rc-web-gui --rc-web-gui-no-open-browser --rc-addr :3000 --rc-htpasswd /opt/rclone/login.pwd"
command_background="true"
command_user="root"
pidfile="/var/run/rclone.pid"
depend() {
use net
}
EOF
chmod +x /etc/init.d/rclone
msg_info "Enabling Rclone Service"
$STD rc-update add rclone default
msg_ok "Enabled rclone Service"
msg_ok "Enabled Rclone Service"
msg_info "Starting rclone"
$STD service rclone start
msg_ok "Started rclone"
msg_info "Starting Rclone"
$STD rc-service rclone start
msg_ok "Started Rclone"
motd_ssh
customize