Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support deb packages #3187

Open
MTTK03 opened this issue Oct 18, 2024 · 4 comments
Open

Support deb packages #3187

MTTK03 opened this issue Oct 18, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@MTTK03
Copy link

MTTK03 commented Oct 18, 2024

Feature Overview

The Session Manager plugin for AWS CLI is currently supported only on Mac.
I would like it to be supported on Ubuntu as well.

Why is the feature needed?

Enable developers to easily install 'aws/session-manager-plugin' using Aqua.

Workaround

No response

Example Code

No response

Note

No response

@MTTK03 MTTK03 added the enhancement New feature or request label Oct 18, 2024
@suzuki-shunsuke
Copy link
Member

Thank you for your feedback.

session manager plugin provides deb packages, but aqua doesn't support deb packages.

https://docs.aws.amazon.com/systems-manager/latest/userguide/install-plugin-debian-and-ubuntu.html

That's why aqua doesn't support session manager on Linux.

@suzuki-shunsuke
Copy link
Member

I'm not familiar with the specification of deb packages, but if we can unarchive them into the specific path in $(aqua root-dir) and extract executable files, maybe aqua can support deb packages.
We supported dmg and pkg packages before.

@suzuki-shunsuke
Copy link
Member

suzuki-shunsuke commented Oct 18, 2024

📝

$ docker run --rm -ti debian:bookworm-20231009 bash
root@e2381f159600:/# which dpkg
/usr/bin/dpkg
root@e2381f159600:/# dpkg --help
Usage: dpkg [<option>...] <command>

Commands:
  -i|--install       <.deb file name>... | -R|--recursive <directory>...
  --unpack           <.deb file name>... | -R|--recursive <directory>...
  -A|--record-avail  <.deb file name>... | -R|--recursive <directory>...
  --configure        <package>... | -a|--pending
  --triggers-only    <package>... | -a|--pending
  -r|--remove        <package>... | -a|--pending
  -P|--purge         <package>... | -a|--pending
  -V|--verify [<package>...]       Verify the integrity of package(s).
  --get-selections [<pattern>...]  Get list of selections to stdout.
  --set-selections                 Set package selections from stdin.
  --clear-selections               Deselect every non-essential package.
  --update-avail [<Packages-file>] Replace available packages info.
  --merge-avail [<Packages-file>]  Merge with info from file.
  --clear-avail                    Erase existing available info.
  --forget-old-unavail             Forget uninstalled unavailable pkgs.
  -s|--status [<package>...]       Display package status details.
  -p|--print-avail [<package>...]  Display available version details.
  -L|--listfiles <package>...      List files 'owned' by package(s).
  -l|--list [<pattern>...]         List packages concisely.
  -S|--search <pattern>...         Find package(s) owning file(s).
  -C|--audit [<package>...]        Check for broken package(s).
  --yet-to-unpack                  Print packages selected for installation.
  --predep-package                 Print pre-dependencies to unpack.
  --add-architecture <arch>        Add <arch> to the list of architectures.
  --remove-architecture <arch>     Remove <arch> from the list of architectures.
  --print-architecture             Print dpkg architecture.
  --print-foreign-architectures    Print allowed foreign architectures.
  --assert-help                    Show help on assertions.
  --assert-<feature>               Assert support for the specified feature.
  --validate-<thing> <string>      Validate a <thing>'s <string>.
  --compare-versions <a> <op> <b>  Compare version numbers - see below.
  --force-help                     Show help on forcing.
  -Dh|--debug=help                 Show help on debugging.

  -?, --help                       Show this help message.
      --version                    Show the version.

Validatable things: pkgname, archname, trigname, version.

Use dpkg with -b, --build, -c, --contents, -e, --control, -I, --info,
  -f, --field, -x, --extract, -X, --vextract, --ctrl-tarfile, --fsys-tarfile
on archives (type dpkg-deb --help).

Options:
  --admindir=<directory>     Use <directory> instead of /var/lib/dpkg.
  --root=<directory>         Install on a different root directory.
  --instdir=<directory>      Change installation dir without changing admin dir.
  --pre-invoke=<command>     Set a pre-invoke hook.
  --post-invoke=<command>    Set a post-invoke hook.
  --path-exclude=<pattern>   Do not install paths which match a shell pattern.
  --path-include=<pattern>   Re-include a pattern after a previous exclusion.
  -O|--selected-only         Skip packages not selected for install/upgrade.
  -E|--skip-same-version     Skip packages with same installed version/arch.
  -G|--refuse-downgrade      Skip packages with earlier version than installed.
  -B|--auto-deconfigure      Install even if it would break some other package.
  --[no-]triggers            Skip or force consequential trigger processing.
  --verify-format=<format>   Verify output format (supported: 'rpm').
  --no-pager                 Disables the use of any pager.
  --no-debsig                Do not try to verify package signatures.
  --no-act|--dry-run|--simulate
                             Just say what we would do - don't do it.
  -D|--debug=<octal>         Enable debugging (see -Dhelp or --debug=help).
  --status-fd <n>            Send status change updates to file descriptor <n>.
  --status-logger=<command>  Send status change updates to <command>'s stdin.
  --log=<filename>           Log status changes and actions to <filename>.
  --ignore-depends=<package>[,...]
                             Ignore dependencies involving <package>.
  --force-<thing>[,...]      Override problems (see --force-help).
  --no-force-<thing>[,...]   Stop when problems encountered.
  --refuse-<thing>[,...]     Ditto.
  --abort-after <n>          Abort after encountering <n> errors.
  --robot                    Use machine-readable output on some commands.

