1
0
Fork 0

remove aptitude

This commit is contained in:
Luca Bilke 2023-02-16 18:59:33 +01:00
parent c7b1a476c5
commit 83a4973822
3 changed files with 32 additions and 21 deletions

View file

@ -1,7 +1,7 @@
#!/bin/sh
# sudo not required for some system commands
for command in mount umount sv pacman apt updatedb su shutdown poweroff reboot; do
for command in mount umount sv pacman apt aptitude updatedb su shutdown poweroff reboot; do
command -v $command 1>/dev/null 2>&1 && alias $command="sudo $command"
done
unset command

View file

@ -4,15 +4,30 @@
notify-send " Repository Sync" "Checking for package updates..."
sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates." "Check your internet connection, if pacman is already running, or run update manually to see errors."
pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
if command -v pacman; then
sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates." "Check your internet connection, if pacman is already running, or run update manually to see errors."
pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
if pacman -Qu | grep -v "\[ignored\]"; then
answer=$(
notify-send --action=Yes=Yes --action=No=No \
" Repository Sync" "Updates available. Update now?"
)
[ $answer -eq 1 ] && $TERMINAL -e upgrades
else
notify-send " Repository Sync" "Sync complete. No new packages for update."
if pacman -Qu | grep -v "\[ignored\]"; then
answer=$(
notify-send --action=Yes=Yes --action=No=No \
" Repository Sync" "Updates available. Update now?"
)
[ $answer -eq 1 ] && $TERMINAL -e upgrades
else
notify-send " Repository Sync" "Sync complete. No new packages for update."
fi
elif command -v apt; then
n=$(sudo apt upgrade -dy 2>/dev/null | grep -m1 '^[0-9]\+ upgraded,' | tr -cd '0-9' | cut -c1-2)
if [ "$n" = '' ]; then
notify-send "Error downloading updates." "Check your internet connection, if pacman is already running, or run update manually to see errors."
elif [ "$n" = 00 ]; then
notify-send " Repository Sync" "Sync complete. No new packages for update."
else
notify-send --action=Yes=Yes --action=No=No \
" Repository Sync" "Updates available. Update now?"
[ "$answer" = 1 ] && $TERMINAL -e upgrades
fi
pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
fi

View file

@ -1,19 +1,15 @@
#!/bin/sh
command -v pacman 1>/dev/null 2>&1 && echo -n "$(pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/ /;s/^ 0$//g")"
if command -v pacman 1>/dev/null 2>&1; then
echo -n "$(pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/ /;s/^ 0$//g")"
fi
if command -v aptitude 1>/dev/null 2>&1; then
vals=$(aptitude full-upgrade --simulate --assume-yes |
grep -m1 '^[0-9]\+ packages upgraded,' |
tr -cd '0-9 ' |
tr ' ' '\n' |
grep '[0-9]\+' |
xargs echo)
if command -v apt 1>/dev/null 2>&1; then
vals=$(apt upgrade -sy | grep -m1 '^[0-9]\+ upgraded,' | tr -cd '0-9 ' | tr ' ' '\n' | grep '[0-9]\+' | xargs echo)
print=" "
for i in $vals; do
[ $i != 0 ] && icon="\033[11m\033[10m"
print="$print$i/"
done
[ -n "$icon" ] && printf "$icon " && echo "$print" | sed 's/\/$//'
[ -n "$icon" ] && printf "$icon " && echo " $print" | sed 's/\/$//'
fi