if [ -x /usr/bin/update-desktop-database ]; then
  /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
fi
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
which_node=$(which node 2>/dev/null)
if [ $? -eq 0 ]; then
    ln -sf "$which_node" "/usr/share/stremio/node"
else
    ln -sf "/usr/bin/node" "/usr/share/stremio/node"
fi
( cd usr/bin ; rm -rf stremio )
( cd usr/bin ; ln -sf /usr/share/stremio/stremio stremio )
( cd usr/share/icons/hicolor/128x128/apps ; rm -rf smartcode-stremio-tray.png )
( cd usr/share/icons/hicolor/128x128/apps ; ln -sf /usr/share/stremio/icons/smartcode-stremio-tray_128.png smartcode-stremio-tray.png )
( cd usr/share/icons/hicolor/128x128/apps ; rm -rf smartcode-stremio.png )
( cd usr/share/icons/hicolor/128x128/apps ; ln -sf /usr/share/stremio/icons/smartcode-stremio_128.png smartcode-stremio.png )
( cd usr/share/icons/hicolor/16x16/apps ; rm -rf smartcode-stremio-tray.png )
( cd usr/share/icons/hicolor/16x16/apps ; ln -sf /usr/share/stremio/icons/smartcode-stremio-tray_16.png smartcode-stremio-tray.png )
( cd usr/share/icons/hicolor/16x16/apps ; rm -rf smartcode-stremio.png )
( cd usr/share/icons/hicolor/16x16/apps ; ln -sf /usr/share/stremio/icons/smartcode-stremio_16.png smartcode-stremio.png )
( cd usr/share/icons/hicolor/22x22/apps ; rm -rf smartcode-stremio-tray.png )
( cd usr/share/icons/hicolor/22x22/apps ; ln -sf /usr/share/stremio/icons/smartcode-stremio-tray_22.png smartcode-stremio-tray.png )
( cd usr/share/icons/hicolor/22x22/apps ; rm -rf smartcode-stremio.png )
( cd usr/share/icons/hicolor/22x22/apps ; ln -sf /usr/share/stremio/icons/smartcode-stremio_22.png smartcode-stremio.png )
( cd usr/share/icons/hicolor/24x24/apps ; rm -rf smartcode-stremio-tray.png )
( cd usr/share/icons/hicolor/24x24/apps ; ln -sf /usr/share/stremio/icons/smartcode-stremio-tray_24.png smartcode-stremio-tray.png )
( cd usr/share/icons/hicolor/24x24/apps ; rm -rf smartcode-stremio.png )
( cd usr/share/icons/hicolor/24x24/apps ; ln -sf /usr/share/stremio/icons/smartcode-stremio_24.png smartcode-stremio.png )
( cd usr/share/icons/hicolor/32x32/apps ; rm -rf smartcode-stremio-tray.png )
( cd usr/share/icons/hicolor/32x32/apps ; ln -sf /usr/share/stremio/icons/smartcode-stremio-tray_32.png smartcode-stremio-tray.png )
( cd usr/share/icons/hicolor/32x32/apps ; rm -rf smartcode-stremio.png )
( cd usr/share/icons/hicolor/32x32/apps ; ln -sf /usr/share/stremio/icons/smartcode-stremio_32.png smartcode-stremio.png )
( cd usr/share/icons/hicolor/64x64/apps ; rm -rf smartcode-stremio-tray.png )
( cd usr/share/icons/hicolor/64x64/apps ; ln -sf /usr/share/stremio/icons/smartcode-stremio-tray_64.png smartcode-stremio-tray.png )
( cd usr/share/icons/hicolor/64x64/apps ; rm -rf smartcode-stremio.png )
( cd usr/share/icons/hicolor/64x64/apps ; ln -sf /usr/share/stremio/icons/smartcode-stremio_64.png smartcode-stremio.png )
