From 88fc35ac52e568171fa20f00c2c469209bcb6f73 Mon Sep 17 00:00:00 2001 From: Ruben Date: Mon, 14 Jul 2025 14:26:02 -0500 Subject: [PATCH] selfupdater command, add mollysocket to backup step --- helperbot | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/helperbot b/helperbot index aff9ed6..2b7a337 100755 --- a/helperbot +++ b/helperbot @@ -119,6 +119,9 @@ function info_help { echo "${bold}--update-certs${normal}" echo " Pull in various certificates from Caddy into ${underline}/etc/certs${normal} required for other services." echo + echo "${bold}--update-helperbot${normal}" + echo " Create a backup of the current helperbot into ${underline}/usr/local/bin/helperbot.bak${normal} and does an in-place upgrade of itself." + echo echo "${cyan}${bold}${underline}Fediverse:${normal}" echo "${bold}--sync-blocklists${normal}" echo " Import blocklist from Sharkey -> Iceshrimp" @@ -472,7 +475,7 @@ function system_backup { # configs, extra cp $backup_local_folder/forgejo/compose.yaml $backup_working_directory/forgejo # ============================================================================= - # freshrss + # ask-js echo "${blue}Pulling in Ask-js...${normal}" mkdir -p $backup_working_directory/ask-js # database @@ -481,6 +484,16 @@ function system_backup { cp $backup_local_folder/ask-js/compose.yaml $backup_working_directory/ask-js cp $backup_local_folder/ask-js/config.json $backup_working_directory/ask-js # ============================================================================= + # mollysocket + echo "${blue}Pulling in MollySocket...${normal}" + mkdir -p $backup_working_directory/mollysocket/.config + # data - similar case to the pds, there isn't a native way to make a backup + docker compose -f $backup_local_folder/mollysocket/compose.yaml down + cp -r $backup_local_folder/mollysocket/data $backup_working_directory/mollysocket + docker compose -f $backup_local_folder/mollysocket/compose.yaml up -d + # configs, extra + cp $backup_local_folder/mollysocket/compose.yaml $backup_working_directory/mollysocket + # ============================================================================= # pull in any other common configs and secrets echo "${blue}Pulling in other configurations...${normal}" mkdir -p $backup_working_directory/other/etc/caddy @@ -598,6 +611,25 @@ function update_certificates { fi } +# ╭──────────────────╮ +# │ update helperbot │ +# ╰──────────────────╯ +function update_helperbot { + local helperbot_location=/usr/local/bin/helperbot + local helperbot_upstream_url=https://forged.synth.download/synth.download/synth.download/raw/branch/main/helperbot + + echo "${blue}update-helperbot:${normal} Updating helperbot..." + echo "Creating a backup into ${bold}${helperbot_location}.bak${normal}..." + # create a backup of ourself + cp ${helperbot_location} ${helperbot_location}.bak + # pull in script from git + echo "Updating..." + wget $helperbot_upstream_url -O $helperbot_location + chmod +x $helperbot_location + # done + echo "${green}Updated helperbot!${normal}" +} + # ╭───────────────────╮ # │ fediverse related │ # ╰───────────────────╯ @@ -743,6 +775,9 @@ while [ -n "$1" ]; do detect_system fi update_certificates;; + --update-helperbot) # update helperbot + root_check + update_helperbot;; --sync-blocklists) # fediverse: sync sharkey -> iceshrimp blocklists if [ ! -v synth_current_system ]; then detect_system