File: //var/lib/dpkg/info/nvme-cli.postinst
#!/bin/sh
set -e
if [ "$1" = "configure" ] && dpkg --compare-versions "$2" le-nl "1.9-1ubuntu0.1~"; then
# we rm_conffile due to LP:#1867366, so maybe restore them based on bug comment 17
if [ ! -f /etc/nvme/hostid ] && [ ! -f /etc/nvme/hostnqn ]; then
if [ -f /etc/nvme/hostid.dpkg-backup ]; then
# hostid was modified, keep it
mv -f /etc/nvme/hostid.dpkg-backup /etc/nvme/hostid
fi
if [ -f /etc/nvme/hostnqn.dpkg-backup ]; then
# hostnqn was modified, keep it
mv -f /etc/nvme/hostnqn.dpkg-backup /etc/nvme/hostnqn
if [ -f /etc/nvme/hostid.dpkg-remove ] && [ ! -f /etc/nvme/hostid ]; then
echo "WARNING: /etc/nvme/hostid is not unique, you should regenerate it (LP:#1867366)"
mv -f /etc/nvme/hostid.dpkg-remove /etc/nvme/hostid
fi
fi
fi
fi
if [ "$1" = "configure" ]; then
if [ ! -s /etc/nvme/hostnqn ]; then
nvme gen-hostnqn > /etc/nvme/hostnqn
fi
if [ ! -s /etc/nvme/hostid ]; then
uuidgen > /etc/nvme/hostid
fi
fi
# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper rm_conffile /etc/nvme/hostid 1.9-1ubuntu0.1~ nvme-cli -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper rm_conffile /etc/nvme/hostnqn 1.9-1ubuntu0.1~ nvme-cli -- "$@"
# End automatically added section
exit 0