From: Valentin Vidic Date: Fri, 24 Apr 2009 11:27:06 +0000 (+0200) Subject: Remove orphaned package libsensors3. X-Git-Tag: debian/5.0.0~39 X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=carnet-upgrade.git;a=commitdiff_plain;h=10ec3e3b569db35e08ccc350359401a515574de1 Remove orphaned package libsensors3. Package postinst tries to write into read-only /dev/.static/dev. --- diff --git a/src/actions/main.queue b/src/actions/main.queue index a550b9f..61cf51c 100644 --- a/src/actions/main.queue +++ b/src/actions/main.queue @@ -45,6 +45,7 @@ pkg ntp && pkg ntpdate pkgadd lockfile-progs true upgrade_postgresql true upgrade first # neki paketi moraju rucno true upgrade second # neke pakete zelimo ranije +true remove_orphaned # ocisti stare libove nakon sto su cn paketi nadogradjeni true dist_upgrade # instaliraj ostatak # i ostatak true debconf_priority reset diff --git a/src/data.sh b/src/data.sh index e4d0bbb..d4af23f 100644 --- a/src/data.sh +++ b/src/data.sh @@ -110,6 +110,12 @@ webalizer-cn webalizer xinetd-cn xinetd ' +# simulate deborphan +orphaned_packages=' +libsnmp9 +libsensors3 +' + # Check if these services are running after upgrade # package-cn user proces (pazi, regexp) nice name services_to_check=' 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 () {