if [ -x /usr/bin/update-desktop-database ]; then
  /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
fi

if [ -x /usr/bin/update-mime-database ]; then
  /usr/bin/update-mime-database usr/share/mime >/dev/null 2>&1
fi

# If other icon themes are installed, then add to/modify this as needed
if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
  if [ -x /usr/bin/gtk-update-icon-cache ]; then
    /usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor >/dev/null 2>&1
  fi
fi

if [ -e usr/share/glib-2.0/schemas ]; then
  if [ -x /usr/bin/glib-compile-schemas ]; then
    /usr/bin/glib-compile-schemas usr/share/glib-2.0/schemas >/dev/null 2>&1
  fi
fi

getent group tss >/dev/null || groupadd -r tss
getent passwd tss >/dev/null || \
    useradd -r -g tss -d / -s /sbin/nologin \
    -c "Account used for TPM access" tss

( cd usr/lib64 ; rm -rf libtss2-esys.so )
( cd usr/lib64 ; ln -sf libtss2-esys.so.0.0.1 libtss2-esys.so )
( cd usr/lib64 ; rm -rf libtss2-esys.so.0 )
( cd usr/lib64 ; ln -sf libtss2-esys.so.0.0.1 libtss2-esys.so.0 )
( cd usr/lib64 ; rm -rf libtss2-fapi.so )
( cd usr/lib64 ; ln -sf libtss2-fapi.so.1.0.0 libtss2-fapi.so )
( cd usr/lib64 ; rm -rf libtss2-fapi.so.1 )
( cd usr/lib64 ; ln -sf libtss2-fapi.so.1.0.0 libtss2-fapi.so.1 )
( cd usr/lib64 ; rm -rf libtss2-mu.so )
( cd usr/lib64 ; ln -sf libtss2-mu.so.0.0.1 libtss2-mu.so )
( cd usr/lib64 ; rm -rf libtss2-mu.so.0 )
( cd usr/lib64 ; ln -sf libtss2-mu.so.0.0.1 libtss2-mu.so.0 )
( cd usr/lib64 ; rm -rf libtss2-policy.so )
( cd usr/lib64 ; ln -sf libtss2-policy.so.0.0.0 libtss2-policy.so )
( cd usr/lib64 ; rm -rf libtss2-policy.so.0 )
( cd usr/lib64 ; ln -sf libtss2-policy.so.0.0.0 libtss2-policy.so.0 )
( cd usr/lib64 ; rm -rf libtss2-rc.so )
( cd usr/lib64 ; ln -sf libtss2-rc.so.0.0.0 libtss2-rc.so )
( cd usr/lib64 ; rm -rf libtss2-rc.so.0 )
( cd usr/lib64 ; ln -sf libtss2-rc.so.0.0.0 libtss2-rc.so.0 )
( cd usr/lib64 ; rm -rf libtss2-sys.so )
( cd usr/lib64 ; ln -sf libtss2-sys.so.1.0.1 libtss2-sys.so )
( cd usr/lib64 ; rm -rf libtss2-sys.so.1 )
( cd usr/lib64 ; ln -sf libtss2-sys.so.1.0.1 libtss2-sys.so.1 )
( cd usr/lib64 ; rm -rf libtss2-tcti-cmd.so )
( cd usr/lib64 ; ln -sf libtss2-tcti-cmd.so.0.0.0 libtss2-tcti-cmd.so )
( cd usr/lib64 ; rm -rf libtss2-tcti-cmd.so.0 )
( cd usr/lib64 ; ln -sf libtss2-tcti-cmd.so.0.0.0 libtss2-tcti-cmd.so.0 )
( cd usr/lib64 ; rm -rf libtss2-tcti-device.so )
( cd usr/lib64 ; ln -sf libtss2-tcti-device.so.0.0.0 libtss2-tcti-device.so )
( cd usr/lib64 ; rm -rf libtss2-tcti-device.so.0 )
( cd usr/lib64 ; ln -sf libtss2-tcti-device.so.0.0.0 libtss2-tcti-device.so.0 )
( cd usr/lib64 ; rm -rf libtss2-tcti-mssim.so )
( cd usr/lib64 ; ln -sf libtss2-tcti-mssim.so.0.0.0 libtss2-tcti-mssim.so )
( cd usr/lib64 ; rm -rf libtss2-tcti-mssim.so.0 )
( cd usr/lib64 ; ln -sf libtss2-tcti-mssim.so.0.0.0 libtss2-tcti-mssim.so.0 )
( cd usr/lib64 ; rm -rf libtss2-tcti-pcap.so )
( cd usr/lib64 ; ln -sf libtss2-tcti-pcap.so.0.0.0 libtss2-tcti-pcap.so )
( cd usr/lib64 ; rm -rf libtss2-tcti-pcap.so.0 )
( cd usr/lib64 ; ln -sf libtss2-tcti-pcap.so.0.0.0 libtss2-tcti-pcap.so.0 )
( cd usr/lib64 ; rm -rf libtss2-tcti-spi-helper.so )
( cd usr/lib64 ; ln -sf libtss2-tcti-spi-helper.so.0.0.0 libtss2-tcti-spi-helper.so )
( cd usr/lib64 ; rm -rf libtss2-tcti-spi-helper.so.0 )
( cd usr/lib64 ; ln -sf libtss2-tcti-spi-helper.so.0.0.0 libtss2-tcti-spi-helper.so.0 )
( cd usr/lib64 ; rm -rf libtss2-tcti-swtpm.so )
( cd usr/lib64 ; ln -sf libtss2-tcti-swtpm.so.0.0.0 libtss2-tcti-swtpm.so )
( cd usr/lib64 ; rm -rf libtss2-tcti-swtpm.so.0 )
( cd usr/lib64 ; ln -sf libtss2-tcti-swtpm.so.0.0.0 libtss2-tcti-swtpm.so.0 )
( cd usr/lib64 ; rm -rf libtss2-tctildr.so )
( cd usr/lib64 ; ln -sf libtss2-tctildr.so.0.0.0 libtss2-tctildr.so )
( cd usr/lib64 ; rm -rf libtss2-tctildr.so.0 )
( cd usr/lib64 ; ln -sf libtss2-tctildr.so.0.0.0 libtss2-tctildr.so.0 )
