fix rclone and duplicati
This commit is contained in:
parent
c824630e40
commit
0ba9eb1487
@ -16,6 +16,7 @@ color
|
|||||||
catch_errors
|
catch_errors
|
||||||
|
|
||||||
function update_script() {
|
function update_script() {
|
||||||
|
header_info
|
||||||
msg_info "Updating Alpine Packages"
|
msg_info "Updating Alpine Packages"
|
||||||
$STD apk update
|
$STD apk update
|
||||||
$STD apk upgrade
|
$STD apk upgrade
|
||||||
|
@ -20,21 +20,21 @@ color
|
|||||||
catch_errors
|
catch_errors
|
||||||
|
|
||||||
function update_script() {
|
function update_script() {
|
||||||
header_info
|
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) }')
|
msg_info "Updating Alpine Packages"
|
||||||
if [ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ] || [ ! -f /opt/${APP}_version.txt ]; then
|
$STD apk update
|
||||||
msg_info "Updating ${APP} LXC"
|
$STD apk upgrade
|
||||||
temp_file=$(mktemp)
|
msg_ok "Updated Alpine Packages"
|
||||||
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
|
|
||||||
|
|
||||||
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
|
start
|
||||||
|
@ -13,51 +13,17 @@ setting_up_container
|
|||||||
network_check
|
network_check
|
||||||
update_os
|
update_os
|
||||||
|
|
||||||
msg_info "Installing dependencies"
|
msg_info "Installing Rclone"
|
||||||
$STD apk add --no-cache \
|
$STD apk add --no-cache rclone
|
||||||
unzip \
|
msg_ok "Installed Rclone"
|
||||||
apache2-utils
|
|
||||||
msg_ok "Installed dependencies"
|
|
||||||
|
|
||||||
msg_info "Installing rclone"
|
msg_info "Enabling Rclone Service"
|
||||||
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
|
|
||||||
$STD rc-update add rclone default
|
$STD rc-update add rclone default
|
||||||
msg_ok "Enabled rclone Service"
|
msg_ok "Enabled Rclone Service"
|
||||||
|
|
||||||
msg_info "Starting rclone"
|
msg_info "Starting Rclone"
|
||||||
$STD service rclone start
|
$STD rc-service rclone start
|
||||||
msg_ok "Started rclone"
|
msg_ok "Started Rclone"
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
|
Loading…
x
Reference in New Issue
Block a user