github.com/canonical/ubuntu-image@v0.0.0-20240430122802-2202fe98b290/tests/lib/external/snapd-testing-tools/tools/tests.pkgs.zypper.sh (about)

     1  #!/bin/bash
     2  
     3  remap_one() {
     4      case "$1" in
     5          python3-yaml)
     6              echo "python3-PyYAML"
     7              ;;
     8          dbus-x11)
     9              echo "dbus-1-x11"
    10              ;;
    11          printer-driver-cups-pdf)
    12              echo "cups-pdf"
    13              ;;
    14          python3-dbus)
    15              # In OpenSUSE Leap 15, this is renamed to python3-dbus-python
    16              echo "dbus-1-python3"
    17              ;;
    18          python3-gi)
    19              echo "python3-gobject"
    20              ;;
    21          test-snapd-pkg-1)
    22              echo "nudoku"
    23              ;;
    24          test-snapd-pkg-2)
    25              echo "system-user-games"
    26              ;;
    27          *)
    28              echo "$1"
    29              ;;
    30      esac
    31  }
    32  
    33  cmd_install() {
    34      local ZYPPER_FLAGS="-y"
    35      while [ -n "$1" ]; do
    36          case "$1" in
    37              --no-install-recommends)
    38                  ZYPPER_FLAGS="$ZYPPER_FLAGS --no-recommends"
    39                  shift
    40                  ;;
    41              *)
    42                  break
    43                  ;;
    44          esac
    45      done
    46  
    47      # shellcheck disable=SC2068,SC2086
    48      zypper install $ZYPPER_FLAGS $@
    49  }
    50  
    51  cmd_is_installed() {
    52      rpm -qi "$1" >/dev/null 2>&1
    53  }
    54  
    55  cmd_query() {
    56      zypper info "$1"
    57  }
    58  
    59  cmd_list_installed() {
    60      rpm -qa | sort
    61  }
    62  
    63  cmd_remove() {
    64      # shellcheck disable=SC2068
    65      zypper remove -y $@
    66  }