diff options
author | Moritz Lüdecke | 2015-06-08 15:43:01 +0200 |
---|---|---|
committer | Moritz Lüdecke | 2015-06-08 15:43:01 +0200 |
commit | 448b3919929b485d5421a4d70a4bdf89ea8c2e06 (patch) | |
tree | fac7e33e9b81b60fdb4e3c8a7102c1eb25088a4c | |
download | aur-448b3919929b485d5421a4d70a4bdf89ea8c2e06.tar.gz |
Initial import
-rw-r--r-- | .SRCINFO | 15 | ||||
-rw-r--r-- | PKGBUILD | 21 | ||||
-rwxr-xr-x | dfp | 55 |
3 files changed, 91 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..83a876bbc2d3 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,15 @@ +pkgbase = dfp + pkgdesc = df with progress bar in pacman style + pkgver = 20141004 + pkgrel = 1 + url = https://github.com/ritze/dfp + arch = any + license = GPL + makedepends = git + depends = bash + depends = pbar + source = dfp::git+https://github.com/ritze/dfp.git#branch=master + md5sums = SKIP + +pkgname = dfp + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..8816b322a25b --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,21 @@ +# Maintainer: Moritz Luedecke <ritze@skweez.net> +pkgname=dfp +pkgver=20141004 +pkgrel=1 +pkgdesc="df with progress bar in pacman style" +url="https://github.com/ritze/dfp" +license="GPL" +arch=('any') +makedepends=('git') +depends=('bash' 'pbar') +source=("${pkgname}::git+https://github.com/ritze/dfp.git#branch=master") +md5sums=('SKIP') + +pkgver() { + cd "$pkgname" + git show -s --format="%ci" HEAD | sed -e 's/-//g' -e 's/ .*//' +} + +package() { + install -Dm755 "$srcdir/$pkgname/dfp" "$pkgdir/usr/bin/dfp" +} @@ -0,0 +1,55 @@ +#!/bin/bash + +DF="/usr/bin/df" + +usage() { + echo 'usage: dfp [-p PREFIX] DEVICE...' + echo + echo ' -p print given prefix at the begin of each line' + echo ' -h display this help and exit' + exit +} + +while getopts ":hp:" optname; do + case "$optname" in + "p") + prefix=$OPTARG + ;; + "h") + usage + ;; + "?") + echo "Unknown option $OPTARG" + usage + ;; + ":") + echo "No argument value for option $OPTARG" + ;; + *) + echo "Unknown error while processing options" + ;; + esac +done + +IFS=$"NUL" +declare -a args=${@:$OPTIND} +[[ ${args:0} ]] || args=$(df --output=target | tail --lines=+2 | tr "\n" $"NUL") + +for device in $args; do + if ! [[ "$($DF $device)" ]]; then + usage + fi +done + +for device in $args; do + size="$($DF $device --output=size | tail --lines=+2)" + avail="$($DF $device --output=avail | tail --lines=+2)" + used="$((size - avail))" + + availh="$($DF -h $device --output=avail | tail --lines=+2)" + sizeh="$($DF -h $device --output=size | tail --lines=+2)" + misc="$availh$sizeh" + title="$prefix$device" + + pbar -n $used $size "$title" "$misc" +done |