Comparison operators for --compare-versions are:
  lt le eq ne ge gt       (treat empty version as earlier than any version);
  lt-nl le-nl ge-nl gt-nl (treat empty version as later than any version);
  < << <= = >= >> >       (only for compatibility with control file syntax).

Use 'apt' or 'aptitude' for user-friendly package management.

Maybe --instdir is available.

  --instdir=<directory>      Change installation dir without changing admin dir.

Now aqua doesn't distinguish Linux distribution such as Ubuntu, Debian, and Fedora.

https://github.com/zcalusic/sysinfo

Idea: Extend overrides and supported_envs to support Linux distributions.

overrides:
  - linux_distribution: debian
supported_envs:
  - debian/amd64 

@suzuki-shunsuke suzuki-shunsuke changed the title Support aws/session-manager-plugin on Ubuntu Support deb packages Oct 18, 2024
@suzuki-shunsuke
Copy link
Member

suzuki-shunsuke commented Oct 18, 2024

dpkg-deb -x session-manager-plugin.deb <install directory>

https://askubuntu.com/questions/974317/how-to-install-deb-package-using-dpkg-to-specific-directory

docker run --rm -ti debian:bookworm-20231009 bash
apt-get update
apt-get install -y curl tree
mkdir workspace
cd workspace
curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_arm64/session-manager-plugin.deb" -o "session-manager-plugin.deb"
dpkg-deb -x session-manager-plugin.deb pkg
$ tree pkg
pkg
|-- etc
|   `-- init
|       `-- session-manager-plugin.conf
|-- lib
|   `-- systemd
|       `-- system
|           `-- session-manager-plugin.service
`-- usr
    |-- local
    |   `-- sessionmanagerplugin
    |       |-- LICENSE
    |       |-- NOTICE
    |       |-- README.md
    |       |-- RELEASENOTES.md
    |       |-- THIRD-PARTY
    |       |-- VERSION
    |       |-- bin
    |       |   `-- session-manager-plugin
    |       `-- seelog.xml.template
    `-- share
        |-- doc
        |   `-- sessionmanagerplugin
        |       `-- changelog.gz
        `-- lintian
            `-- overrides
                `-- sessionmanagerplugin

15 directories, 12 files
$ ./pkg/usr/local/sessionmanagerplugin/bin/session-manager-plugin --version
1.2.677.0

It looks well, but I guess there are issues.

https://askubuntu.com/questions/974317/how-to-install-deb-package-using-dpkg-to-specific-directory#comment2348468_1142323

This works to some extent, but creates a dir named "usr" inside /home/yung/test which then contains lib and share. If your lib and your share directories are inside $TARGET_DIRECTORY, this won't work.

https://askubuntu.com/questions/974317/how-to-install-deb-package-using-dpkg-to-specific-directory#comment2414038_1142323

Decompressing is not the same as installing, e.g. postinst, prerm etc scripts are not run. Using --instdir=/path/to/root is the correct answer.

postinst, prerm etc scripts may have side effect, so I hesitate to run them.

dpkg --instdir, --admindir, --root

These options didn't work well.

root@e2381f159600:/workspace# dpkg --instdir $PWD/pkg -i session-manager-plugin.deb
Selecting previously unselected package session-manager-plugin.
(Reading database ... 6746 files and directories currently installed.)
Preparing to unpack session-manager-plugin.deb ...
dpkg (subprocess): admindir must be inside instdir for dpkg to work properly
dpkg: error processing archive session-manager-plugin.deb (--install):
 new session-manager-plugin package pre-installation script subprocess returned error exit status 2
dpkg (subprocess): admindir must be inside instdir for dpkg to work properly
dpkg: error while cleaning up:
 new session-manager-plugin package post-removal script subprocess returned error exit status 2
Errors were encountered while processing:
 session-manager-plugin.deb
root@e2381f159600:/workspace# dpkg --instdir $PWD/pkg --admindir $PWD/pkg/lib -i session-manager-plugin.deb
Selecting previously unselected package session-manager-plugin.
(Reading database ... 0 files and directories currently installed.)
Preparing to unpack session-manager-plugin.deb ...
dpkg (subprocess): unable to execute new session-manager-plugin package pre-installation script (/lib/tmp.ci/preinst): No such file or directory
dpkg: error processing archive session-manager-plugin.deb (--install):
 new session-manager-plugin package pre-installation script subprocess returned error exit status 2
dpkg (subprocess): unable to execute new session-manager-plugin package post-removal script (/lib/tmp.ci/postrm): No such file or directory
dpkg: error while cleaning up:
 new session-manager-plugin package post-removal script subprocess returned error exit status 2
Errors were encountered while processing:
 session-manager-plugin.deb
root@e2381f159600:/workspace# dpkg --root $PWD/root -i session-manager-plugin.deb
Selecting previously unselected package session-manager-plugin.
(Reading database ... 0 files and directories currently installed.)
Preparing to unpack session-manager-plugin.deb ...
dpkg (subprocess): unable to execute new session-manager-plugin package pre-installation script (/var/lib/dpkg/tmp.ci/preinst): No such file or directory
dpkg: error processing archive session-manager-plugin.deb (--install):
 new session-manager-plugin package pre-installation script subprocess returned error exit status 2
dpkg (subprocess): unable to execute new session-manager-plugin package post-removal script (/var/lib/dpkg/tmp.ci/postrm): No such file or directory
dpkg: error while cleaning up:
 new session-manager-plugin package post-removal script subprocess returned error exit status 2
Errors were encountered while processing:
 session-manager-plugin.deb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants