fi
}
-check_kernel_space() {
- local available_disk_space kernel_size linux_images metapkg pkg ret
- available_disk_space=$(free_space /)
+# calculate the list of linux-image packages from kernel-2.6-cn dependencies
+get_cn_kernels() {
+ local cn_kernels linux_images metapkg pkg
+
+ cn_kernels=
linux_images=$(apt-cache show kernel-2.6-cn | grep ^Depends: \
| grep -o 'linux-image[^, ]*')
for metapkg in $linux_images; do
pkg=$(apt-cache show $metapkg | grep ^Depends: \
| grep -o 'linux-image[^, ]*' | head -1)
- [ "$pkg" ] || continue
+ [ "$pkg" ] && cn_kernels="$cn_kernels $pkg"
+ done
+
+ echo $cn_kernels
+}
+# check if there is enough space on / for the new kernel package
+check_kernel_space() {
+ local available_disk_space kernel_size linux_images pkg ret
+ available_disk_space=$(free_space /)
+
+ linux_images=$( get_cn_kernels )
+ for pkg in $linux_images; do
kernel_size=$(installed_size $pkg)
ret=$?
[ $ret -eq 0 ] && break
fi
}
+# free some space on / partition by cleaning old unused kernels
+clean_old_kernels() {
+ local installed keep pkg keep remove delete name dialog_list selection
+
+ # find all installed kernels
+ installed=$(
+ dpkg -l | egrep '^ii linux-image-[0-9]+[.][0-9]+[.][0-9]+-' \
+ | awk '{print $2}'
+ )
+ log "Found kernel packages: $installed"
+
+ # leave current and new kernels
+ keep="linux-image-$(uname -r) $(get_cn_kernels)"
+ log "Keep kernel packages: $keep"
+
+ # check what to remove
+ remove=
+ for pkg in $installed; do
+ delete=yes
+ for name in $keep; do
+ [ "$pkg" = "$name" ] && delete=
+ done
+ if [ "$delete" = yes ]; then
+ remove="$remove $pkg"
+ fi
+ done
+ log "Obsolete kernel packages: $remove"
+
+ if [ "$remove" ]; then
+ for pkg in $remove; do
+ dialog_list="$dialog_list $pkg '' off"
+ done
+
+ # user selects the packages to delete
+ selection=$( mktemp /var/lib/carnet-upgrade/selection.XXXXXX )
+ eval LC_MESSAGES=hr_HR dialog --nocancel --backtitle \""$title"\" \
+ --checklist \""$msg_remove_kernels"\" 20 75 6 $dialog_list 2>$selection
+
+ selected=$( tr -d \" < $selection )
+ rm -f $selection
+
+ if [ "$selected" ]; then
+ log "Removing kernel packages: $selected"
+ pkgrm $selected
+ fi
+ fi
+}
+
+# prevent sysv-rc migration problems
+clean_initd_packages() {
+ local list removed pkg dialog_list selection selected
+
+ list=$( dpkg -S /etc/init.d/\* | grep -v ^diversion | cut -d: -f1 | sort -u )
+ removed=$( dpkg -l $list | sed -n 's/^r.[[:space:]]\+\([^[:space:]]\+\).*/\1/p' )
+ log "Found removed packages: $removed"
+
+ if [ "$removed" ]; then
+ for pkg in $removed; do
+ dialog_list="$dialog_list $pkg '' off"
+ done
+
+ # user selects the packages to delete
+ selection=$( mktemp /var/lib/carnet-upgrade/selection.XXXXXX )
+ eval LC_MESSAGES=hr_HR dialog --nocancel --backtitle \""$title"\" \
+ --checklist \""$msg_remove_initd"\" 20 75 6 $dialog_list 2>$selection
+
+ selected=$( tr -d \" < $selection )
+ rm -f $selection
+
+ if [ "$selected" ]; then
+ log "Purging packages: $selected"
+ dpkg -P $selected
+ fi
+ fi
+}
+
free_space() {
df --portability --block-size=1M "$1" | tail -1 | awk '{print $4}'
}
Odaberite servise koje zelite UKLONITI:
"
+msg_remove_kernels="Da bi se izbjeglo zapunjenje / particije preporuca se brisanje starih \
+kernela. U ovom koraku nudi se mogucnost uklanjanja nekoristenih \
+kernel paketa sa vaseg posluzitelja. Ukoliko zelite ukloniti neki od \
+trenutno instaliranih kernela ukljucite oznaku ispred imena odgovarajuceg \
+paketa.
+
+Odaberite pakete koje zelite UKLONITI:
+"
+
+msg_remove_initd="Nova inacica Debiana donosi mogucnost paralelnog pokretanja servisa \
+kod pokretanja posluzitelja. Da bi se proveo prijelaz na sustav paralelnog \
+pokretanja potrebno je obrisati nekoristene init skripte. Obicno \
+se radi o skriptama koje su ostale nakon nepotpunog brisanja paketa. \
+U ovom koraku nudi se mogucnost brisanja konfiguracija i init skripti \
+paketa koji su djelomicno obrisani. Ukoliko zelite ukloniti datoteke \
+preostale nakon brisanja paketa ukljucite oznaku ispred imena odgovarajuceg \
+paketa.
+
+Odaberite pakete cije konfiguracije i init skripte zelite UKLONITI:
+"
+
msg_comment_force_overwrite="U vasem /etc/dpkg/dpkg.cfg je pronadjena opcija\
force-overwrite koja nije preporucljiva za uobicajen rad. Ukoliko\
zelite, odkomentirajte je nakon zavrsetka rada skripte."