github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/acceptancetests/repository/xenial/mysql/hooks/upgrade-charm (about)

     1  #!/bin/sh
     2  home=`dirname $0`
     3  # Remove any existing .service_user files, which will cause
     4  # new users/pw's to be generated, which is a good thing
     5  old_service_user_files=$(ls /var/lib/juju/*.service_user)
     6  if [ -n "$old_service_user_files" ] ; then
     7      juju-log -l WARNING "Stale users left around, should be revoked: $(cat $old_service_user_files)"
     8      rm -f $old_service_user_files
     9  fi
    10  
    11  # Move service_user2 files to /var/lib/mysql as they are
    12  # now stored there to support HA clustering with ceph.
    13  new_service_user_files=$(ls /var/lib/juju/*.service_user2)
    14  if [ -n "$new_service_user_files" ]; then
    15      juju-log -l INFO "Moving service_user files [$new_service_user_files] to [/var/lib/mysql]"
    16      mv $new_service_user_files /var/lib/mysql/
    17  fi
    18  # Move passwd files to /var/lib/mysql as they are
    19  # now stored there to support HA clustering with ceph.
    20  password_files=$(ls /var/lib/juju/*.passwd)
    21  if [ -n "$password_files" ]; then
    22      juju-log -l INFO "Moving passwd files [$password_files] to [/var/lib/mysql]"
    23      mv $password_files /var/lib/mysql/
    24  fi
    25  
    26  $home/install
    27  exec $home/config-changed