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

     1  #!/bin/bash
     2  
     3  remap_one() {
     4      case "$1" in
     5          python3-yaml)
     6              echo "python-yaml"
     7              ;;
     8          dbus-x11)
     9              # no separate dbus-x11 package in arch
    10              echo "dbus"
    11              ;;
    12          printer-driver-cups-pdf)
    13              echo "cups-pdf"
    14              ;;
    15          openvswitch-switch)
    16              echo "openvswitch"
    17              ;;
    18          man)
    19              echo "man-db"
    20              ;;
    21          python3-dbus)
    22              echo "python-dbus"
    23              ;;
    24          python3-gi)
    25              echo "python-gobject"
    26              ;;
    27          test-snapd-pkg-1)
    28              echo "freeglut"
    29              ;;
    30          test-snapd-pkg-2)
    31              echo "robotfindskitten"
    32              ;;
    33          *)
    34              echo "$1"
    35              ;;
    36      esac
    37  }
    38  
    39  cmd_install() {
    40      local PACMAN_FLAGS="--noconfirm"
    41      while [ -n "$1" ]; do
    42          case "$1" in
    43              --no-install-recommends)
    44                  # Pacman only ever installs the required dependencies
    45                  shift
    46                  ;;
    47              *)
    48                  break
    49                  ;;
    50          esac
    51      done
    52      # shellcheck disable=SC2068,SC2086
    53      pacman -S $PACMAN_FLAGS $@
    54  }
    55  
    56  cmd_is_installed() {
    57      pacman -Qi "$1" >/dev/null 2>&1
    58  }
    59  
    60  cmd_query() {
    61      pacman -Si "$1"
    62  }
    63  
    64  cmd_list_installed() {
    65      pacman -Qe | awk '{ print $1 }' | sort
    66  }
    67  
    68  cmd_remove() {
    69      # shellcheck disable=SC2068
    70      pacman -Rnsc --noconfirm $@
    71  }