Skip to content

Instantly share code, notes, and snippets.

@vasilisp
Created February 14, 2015 09:04
Show Gist options
  • Save vasilisp/6615b779d4d155ffb6dd to your computer and use it in GitHub Desktop.
Save vasilisp/6615b779d4d155ffb6dd to your computer and use it in GitHub Desktop.
Aptitude Helper Functions
#!/bin/sh
constraint () { echo -n $@ ' '; }
not () { echo -n '! '; }
installed () { constraint '~i'; }
auto () { constraint '~M'; }
open_paren () { echo -n '('; }
close_paren () { echo -n ')'; }
my_important () {
open_paren
constraint '~pimportant'
not; constraint '^systemd'
close_paren
}
my_standard () {
open_paren;
constraint '~pstandard'
# exclude libs
not; constraint '^lib'
not; constraint '?section(libs)'
not; constraint '?section(perl)'
not; constraint '?section(python)'
# exclude daemons I don't need
not; constraint '^rpcbind$'
not; constraint '^nfs-common$'
not; constraint '^dbus$'
not; constraint '^exim4'
not; constraint '^at$'
# mail-transport-agent dependency causes trouble
not; constraint '^bsd-mailx$'
close_paren
}
base_system () {
constraint "(~prequired | $(my_important) | $(my_standard))"
}
manual () {
installed
not; auto
not; base_system
}
manual_libs () {
manual
constraint '^lib'
not; constraint '^libre'
}
redundant () {
installed
auto
not; base_system
not; constraint '?reverse-depends(~i)'
}
missing () {
not; installed
base_system
}
false_auto () {
auto
base_system
}
unset constraint
unset not
unset open_paren
unset close_paren
[ ! -x $1 ] || exit 1
$1
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment