Skip to content

add flag to upgrade only deb-get packages #1246

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

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ cog.out(f"```\n{help}\n```")
]]] -->
```

deb-get {update [--repos-only] [--quiet] | upgrade | show <pkg list> | install <pkg list>
deb-get {update [--repos-only] [--quiet] | upgrade [--dg-only] | show <pkg list> | install <pkg list>
| reinstall <pkg list> | remove [--remove-repo] <pkg list>
| purge [--remove-repo] <pkg list>
| search [--include-unsupported] <regex> | cache | clean
Expand All @@ -96,6 +96,7 @@ update
upgrade
upgrade is used to install the newest versions of all packages currently
installed on the system.
When --dg-only is provided, only the packages which have been installed by deb-get will be upgraded.

install
install is followed by one package (or a space-separated list of packages)
Expand Down
16 changes: 13 additions & 3 deletions deb-get
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ cat <<HELP

Usage

deb-get {update [--repos-only] [--quiet] | upgrade | show <pkg list> | install <pkg list>
deb-get {update [--repos-only] [--quiet] | upgrade [--dg-only] | show <pkg list> | install <pkg list>
| reinstall <pkg list> | remove [--remove-repo] <pkg list>
| purge [--remove-repo] <pkg list>
| search [--include-unsupported] <regex> | cache | clean
Expand All @@ -41,6 +41,7 @@ update
upgrade
upgrade is used to install the newest versions of all packages currently
installed on the system.
When --dg-only is provided, only the packages which have been installed by deb-get will be upgraded.

install
install is followed by one package (or a space-separated list of packages)
Expand Down Expand Up @@ -270,6 +271,11 @@ function upgrade_apt() {
${ELEVATE} apt-get -q -o Dpkg::Progress-Fancy="1" -y upgrade
}

function upgrade_only_dg() {
mapfile -t INSTALLED_APT_PPA < <(grep -E "apt\s*$|ppa\s*$" "${ETC_DIR}/installed"); INSTALLED_APT_PPA=(${INSTALLED_APT_PPA[@]%% *})
printf '%s\0' "${INSTALLED_APT_PPA[@]}" | xargs -0 ${ELEVATE} apt-get -q -o Dpkg::Progress-Fancy="1" -y install --only-upgrade
}

# Update only the added repo (during install action)
function update_only_repo() {
fancy_message info "Updating: /etc/apt/sources.list.d/${APT_LIST_NAME}.list"
Expand Down Expand Up @@ -640,7 +646,11 @@ function update_debs() {

function upgrade_debs() {
local STATUS=""
upgrade_apt
if [[ " $* " != *' --dg-only '* ]] ; then
upgrade_apt
else
upgrade_only_dg
fi
for APP in "${INSTALLED_APPS[@]}"; do
validate_deb "${APPNAME2FULL[$APP]}"
if [ "${METHOD}" == "direct" ] || [ "${METHOD}" == "github" ]|| [ "${METHOD}" == "gitlab" ] || [ "${METHOD}" == "website" ]; then
Expand Down Expand Up @@ -1540,7 +1550,7 @@ function dg_action_update() {
function dg_action_upgrade() {
elevate_privs
create_cache_dir
upgrade_debs
upgrade_debs "$@"
}
function dg_action_fix-installed() {
if [ -n "${1}" ] && [ "${1}" != --old-apps ]; then
Expand Down
Loading