fixed the empty dpkg.log condition

This commit is contained in:
malachma 2020-09-11 13:09:29 +02:00
Родитель 06046831b9
Коммит 7ce7dcce3a
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -13,6 +13,12 @@ recover_suse() {
} }
recover_ubuntu() { recover_ubuntu() {
if [[ ! -e /var/log/dpkg.log ]]; then
Log-Error "dpkg.log does not exist. This is a vanilla system with no previous kernel version installed. Nothing to do."
Log-Error "If you are sure there exists more than one kernel please do a manual recover "
return
fi
kernel_version=$( zgrep linux-image /var/log/dpkg.log* | grep installed | cut -d' ' -f5 | cut -d':' -f1 | sed -e 's/linux-image-//' | grep ^[1-9] | sort -V | tail -n 1) kernel_version=$( zgrep linux-image /var/log/dpkg.log* | grep installed | cut -d' ' -f5 | cut -d':' -f1 | sed -e 's/linux-image-//' | grep ^[1-9] | sort -V | tail -n 1)
# This is needed on Debian only # This is needed on Debian only
if [[ -e /boot/initrd.img-${kernel_version} ]]; then if [[ -e /boot/initrd.img-${kernel_version} ]]; then