github.com/goreleaser/nfpm/v2@v2.44.0/testdata/acceptance/scripts/postinstall.sh (about)

     1  #!/bin/sh
     2  
     3  cleanInstall() {
     4      printf "\033[32m Post Install of a clean install\033[0m\n"
     5      echo "Install" > /tmp/postinstall-proof
     6  }
     7  
     8  upgrade() {
     9      printf "\033[32m Post Install of an upgrade\033[0m\n"
    10      echo "Upgrade" > /tmp/postinstall-proof
    11  }
    12  
    13  action="$1"
    14  if  [ "$1" = "configure" ] && [ -z "$2" ]; then
    15    # Alpine linux does not pass args, and deb passes $1=configure
    16    action="install"
    17  elif [ "$1" = "configure" ] && [ -n "$2" ]; then
    18      # deb passes $1=configure $2=<current version>
    19      action="upgrade"
    20  fi
    21  
    22  case "$action" in
    23    "1" | "install")
    24      cleanInstall
    25      ;;
    26    "2" | "upgrade")
    27      upgrade
    28      ;;
    29    *)
    30      printf "\033[32m Alpine\033[0m"
    31      cleanInstall
    32      ;;
    33  esac