| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,60 @@ |
| 0 |
+# https://github.com/dbbolton/ |
|
| 1 |
+# |
|
| 2 |
+# Debian-related zsh aliases and functions for zsh |
|
| 3 |
+ |
|
| 4 |
+ |
|
| 5 |
+# Aliases ################################################################### |
|
| 6 |
+ |
|
| 7 |
+# Some self-explanatory aliases |
|
| 8 |
+alias afs='apt-file search --regexp' |
|
| 9 |
+alias aps='aptitude search' |
|
| 10 |
+alias apsrc='apt-get source' |
|
| 11 |
+alias apv='apt-cache policy' |
|
| 12 |
+ |
|
| 13 |
+alias apdg='su -c "aptitude update && aptitude safe-upgrade"' |
|
| 14 |
+alias apud='su -c "aptitude update"' |
|
| 15 |
+alias apug='su -c "aptitude safe-upgrade"' |
|
| 16 |
+ |
|
| 17 |
+# print all installed packages |
|
| 18 |
+alias allpkgs='aptitude search -F "%p" --disable-columns ~i' |
|
| 19 |
+ |
|
| 20 |
+# Install all .deb files in the current directory. |
|
| 21 |
+# Warning: you will need to put the glob in single quotes if you use: |
|
| 22 |
+# glob_subst |
|
| 23 |
+alias di='su -c "dpkg -i ./*.deb"' |
|
| 24 |
+ |
|
| 25 |
+# Create a basic .deb package |
|
| 26 |
+alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' |
|
| 27 |
+ |
|
| 28 |
+# Remove ALL kernel images and headers EXCEPT the one in use |
|
| 29 |
+alias kclean='su -c '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))'\'' root' |
|
| 30 |
+ |
|
| 31 |
+ |
|
| 32 |
+ |
|
| 33 |
+# Functions ################################################################# |
|
| 34 |
+ |
|
| 35 |
+# create a simple script that can be used to 'duplicate' a system |
|
| 36 |
+apt-copy() {
|
|
| 37 |
+ print '#!/bin/sh'"\n" > apt-copy.sh |
|
| 38 |
+ |
|
| 39 |
+ list=$(perl -m'AptPkg::Cache' -e '$c=AptPkg::Cache->new; for (keys %$c){ push @a, $_ if $c->{$_}->{'CurrentState'} eq 'Installed';} print "$_ " for sort @a;')
|
|
| 40 |
+ |
|
| 41 |
+ print 'aptitude install '"$list\n" >> apt-copy.sh |
|
| 42 |
+ |
|
| 43 |
+ chmod +x apt-copy.sh |
|
| 44 |
+} |
|
| 45 |
+ |
|
| 46 |
+ |
|
| 47 |
+# Kernel-package building shortcut |
|
| 48 |
+dbb-build () {
|
|
| 49 |
+ MAKEFLAGS='' # temporarily unset MAKEFLAGS ( '-j3' will fail ) |
|
| 50 |
+ appendage='-custom' # this shows up in $ (uname -r ) |
|
| 51 |
+ revision=$(date +"%Y%m%d") # this shows up in the .deb file name |
|
| 52 |
+ |
|
| 53 |
+ make-kpkg clean |
|
| 54 |
+ |
|
| 55 |
+ time fakeroot make-kpkg --append-to-version "$appendage" --revision \ |
|
| 56 |
+ "$revision" kernel_image kernel_headers |
|
| 57 |
+} |
|
| 58 |
+ |
|
| 59 |
+ |