Tuesday, May 14, 2024
 Popular · Latest · Hot · Upcoming
101
rated 0 times [  101] [ 0]  / answers: 1 / hits: 55375  / 1 Year ago, mon, may 1, 2023, 12:39:33

When I add a PPA and I want to install some of its content, it is quite annoying to re-update all my apt list using apt-get update.



Is it instead possible to only sync the content of a given repository?


More From » apt

 Answers
1


yes, apt-get can do that, and can do it in a nice way.




  1. Append following to ~/.bash_funcs



    update-repo() {
    for source in "$@"; do
    sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/${source}"
    -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
    done
    }

  2. Append following to ~/.bashrc



    if [ -f $HOME/.bash_funcs ]; then
    . $HOME/.bash_funcs
    fi

  3. Append following to ~/.bash_completion



    # Debian user-defined completion                             -*- shell-script -*-

    _ppa_lists(){
    local cur
    _init_completion || return

    COMPREPLY=( $( find /etc/apt/sources.list.d/ -name "*$cur*.list"
    -exec basename {} ; 2> /dev/null ) )
    return 0
    } &&
    complete -F _ppa_lists update-repo

  4. Then source the files



    . ~/.bashrc
    . ~/.bash_completion

  5. Done and start to fire it



    update-repo <tab> <tab>



You can update a single ppa repository without having to update whole apt source, with implement of bash-completion.


[#43130] Monday, May 1, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
pilun

Total Points: 270
Total Questions: 100
Total Answers: 94

Location: England
Member since Sat, Feb 13, 2021
3 Years ago
pilun questions
Thu, Sep 16, 21, 18:43, 3 Years ago
Mon, Aug 23, 21, 04:32, 3 Years ago
Wed, Sep 14, 22, 11:04, 2 Years ago
;