Rpm
Suse:從 /var/adm/backup/rpmdb/Packages-20160323 .gz 恢復軟體包列表
在 Suse-Linux 上,您已壓縮了 rpmdb 的備份: https ://www.novell.com/documentation/suse91/suselinux-adminguide/html/ch02s03.html#sec:rpm.anfragen
但是我怎樣才能從這個文件中獲取所有已安裝包的列表呢?
如果我解壓縮它,它是這個文件類型:
file Packages-20160323 Packages-20160323: Berkeley DB (Hash, version 8, native byte-order)
我試過
rpm --dbpath
了,但這個選項需要一個目錄而不是 berkley-db-file….
我找到了這個解決方案:
#!/bin/bash # get-package-list-from-backup.sh set -e set -x cd /var/adm/backup/rpmdb for gzipfile in *.gz; do ( base=${gzipfile/.gz/} dir=/var/tmp/rpmdb-restore-$base mkdir $dir cp $gzipfile $dir cd $dir gunzip $gzipfile; mv $base Packages rpm --dbpath $dir -qa | sort > qa.list ) done
現在我可以看到不同之處:
vimdiff /var/tmp/rpmdb-restore-Packages-20150625/qa.list /var/tmp/rpmdb-restore-Packages-20160311/qa.list