Skip to content

Instantly share code, notes, and snippets.

@echosa
Last active January 28, 2020 02:58
Show Gist options
  • Select an option

  • Save echosa/390b968093c37e459ec38cd510d30de0 to your computer and use it in GitHub Desktop.

Select an option

Save echosa/390b968093c37e459ec38cd510d30de0 to your computer and use it in GitHub Desktop.

Revisions

  1. echosa revised this gist May 17, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion att.sh
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ apt_search_exact() {
    apt search ^$1$
    }
    apt_upgrade() {
    sudo apt update; sudo apt upgrade; sudo apt autoremove
    sudo apt update; sudo apt upgrade
    }

    PACKAGE_MANAGERS+=("brew")
  2. echosa revised this gist May 17, 2019. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion att.sh
    Original file line number Diff line number Diff line change
    @@ -71,7 +71,6 @@ for PACKAGE_MANAGER in "${PACKAGE_MANAGERS[@]}"; do
    echo "####################"
    echo $PACKAGE_MANAGER
    echo "####################"
    echo "####################"
    if [ -x "$(command -v $PACKAGE_MANAGER)" ]; then
    COMMAND_FUNCTION=$PACKAGE_MANAGER"_"$1
    if [ "$(type -t $COMMAND_FUNCTION)" = "function" ]; then
  3. echosa revised this gist May 17, 2019. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions att.sh
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,9 @@
    PACKAGE_MANAGERS=()

    PACKAGE_MANAGERS+=("apt")
    apt_clean() {
    sudo apt autoremove
    }
    apt_search() {
    apt search $1
    }
    @@ -12,11 +15,11 @@ apt_search_exact() {
    apt_upgrade() {
    sudo apt update; sudo apt upgrade; sudo apt autoremove
    }
    apt_clean() {
    sudo apt autoremove
    }

    PACKAGE_MANAGERS+=("brew")
    brew_clean() {
    brew cleanup
    }
    brew_search() {
    brew search $1
    }
    @@ -26,9 +29,6 @@ brew_search_exact() {
    brew_upgrade() {
    brew update; brew upgrade
    }
    brew_clean() {
    brew cleanup
    }

    PACKAGE_MANAGERS+=("flatpak")
    flatpak_search() {
    @@ -42,6 +42,9 @@ flatpak_upgrade() {
    }

    PACKAGE_MANAGERS+=("guix")
    guix_clean() {
    guix package --delete-generations; guix gc --collect-garbage; guix gc --list-dead
    }
    guix_search() {
    guix package -A $1
    }
    @@ -51,9 +54,6 @@ guix_search_exact() {
    guix_upgrade() {
    guix pull; guix package -u
    }
    guix_clean() {
    guix package --delete-generations; guix gc --collect-garbage; guix gc --list-dead
    }

    PACKAGE_MANAGERS+=("snap")
    snap_search() {
  4. echosa revised this gist May 17, 2019. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions att.sh
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,9 @@ apt_search_exact() {
    apt_upgrade() {
    sudo apt update; sudo apt upgrade; sudo apt autoremove
    }
    apt_clean() {
    sudo apt autoremove
    }

    PACKAGE_MANAGERS+=("brew")
    brew_search() {
    @@ -23,6 +26,9 @@ brew_search_exact() {
    brew_upgrade() {
    brew update; brew upgrade
    }
    brew_clean() {
    brew cleanup
    }

    PACKAGE_MANAGERS+=("flatpak")
    flatpak_search() {
    @@ -45,6 +51,9 @@ guix_search_exact() {
    guix_upgrade() {
    guix pull; guix package -u
    }
    guix_clean() {
    guix package --delete-generations; guix gc --collect-garbage; guix gc --list-dead
    }

    PACKAGE_MANAGERS+=("snap")
    snap_search() {
  5. echosa revised this gist May 13, 2019. 2 changed files with 76 additions and 25 deletions.
    76 changes: 76 additions & 0 deletions att.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,76 @@
    #!/bin/bash

    PACKAGE_MANAGERS=()

    PACKAGE_MANAGERS+=("apt")
    apt_search() {
    apt search $1
    }
    apt_search_exact() {
    apt search ^$1$
    }
    apt_upgrade() {
    sudo apt update; sudo apt upgrade; sudo apt autoremove
    }

    PACKAGE_MANAGERS+=("brew")
    brew_search() {
    brew search $1
    }
    brew_search_exact() {
    brew search /^$1$/
    }
    brew_upgrade() {
    brew update; brew upgrade
    }

    PACKAGE_MANAGERS+=("flatpak")
    flatpak_search() {
    flatpak search $1
    }
    flatpak_search_exact() {
    flatpak_search $1
    }
    flatpak_upgrade() {
    flatpak update
    }

    PACKAGE_MANAGERS+=("guix")
    guix_search() {
    guix package -A $1
    }
    guix_search_exact() {
    guix package -A ^$1$
    }
    guix_upgrade() {
    guix pull; guix package -u
    }

    PACKAGE_MANAGERS+=("snap")
    snap_search() {
    snap find $1
    }
    snap_search_exact() {
    snap_search $1
    }
    snap_upgrade() {
    sudo snap refresh
    }

    for PACKAGE_MANAGER in "${PACKAGE_MANAGERS[@]}"; do
    echo "####################"
    echo "####################"
    echo $PACKAGE_MANAGER
    echo "####################"
    echo "####################"
    if [ -x "$(command -v $PACKAGE_MANAGER)" ]; then
    COMMAND_FUNCTION=$PACKAGE_MANAGER"_"$1
    if [ "$(type -t $COMMAND_FUNCTION)" = "function" ]; then
    eval ${COMMAND_FUNCTION} $2
    else
    echo Package manager $PACKAGE_MANAGER has no defined $1 command.
    fi
    else
    echo Package manager $PACKAGE_MANAGER not found.
    fi
    done
    25 changes: 0 additions & 25 deletions upgradeallthethings.sh
    Original file line number Diff line number Diff line change
    @@ -1,25 +0,0 @@
    #!/bin/sh
    if [ -x "$(command -v apt)" ]; then
    echo "Upgrading apt packages..."
    sudo apt update; sudo apt upgrade; sudo apt autoremove
    fi

    if [ -x "$(command -v flatpak)" ]; then
    echo "Upgrading flatpaks..."
    flatpak update
    fi

    if [ -x "$(command -v brew)" ]; then
    echo "Upgrading Homebrew formulae..."
    brew update; brew upgrade
    fi

    if [ -x "$(command -v snap)" ]; then
    echo "Refreshing snaps..."
    sudo snap refresh
    fi

    if [ -x "$(command -v guix)" ]; then
    echo "Upgrading Guix packages..."
    guix pull; guix package -u
    fi
  6. echosa revised this gist May 7, 2019. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions upgradeallthethings.sh
    Original file line number Diff line number Diff line change
    @@ -18,3 +18,8 @@ if [ -x "$(command -v snap)" ]; then
    echo "Refreshing snaps..."
    sudo snap refresh
    fi

    if [ -x "$(command -v guix)" ]; then
    echo "Upgrading Guix packages..."
    guix pull; guix package -u
    fi
  7. echosa created this gist May 1, 2019.
    20 changes: 20 additions & 0 deletions upgradeallthethings.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    #!/bin/sh
    if [ -x "$(command -v apt)" ]; then
    echo "Upgrading apt packages..."
    sudo apt update; sudo apt upgrade; sudo apt autoremove
    fi

    if [ -x "$(command -v flatpak)" ]; then
    echo "Upgrading flatpaks..."
    flatpak update
    fi

    if [ -x "$(command -v brew)" ]; then
    echo "Upgrading Homebrew formulae..."
    brew update; brew upgrade
    fi

    if [ -x "$(command -v snap)" ]; then
    echo "Refreshing snaps..."
    sudo snap refresh
    fi