fac74012f81fc99eb2ba7a85e94a2cd74c352271
- Author
- Daniel Bolton <dbb@9y.com>
- Committer
- Daniel Bolton <dbb@9y.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
2index 0c487cf70bf4d810fd88b31ee0a141cce91d857c..1df91dc4a591226b6708f47c020962088cfdb524 100644
3--- a/plugins/debian/debian.plugin.zsh
4+++ b/plugins/debian/debian.plugin.zsh
5@@ -1,48 +1,76 @@
6-# https://github.com/dbb/
7+# Authors:
8+# https://github.com/AlexBio
9+# https://github.com/dbb
10 #
11 # Debian-related zsh aliases and functions for zsh
12
13+# Set to 'apt-get' or 'aptitude'
14+apt_pref='aptitude'
15+
16+# Use sudo by default if it's installed
17+if [[ -e $( which sudo ) ]]; then
18+ use_sudo=1
19+fi
20
21 # Aliases ###################################################################
22
23 # Some self-explanatory aliases
24 alias acs="apt-cache search"
25-alias afs='apt-file search --regexp'
26 alias aps='aptitude search'
27 alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \
28 --no-gui --disable-columns search" # search package
29-alias apsrc='apt-get source'
30-alias apv='apt-cache policy'
31-
32-# aliases that use su -c ##############
33-alias apdg='su -lc "aptitude update && aptitude safe-upgrade" root'
34-alias apud='su -lc "aptitude update" root'
35-alias apug='su -lc "aptitude safe-upgrade" root'
36-# end aliases that use su -c ##########
37-
38-# aliases that use sudo ###############
39-alias ad="sudo apt-get update" # update packages lists
40-alias au="sudo apt-get update && \
41- sudo apt-get dselect-upgrade" # upgrade packages
42-alias ai="sudo apt-get install" # install package
43-alias ar="sudo apt-get remove --purge && \
44- sudo apt-get autoremove --purge" # remove package
45-alias ac="sudo apt-get clean && sudo apt-get autoclean" # clean apt cache
46-# end aliases that use sudo ###########
47+
48+# apt-file
49+alias afs='apt-file search --regexp'
50+
51+
52+# These are apt-get only
53+alias asrc='apt-get source'
54+alias ap='apt-cache policy'
55+
56+# superuser operations ################
57+if [[ $use_sudo -eq 1 ]]; then
58+ alias ai="sudo $apt_pref install"
59+ alias ad="sudo $apt_pref update"
60+ alias afu='sudo apt-file update'
61+ alias ag="sudo $apt_pref upgrade"
62+ alias adg="sudo $apt_pref update && sudo $apt_pref upgrade"
63+ alias ap="sudo $apt_pref purge"
64+ alias ar="sudo $apt_pref remove"
65+
66+ if [[ $apt_pref -eq 'apt-get' ]]; then
67+ alias ads="sudo $apt_pref dselect-upgrade"
68+ fi
69+
70+ # Install all .deb files in the current directory.
71+ # Warning: you will need to put the glob in single quotes if you use:
72+ # glob_subst
73+ alias di='sudo dpkg -i ./*.deb'
74+
75+ # Remove ALL kernel images and headers EXCEPT the one in use
76+ alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))'
77+else
78+ alias ai='apin'
79+ alias ad='su -lc "'"$apt_pref"' update" root'
80+ alias afu='su -lc "apt-file update"'
81+ alias ag='su -lc "'"$apt_pref"' safe-upgrade" root'
82+ alias adg='su -lc "'"$apt_pref"' update && aptitude safe-upgrade" root'
83+ alias di='su -lc "dpkg -i ./*.deb" root'
84+ # Remove ALL kernel images and headers EXCEPT the one in use
85+ alias kclean='su -lc '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))'\'' root'
86+fi
87+# end superuser operations ##########
88+
89
90 # print all installed packages
91 alias allpkgs='aptitude search -F "%p" --disable-columns ~i'
92
93-# Install all .deb files in the current directory.
94-# Warning: you will need to put the glob in single quotes if you use:
95-# glob_subst
96-alias di='su -lc "dpkg -i ./*.deb" root'
97+
98
99 # Create a basic .deb package
100 alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
101
102-# Remove ALL kernel images and headers EXCEPT the one in use
103-alias kclean='su -lc '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))'\'' root'
104+