You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

29 lines
1.2 KiB

#!/bin/bash
if [[ -d /opt/debian-bash ]]; then
local_release=$(cat /opt/debian-bash/.semver_git_tag)
fi
remote_release=$(wget_semver artcode pvincent/debian-bash)
if [[ $local_release != $remote_release ]];then
echo "upgrading from <$local_release> to <$remote_release> ..."
curl https://git.artcode.re/pvincent/debian-bash/raw/master/install.sh | sudo bash -s -- --full
else
echo "debian-bash version $local_release already up-to-date!"
# install inside active LXC containers
if [[ -f '/snap/bin/lxc' ]]; then
echo "refreshing containers ..."
for container in `lxc list --format=json | jq -r '.[] | select(.state.status == "Running") | .name'`; do
container_release=$(lxc exec $container -- cat /opt/debian-bash/.semver_git_tag)
if [[ $container_release != $remote_release ]];then
echo "upgrade container <$container> from <$container_release> to <$remote_release>"
/snap/bin/lxc file push /opt/debian-bash "${container}/opt/" -r
/snap/bin/lxc exec "$container" -- sh -c "cd /opt/debian-bash && ./install.sh --host"
else
echo "debian-bash version on container <$container> already up-to-date!"
fi
done
fi
fi