X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=src%2Ffunctions.sh;h=527742a7398c423eaef4673fd6b0cb909187f5af;hb=10ec3e3b569db35e08ccc350359401a515574de1;hp=19c76b32fe8fa67db34799e6338cd0b9ce0655b2;hpb=bfceaaf8132527d177dbce7e902b1dad88cacd0f;p=carnet-upgrade.git diff --git a/src/functions.sh b/src/functions.sh index 19c76b3..527742a 100644 --- a/src/functions.sh +++ b/src/functions.sh @@ -897,6 +897,30 @@ remove_skey () { fi } +# check if package is orphaned (nothing depends on it) +is_orphaned () { + local package deps + + package=$1 + deps=$(apt-get remove -s $package | grep ^Remv | wc -l) + if [ "$deps" -eq 1 ]; then + return 0 + else + return 1 + fi +} + +# remove old and unused libraries +remove_orphaned () { + local package + + for package in $orphaned_packages; do + if is_orphaned $package; then + pkgrm $package + fi + done +} + # monit it causing problems for postinst scripts # restarting daemons so try to disable it disable_monit () {