From ddd9172a991193a043d5c12520c623fdbbcdc8b1 Mon Sep 17 00:00:00 2001 From: Daniel Fancsali Date: Fri, 16 Sep 2022 16:40:27 +0100 Subject: [PATCH] __package_apt to accept .dpkg file as --soruce --- type/__package_apt/gencode-remote | 13 +++++++++++-- type/__package_apt/man.rst | 5 +++++ type/__package_apt/parameter/optional | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/type/__package_apt/gencode-remote b/type/__package_apt/gencode-remote index f51e4f043..7884bc64e 100755 --- a/type/__package_apt/gencode-remote +++ b/type/__package_apt/gencode-remote @@ -60,11 +60,21 @@ aptget="DEBIAN_FRONTEND=noninteractive apt-get --quiet --yes -o Dpkg::Options::= case ${state_should} in present) - if test -n "${version_should}" -a "${version_should}" != "${version_is}" + if [ -f "$__object/parameter/source" ] + then + source_path="$(cat "$__object/parameter/source")" + tempfile="$($__remote_exec $__target_host "mktemp -t cidst.XXXXX.${source_path##*/}")" + + $__remote_copy "$source_path" "$__target_host:$tempfile" + + echo "${aptget:?} $recommendsparam install $tempfile" + elif test -n "${version_should}" -a "${version_should}" != "${version_is}" then # other version should be installed name="${name}=${version_should}" aptget="${aptget:?} -o APT::Get::allow-downgrades=true" + + echo "${aptget} ${recommendsparam} install ${target_release} '${name}'" elif test "${state_is}" = 'present' then if test "${auto_state}" = 'auto' @@ -132,7 +142,6 @@ then fi EOF - echo "${aptget} ${recommendsparam} install ${target_release} '${name}'" echo 'installed' >>"${__messages_out:?}" ;; absent) diff --git a/type/__package_apt/man.rst b/type/__package_apt/man.rst index 85cd19478..fe1180be7 100644 --- a/type/__package_apt/man.rst +++ b/type/__package_apt/man.rst @@ -38,6 +38,11 @@ version The version of the package to install. Default is to install the version chosen by the local package manager. +source + Source dpkg package to upload an install (instead of fetching + from the repositories). Dependencies will be collected and installed + from the usual sources though. + BOOLEAN PARAMETERS ------------------ diff --git a/type/__package_apt/parameter/optional b/type/__package_apt/parameter/optional index d6674f950..0ab71c807 100644 --- a/type/__package_apt/parameter/optional +++ b/type/__package_apt/parameter/optional @@ -2,3 +2,4 @@ name version state target-release +source