if dpkg -s -- "$@" &>/dev/null; then
return 0
fi
- pupdate
- local s; [[ $EUID != 0 ]] && s=sudo
- $s apt-get -y install --purge --auto-remove "$@"
- }
- pi() {
- if dpkg -s -- "$@" &>/dev/null; then
- return 0
- fi
+ while fuser /var/lib/dpkg/lock &>/dev/null; do sleep 1; done
pupdate
local s; [[ $EUID != 0 ]] && s=sudo
$s $PI_PREFIX apt-get -y install --purge --auto-remove "$@"
if dpkg -s -- "$@" &>/dev/null; then
return 0
fi
+ while fuser /var/lib/dpkg/lock &>/dev/null; do sleep 1; done
pupdate
local s; [[ $EUID != 0 ]] && s=sudo
local f=/usr/sbin/policy-rc.d
}
pu() {
local s; [[ $EUID != 0 ]] && s=sudo
+ while fuser /var/lib/dpkg/lock &>/dev/null; do sleep 1; done
$s apt-get -y remove --purge --auto-remove "$@"
# seems slightly redundant, but it removes more stuff sometimes.
$s apt-get -y autoremove
}
pup() { # upgrade
+ while fuser /var/lib/dpkg/lock &>/dev/null; do sleep 1; done
pupdate
local s; [[ $EUID != 0 ]] && s=sudo
$s apt-get -y dist-upgrade --purge --auto-remove "$@"