# Update the desktop database:
if [ -x usr/bin/update-desktop-database ]; then
  chroot . /usr/bin/update-desktop-database usr/share/applications > /dev/null 2>&1
fi

# Update hicolor theme cache:
if [ -d usr/share/icons/hicolor ]; then
  if [ -x /usr/bin/gtk-update-icon-cache ]; then
    chroot . /usr/bin/gtk-update-icon-cache -f -t usr/share/icons/hicolor 1> /dev/null 2> /dev/null
  fi
fi

# Update the mime database:
if [ -x usr/bin/update-mime-database ]; then
  chroot . /usr/bin/update-mime-database usr/share/mime >/dev/null 2>&1
fi

( cd usr/lib64/carla ; rm -rf resources )
( cd usr/lib64/carla ; ln -sf ../../share/carla/resources resources )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf carla-bridge-lv2-gtk2 )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/carla-bridge-lv2-gtk2 carla-bridge-lv2-gtk2 )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf carla-bridge-lv2-gtk3 )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/carla-bridge-lv2-gtk3 carla-bridge-lv2-gtk3 )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf carla-bridge-lv2-modgui )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/carla-bridge-lv2-modgui carla-bridge-lv2-modgui )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf carla-bridge-lv2-qt5 )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/carla-bridge-lv2-qt5 carla-bridge-lv2-qt5 )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf carla-bridge-lv2-x11 )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/carla-bridge-lv2-x11 carla-bridge-lv2-x11 )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf carla-bridge-lv2.so )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/carla-bridge-lv2.so carla-bridge-lv2.so )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf carla-bridge-native )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/carla-bridge-native carla-bridge-native )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf carla-bridge-win32.exe )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/carla-bridge-win32.exe carla-bridge-win32.exe )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf carla-bridge-win64.exe )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/carla-bridge-win64.exe carla-bridge-win64.exe )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf carla-discovery-native )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/carla-discovery-native carla-discovery-native )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf carla-discovery-win32.exe )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/carla-discovery-win32.exe carla-discovery-win32.exe )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf carla-discovery-win64.exe )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/carla-discovery-win64.exe carla-discovery-win64.exe )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf jack )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/jack jack )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf jackbridge-wine32.dll )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/jackbridge-wine32.dll jackbridge-wine32.dll )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf jackbridge-wine64.dll )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/jackbridge-wine64.dll jackbridge-wine64.dll )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf libcarla_host-plugin.so )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/libcarla_host-plugin.so libcarla_host-plugin.so )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf libcarla_interposer-jack-x11.so )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/libcarla_interposer-jack-x11.so libcarla_interposer-jack-x11.so )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf libcarla_interposer-safe.so )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/libcarla_interposer-safe.so libcarla_interposer-safe.so )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf libcarla_interposer-x11.so )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/libcarla_interposer-x11.so libcarla_interposer-x11.so )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf libcarla_native-plugin.so )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/libcarla_native-plugin.so libcarla_native-plugin.so )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf libcarla_utils.so )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/libcarla_utils.so libcarla_utils.so )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf resources )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../../share/carla/resources resources )
( cd usr/lib64/lv2/carla.lv2 ; rm -rf styles )
( cd usr/lib64/lv2/carla.lv2 ; ln -sf ../../carla/styles styles )
( cd usr/lib64/vst/carla.vst ; rm -rf carla-bridge-lv2-gtk2 )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/carla-bridge-lv2-gtk2 carla-bridge-lv2-gtk2 )
( cd usr/lib64/vst/carla.vst ; rm -rf carla-bridge-lv2-gtk3 )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/carla-bridge-lv2-gtk3 carla-bridge-lv2-gtk3 )
( cd usr/lib64/vst/carla.vst ; rm -rf carla-bridge-lv2-modgui )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/carla-bridge-lv2-modgui carla-bridge-lv2-modgui )
( cd usr/lib64/vst/carla.vst ; rm -rf carla-bridge-lv2-qt5 )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/carla-bridge-lv2-qt5 carla-bridge-lv2-qt5 )
( cd usr/lib64/vst/carla.vst ; rm -rf carla-bridge-lv2-x11 )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/carla-bridge-lv2-x11 carla-bridge-lv2-x11 )
( cd usr/lib64/vst/carla.vst ; rm -rf carla-bridge-lv2.so )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/carla-bridge-lv2.so carla-bridge-lv2.so )
( cd usr/lib64/vst/carla.vst ; rm -rf carla-bridge-native )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/carla-bridge-native carla-bridge-native )
( cd usr/lib64/vst/carla.vst ; rm -rf carla-bridge-win32.exe )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/carla-bridge-win32.exe carla-bridge-win32.exe )
( cd usr/lib64/vst/carla.vst ; rm -rf carla-bridge-win64.exe )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/carla-bridge-win64.exe carla-bridge-win64.exe )
( cd usr/lib64/vst/carla.vst ; rm -rf carla-discovery-native )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/carla-discovery-native carla-discovery-native )
( cd usr/lib64/vst/carla.vst ; rm -rf carla-discovery-win32.exe )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/carla-discovery-win32.exe carla-discovery-win32.exe )
( cd usr/lib64/vst/carla.vst ; rm -rf carla-discovery-win64.exe )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/carla-discovery-win64.exe carla-discovery-win64.exe )
( cd usr/lib64/vst/carla.vst ; rm -rf jack )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/jack jack )
( cd usr/lib64/vst/carla.vst ; rm -rf jackbridge-wine32.dll )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/jackbridge-wine32.dll jackbridge-wine32.dll )
( cd usr/lib64/vst/carla.vst ; rm -rf jackbridge-wine64.dll )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/jackbridge-wine64.dll jackbridge-wine64.dll )
( cd usr/lib64/vst/carla.vst ; rm -rf libcarla_host-plugin.so )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/libcarla_host-plugin.so libcarla_host-plugin.so )
( cd usr/lib64/vst/carla.vst ; rm -rf libcarla_interposer-jack-x11.so )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/libcarla_interposer-jack-x11.so libcarla_interposer-jack-x11.so )
( cd usr/lib64/vst/carla.vst ; rm -rf libcarla_interposer-safe.so )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/libcarla_interposer-safe.so libcarla_interposer-safe.so )
( cd usr/lib64/vst/carla.vst ; rm -rf libcarla_interposer-x11.so )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/libcarla_interposer-x11.so libcarla_interposer-x11.so )
( cd usr/lib64/vst/carla.vst ; rm -rf libcarla_native-plugin.so )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/libcarla_native-plugin.so libcarla_native-plugin.so )
( cd usr/lib64/vst/carla.vst ; rm -rf libcarla_utils.so )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/libcarla_utils.so libcarla_utils.so )
( cd usr/lib64/vst/carla.vst ; rm -rf resources )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../../share/carla/resources resources )
( cd usr/lib64/vst/carla.vst ; rm -rf styles )
( cd usr/lib64/vst/carla.vst ; ln -sf ../../carla/styles styles )
( cd usr/share/carla/resources ; rm -rf carla_app.py )
( cd usr/share/carla/resources ; ln -sf ../carla_app.py carla_app.py )
( cd usr/share/carla/resources ; rm -rf carla_backend.py )
( cd usr/share/carla/resources ; ln -sf ../carla_backend.py carla_backend.py )
( cd usr/share/carla/resources ; rm -rf carla_backend_qt.py )
( cd usr/share/carla/resources ; ln -sf ../carla_backend_qt.py carla_backend_qt.py )
( cd usr/share/carla/resources ; rm -rf carla_database.py )
( cd usr/share/carla/resources ; ln -sf ../carla_database.py carla_database.py )
( cd usr/share/carla/resources ; rm -rf carla_host.py )
( cd usr/share/carla/resources ; ln -sf ../carla_host.py carla_host.py )
( cd usr/share/carla/resources ; rm -rf carla_host_control.py )
( cd usr/share/carla/resources ; ln -sf ../carla_host_control.py carla_host_control.py )
( cd usr/share/carla/resources ; rm -rf carla_settings.py )
( cd usr/share/carla/resources ; ln -sf ../carla_settings.py carla_settings.py )
( cd usr/share/carla/resources ; rm -rf carla_shared.py )
( cd usr/share/carla/resources ; ln -sf ../carla_shared.py carla_shared.py )
( cd usr/share/carla/resources ; rm -rf carla_skin.py )
( cd usr/share/carla/resources ; ln -sf ../carla_skin.py carla_skin.py )
( cd usr/share/carla/resources ; rm -rf carla_utils.py )
( cd usr/share/carla/resources ; ln -sf ../carla_utils.py carla_utils.py )
( cd usr/share/carla/resources ; rm -rf carla_widgets.py )
( cd usr/share/carla/resources ; ln -sf ../carla_widgets.py carla_widgets.py )
( cd usr/share/carla/resources ; rm -rf externalui.py )
( cd usr/share/carla/resources ; ln -sf ../externalui.py externalui.py )
( cd usr/share/carla/resources ; rm -rf modgui )
( cd usr/share/carla/resources ; ln -sf ../modgui modgui )
( cd usr/share/carla/resources ; rm -rf patchcanvas )
( cd usr/share/carla/resources ; ln -sf ../patchcanvas patchcanvas )
( cd usr/share/carla/resources ; rm -rf resources_rc.py )
( cd usr/share/carla/resources ; ln -sf ../resources_rc.py resources_rc.py )
( cd usr/share/carla/resources ; rm -rf ui_carla_about.py )
( cd usr/share/carla/resources ; ln -sf ../ui_carla_about.py ui_carla_about.py )
( cd usr/share/carla/resources ; rm -rf ui_carla_about_juce.py )
( cd usr/share/carla/resources ; ln -sf ../ui_carla_about_juce.py ui_carla_about_juce.py )
( cd usr/share/carla/resources ; rm -rf ui_carla_add_jack.py )
( cd usr/share/carla/resources ; ln -sf ../ui_carla_add_jack.py ui_carla_add_jack.py )
( cd usr/share/carla/resources ; rm -rf ui_carla_database.py )
( cd usr/share/carla/resources ; ln -sf ../ui_carla_database.py ui_carla_database.py )
( cd usr/share/carla/resources ; rm -rf ui_carla_edit.py )
( cd usr/share/carla/resources ; ln -sf ../ui_carla_edit.py ui_carla_edit.py )
( cd usr/share/carla/resources ; rm -rf ui_carla_host.py )
( cd usr/share/carla/resources ; ln -sf ../ui_carla_host.py ui_carla_host.py )
( cd usr/share/carla/resources ; rm -rf ui_carla_parameter.py )
( cd usr/share/carla/resources ; ln -sf ../ui_carla_parameter.py ui_carla_parameter.py )
( cd usr/share/carla/resources ; rm -rf ui_carla_plugin_calf.py )
( cd usr/share/carla/resources ; ln -sf ../ui_carla_plugin_calf.py ui_carla_plugin_calf.py )
( cd usr/share/carla/resources ; rm -rf ui_carla_plugin_classic.py )
( cd usr/share/carla/resources ; ln -sf ../ui_carla_plugin_classic.py ui_carla_plugin_classic.py )
( cd usr/share/carla/resources ; rm -rf ui_carla_plugin_compact.py )
( cd usr/share/carla/resources ; ln -sf ../ui_carla_plugin_compact.py ui_carla_plugin_compact.py )
( cd usr/share/carla/resources ; rm -rf ui_carla_plugin_default.py )
( cd usr/share/carla/resources ; ln -sf ../ui_carla_plugin_default.py ui_carla_plugin_default.py )
( cd usr/share/carla/resources ; rm -rf ui_carla_plugin_presets.py )
( cd usr/share/carla/resources ; ln -sf ../ui_carla_plugin_presets.py ui_carla_plugin_presets.py )
( cd usr/share/carla/resources ; rm -rf ui_carla_refresh.py )
( cd usr/share/carla/resources ; ln -sf ../ui_carla_refresh.py ui_carla_refresh.py )
( cd usr/share/carla/resources ; rm -rf ui_carla_settings.py )
( cd usr/share/carla/resources ; ln -sf ../ui_carla_settings.py ui_carla_settings.py )
( cd usr/share/carla/resources ; rm -rf ui_carla_settings_driver.py )
( cd usr/share/carla/resources ; ln -sf ../ui_carla_settings_driver.py ui_carla_settings_driver.py )
( cd usr/share/carla/resources ; rm -rf ui_inputdialog_value.py )
( cd usr/share/carla/resources ; ln -sf ../ui_inputdialog_value.py ui_inputdialog_value.py )
( cd usr/share/carla/resources ; rm -rf ui_midipattern.py )
( cd usr/share/carla/resources ; ln -sf ../ui_midipattern.py ui_midipattern.py )
( cd usr/share/carla/resources ; rm -rf ui_xycontroller.py )
( cd usr/share/carla/resources ; ln -sf ../ui_xycontroller.py ui_xycontroller.py )
( cd usr/share/carla/resources ; rm -rf widgets )
( cd usr/share/carla/resources ; ln -sf ../widgets widgets )
