/usr/share/pkg-perl-tools/lib/posix-lib.sh is in pkg-perl-tools 0.42.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | # shell functions library
# to be sourced, not executed
# Copyright (c) 2013 Damyan Ivanov <dmn@debian.org>
# This program is free software; you can redistribute it and/or modify
# it under the terms of either:
#
# a) the GNU General Public License as published by the Free Software
# Foundation; either version 1, or (at your option) any later
# version, or
#
# b) the "Artistic License" which comes with Perl.
#
# the purpose of this is to parse the output of 'dpt checkout' and 'dpt cd'
# commands and change the CWD accordingly
dpt() {
local REAL TMP ES
REAL=`command which dpt`
ES=0
case "$1" in
cd|co|checkout)
# continue below
;;
*)
$REAL "$@" || ES=$?
return $ES
;;
esac
TMP=`mktemp -d --suffix=.dpt`
if [ -n "${BASH:-}" ]; then
trap "command rm -rf '$TMP'" RETURN
else
trap "command rm -rf '$TMP'" EXIT
fi
mkfifo "$TMP/pipe"
(
set +m
tee "$TMP/out" < "$TMP/pipe" &
)
$REAL "$@" > "$TMP/pipe" || ES=$?
[ -e "$TMP/out" ] || return $ES
if [ `egrep -c "^Updating existing checkout in .+" "$TMP/out"` = 1 ]; then
DIR=`egrep '^Updating existing' "$TMP/out" | sed -e 's/Updating existing checkout in //'`
cd "$DIR"
return $ES
fi
if [ `egrep -c "^.+ ready in .+" "$TMP/out"` = 1 ]; then
DIR=`egrep ' ready in ' "$TMP/out" | sed -e 's/.\+ ready in //'`
cd "$DIR"
return $ES
fi
if [ `egrep -c "^Package .+ is in .+" "$TMP/out"` = 1 ]; then
DIR=`egrep '^Package .+ is in ' "$TMP/out" | sed -e 's/^Package .\+ is in //'`
cd "$DIR"
return $ES
fi
return $ES
}
|