Browse Source

debian_bash_upgrade fix

master
pvincent 8 months ago
parent
commit
2712ae99a7
  1. 2
      install.sh
  2. 21
      tools/debian_bash_upgrade

2
install.sh

@ -40,7 +40,7 @@ function install_host() {
echo "debian-bash has been deprecated!" echo "debian-bash has been deprecated!"
echo "--------------------------------" echo "--------------------------------"
read -rn1 -p 'Would you like to migrate to the new project named `miaou-bash`, (yN)?' answer
read -rn1 -p 'Would you like to migrate to the new project named `miaou-bash`, (yN)?' answer
if [[ "$answer" == 'y' ]];then if [[ "$answer" == 'y' ]];then
pushd /tmp pushd /tmp
pushd /opt/debian-bash pushd /opt/debian-bash

21
tools/debian_bash_upgrade

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
set -Eeuo pipefail
# set -Eeuo pipefail
if [[ -d /opt/debian-bash ]]; then if [[ -d /opt/debian-bash ]]; then
local_release=$(cat /opt/debian-bash/.semver_git_tag) local_release=$(cat /opt/debian-bash/.semver_git_tag)
@ -12,22 +12,9 @@ echo -n "$remote_release"
if [[ $local_release != $remote_release ]]; then if [[ $local_release != $remote_release ]]; then
echo " , upgrading from <$local_release> to <$remote_release> ..." echo " , upgrading from <$local_release> to <$remote_release> ..."
curl https://git.artcode.re/pvincent/debian-bash/raw/branch/master/install.sh | sudo bash -s -- --full
curl https://git.artcode.re/pvincent/debian-bash/raw/branch/master/install.sh | sudo bash -s -- --host
pushd /opt/debian-bash
./install.sh --host
else else
echo " up-to-date!" echo " up-to-date!"
# install inside active LXC containers
if [[ -f '/snap/bin/lxc' ]]; then
echo "debian-bash: refreshing containers ..."
for container in $(lxc list --format=json | yq '.[] | 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
else
echo -e "\\tcontainer <$container> already up-to-date!"
fi
done
echo DONE
fi
fi fi
Loading…
Cancel
Save