alpine
This commit is contained in:
parent
87477f3c72
commit
1623517a02
@ -24,40 +24,20 @@ function update_script() {
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -f /opt/rustypaste/rustypaste ]]; then
|
||||
if ! apk info -e rustypaste >/dev/null 2>&1; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "rustypaste" "orhun/rustypaste"; then
|
||||
msg_info "Stopping Services"
|
||||
rc-service rustypaste stop
|
||||
msg_ok "Stopped Services"
|
||||
|
||||
msg_info "Creating Backup"
|
||||
tar -czf "/opt/rustypaste_backup_$(date +%F).tar.gz" /opt/rustypaste/upload 2>/dev/null || true
|
||||
cp /opt/rustypaste/config.toml /tmp/rustypaste_config.toml.bak
|
||||
msg_ok "Backup Created"
|
||||
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "rustypaste" "orhun/rustypaste" "prebuild" "latest" "/opt/rustypaste" "*x86_64-unknown-linux-musl.tar.gz"
|
||||
|
||||
|
||||
msg_info "Updating RustyPaste"
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "rustypaste" "orhun/rustypaste" "prebuild" "latest" "/opt/rustypaste" "*x86_64-unknown-linux-musl.tar.gz"
|
||||
mv /tmp/rustypaste_config.toml.bak /opt/rustypaste/config.toml
|
||||
$STD apk update
|
||||
$STD apk upgrade rustypaste rustypaste-cli --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
|
||||
msg_ok "Updated RustyPaste"
|
||||
|
||||
msg_info "Starting Services"
|
||||
rc-service rustypaste start
|
||||
msg_ok "Started Services"
|
||||
msg_info "Restarting Services"
|
||||
$STD rc-service rustypaste restart
|
||||
msg_ok "Restarted Services"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
|
||||
if check_for_gh_release "rustypaste-cli" "orhun/rustypaste-cli"; then
|
||||
msg_info "Updating RustyPaste CLI"
|
||||
fetch_and_deploy_gh_release "rustypaste-cli" "orhun/rustypaste-cli" "prebuild" "latest" "/usr/local/bin" "*x86_64-unknown-linux-musl.tar.gz"
|
||||
msg_ok "Updated RustyPaste CLI"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
@ -13,34 +13,18 @@ setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
fetch_and_deploy_gh_release "rustypaste" "orhun/rustypaste" "prebuild" "latest" "/opt/rustypaste" "*x86_64-unknown-linux-musl.tar.gz"
|
||||
fetch_and_deploy_gh_release "rustypaste-cli" "orhun/rustypaste-cli" "prebuild" "latest" "/usr/local/bin" "*x86_64-unknown-linux-musl.tar.gz"
|
||||
msg_info "Installing RustyPaste"
|
||||
$STD apk add --no-cache rustypaste rustypaste-openrc rustypaste-cli --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
|
||||
msg_ok "Installed RustyPaste"
|
||||
|
||||
msg_info "Setting up RustyPaste"
|
||||
cd /opt/rustypaste
|
||||
sed -i 's|^address = ".*"|address = "0.0.0.0:8000"|' config.toml
|
||||
msg_ok "Set up RustyPaste"
|
||||
msg_info "Configuring RustyPaste"
|
||||
mkdir -p /var/lib/rustypaste
|
||||
sed -i 's|^address = ".*"|address = "0.0.0.0:8000"|' /etc/rustypaste/config.toml
|
||||
msg_ok "Configured RustyPaste"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<'EOF' >/etc/init.d/rustypaste
|
||||
#!/sbin/openrc-run
|
||||
|
||||
name="rustypaste"
|
||||
description="rustypaste Service"
|
||||
directory="/opt/rustypaste"
|
||||
command="/opt/rustypaste/rustypaste"
|
||||
command_args=""
|
||||
pidfile="/run/${RC_SVCNAME}.pid"
|
||||
command_background="yes"
|
||||
start_stop_daemon_args="--user root"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
}
|
||||
EOF
|
||||
chmod +x /etc/init.d/rustypaste
|
||||
rc-update add rustypaste default
|
||||
rc-service rustypaste start
|
||||
$STD rc-update add rustypaste default
|
||||
$STD rc-service rustypaste start
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user