post_install() {
    echo "Configure your /etc/webapps/gitlab/gitlab.yml"
    echo "Set up your valkey to run on /run/valkey/valkey.sock or configure gitlab to use redis TCP"
    echo "Put a secret bytestring to /etc/webapps/gitlab/secret"
    echo "Copy /usr/share/webapps/gitlab/config/secrets.yml.example to /etc/webapps/gitlab/secrets.yml and configure it"
    echo "Setup the database:"
    echo "$ (cd /usr/share/webapps/gitlab && sudo -u gitlab \$(cat environment | xargs) bundle exec rake gitlab:setup)"
    echo "Finally run the following commands to check your installation:"
    echo "$ (cd /usr/share/webapps/gitlab && sudo -u gitlab \$(cat environment | xargs) bundle exec rake gitlab:env:info)"
    echo "$ (cd /usr/share/webapps/gitlab && sudo -u gitlab \$(cat environment | xargs) bundle exec rake gitlab:check)"
}

post_upgrade() {
    echo "You should upgrade your database:"
    echo "$ (cd /usr/share/webapps/gitlab && sudo -u gitlab \$(cat environment | xargs) bundle exec rake db:migrate)"
    echo "Afterwards, restart gitlab-related services:"
    echo "# systemctl daemon-reload"
    echo "# systemctl restart gitlab-sidekiq gitlab-puma gitlab-workhorse gitlab-gitaly"

    if (( $(vercmp $2 13.0.0) < 0)); then
        echo "=========="
        echo "Since 13.0.0, upstream switched default Ruby web server from Unicorn to Puma."
        echo "Please use 'gitlab-puma' systemd service instead of 'gitlab-unicorn'."
    fi

    if (( $(vercmp $2 13.0.1) < 0)); then
        echo "=========="
        echo "The new Puma server uses socket files by default thus configuration for gitlab-gitlay and gitlab-shell need to be updated."
        echo "Please check new option values for 'gitlab_url' and 'secret_file' in /etc/webapps/gitlab-shell/config.yml and /etc/gitlab-gitaly/config.toml."

        echo "=========="
        echo "Legacy symlinks /var/lib/gitlab/{gitlab-shell,log,pids,sockets} and /usr/share/webapps/gitlab/{builds,log,tmp} have been removed. Please check your config files and make sure you use direct target location such as /var/log/gitlab, /var/tmp, /run/gitlab ..."
    fi
}
