From 745c3ef3ff4022c615bd9a116f9614cd664620b6 Mon Sep 17 00:00:00 2001 From: Peter Wood Date: Sun, 8 Sep 2024 18:20:11 -0400 Subject: [PATCH] no longer using portainer so bye bitch and github-cli was failing - https://github.com/cli/cli/issues/9569 --- github-cli-key-replacement.sh | 23 +++++++++++++++ update-portainer.sh | 54 ----------------------------------- 2 files changed, 23 insertions(+), 54 deletions(-) create mode 100755 github-cli-key-replacement.sh delete mode 100755 update-portainer.sh diff --git a/github-cli-key-replacement.sh b/github-cli-key-replacement.sh new file mode 100755 index 0000000..aaf9e30 --- /dev/null +++ b/github-cli-key-replacement.sh @@ -0,0 +1,23 @@ +# Check for wget, if not installed, install it +(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \ + && sudo mkdir -p -m 755 /etc/apt/keyrings + +# Set keyring path based on existence of /usr/share/keyrings/githubcli-archive-keyring.gpg +# If it is in the old location, use that, otherwise always use the new location. +if [ -f /usr/share/keyrings/githubcli-archive-keyring.gpg ]; then + keyring_path="/usr/share/keyrings/githubcli-archive-keyring.gpg" +else + keyring_path="/etc/apt/keyrings/githubcli-archive-keyring.gpg" +fi + +echo "replacing keyring at ${keyring_path}" + +# Download and set up the keyring +wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee "$keyring_path" > /dev/null \ + && sudo chmod go+r "$keyring_path" + +# Idempotently add the GitHub CLI repository as an apt source +echo "deb [arch=$(dpkg --print-architecture) signed-by=$keyring_path] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null + +# Update the package lists, which should now pass +sudo apt update diff --git a/update-portainer.sh b/update-portainer.sh deleted file mode 100755 index a88256b..0000000 --- a/update-portainer.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -function update_agent () { - docker run -d -p 9001:9001 --name=${image_name} --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes ${portainer_image} -} - -function update () { - docker run -d -p 8000:8000 -p 9000:9000 -p 9443:9443 --name=${image_name} --restart=always --pull=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data ${portainer_image} -} - -portainer_image="" -image_name="" - -case ${HOSTNAME} in - vperanda) - portainer_image="portainer/portainer-ee:latest" - image_name="portainer" - ;; - io) - portainer_image="portainer/agent:latest" - image_name="portainer_agent" - ;; - svr-office) - portainer_image="portainer/agent:latest" - image_name="portainer_agent" - ;; -esac - -# stop and remove portainer -docker stop ${image_name} -docker rm ${image_name} - -# pull the latest image -docker pull ${portainer_image} - -# run the command run the latest [portainer,portainer-agent] docker image -case ${HOSTNAME} in - vperanda) - update - ;; - io) - update_agent - ;; - svr-office) - update_agent - ;; -esac - -# send a notification to https://notify.peterwood.rocks\lab -curl \ - -H priority:default \ - -H tags:update,docker,portainer,${HOSTNAME} \ - -d "The ${image_name} image has been updated." \ - https://notify.peterwood.rocks/lab