apt-get update only for a specific repository
yes, apt-get can do that, and can do it in a nice way.
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 }
Append following to
~/.bashrc
if [ -f $HOME/.bash_funcs ]; then . $HOME/.bash_funcs fi
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
Then source the files
. ~/.bashrc . ~/.bash_completion
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.
If the repository is configured in a specific file in the directory /etc/apt/sources.list.d/
, say myrepo.list
, you can update that single repository with the command:
sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/myrepo.list" \
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
Nevertheless this is not very convenient.
This can be simplified defining a bash function
update_repo() {
sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/$1.list" \
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
}
so that you can simply run
update_repo myrepo
Y PPA Manager comes with a command line tool called update-ppa
that lets you update a single PPA.
For example:
sudo update-ppa ppa:nilarimogard/webupd8
Also, when adding a PPA through Y PPA Manager, the PPA source is automatically updated (only for that PPA). In a future version, there's going to be a GUI to manually update single PPAs as well.
More information about Y PPA Manager, HERE.