# HG changeset patch # User Christophe Lincoln # Date 1337101373 -7200 # Node ID 1e166d1364d7618c8c933c26c2bf9ba8716c36aa # Parent 19f1b93fd7d8e60805a62eebd9297af69a301d42 spk-add: one function to update all dbs diff -r 19f1b93fd7d8 -r 1e166d1364d7 spk-add --- a/spk-add Tue May 15 18:56:21 2012 +0200 +++ b/spk-add Tue May 15 19:02:53 2012 +0200 @@ -35,6 +35,29 @@ exit 0 } +# Update system databases +update_databases() { + if [ -f $ROOT/usr/bin/update-desktop-database ] && [ -n "$updatedesktopdb" ]; then + chroot "$ROOT/" /usr/bin/update-desktop-database /usr/share/applications 2>/dev/null + fi + # Mimetypes + if [ -f $ROOT/usr/bin/update-mime-database ] && [ -n "$updatemimedb" ]; then + chroot "$ROOT/" /usr/bin/update-mime-database /usr/share/mime + fi + # Icons + if [ -f $ROOT/usr/bin/gtk-update-icon-cache ] && [ -n "$updateicondb" ]; then + chroot "$ROOT/" /usr/bin/gtk-update-icon-cache /usr/share/icons/hicolor + fi + # Glib schemas + if [ -f $ROOT/usr/bin/glib-compile-schemas ] && [ -n "$compile_schemas" ]; then + chroot "$ROOT/" /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas + fi + # Kernel modules + if [ -f $ROOT/sbin/depmod ] && [ -n "$updatedepmod" ]; then + chroot "$ROOT/" /sbin/depmod -a + fi +} + # This function installs a package in the rootfs. # Parameters: package_name package_file install_package() { @@ -210,7 +233,6 @@ if [ "$(fgrep /lib/modules $package_dir/files.list)" ]; then updatedepmod=yes fi - separator eval_gettext "\$package_name (\$VERSION\$EXTRAVERSION) is installed."; newline newline @@ -229,10 +251,7 @@ fi install_package $package_file - update_desktop_database - update_mime_database - update_icon_database - compile_glib_schemas + update_databases } # Download and install a package. TODO: Handle Undigest Mirrors @@ -284,8 +303,7 @@ install_package "$CACHE_DIR/$package_full.tazpkg" [ -n "$AUTOEXEC" ] && $package_name $ROOT - update_desktop_database - update_mime_database + update_databases } # Install all missing deps. Auto install or ask user then install all missing @@ -320,37 +338,6 @@ fi } -# Update system databases -update_desktop_database() { - if [ -f $ROOT/usr/bin/update-desktop-database ] && [ -n "$updatedesktopdb" ]; then - chroot "$ROOT/" /usr/bin/update-desktop-database /usr/share/applications 2>/dev/null - fi -} - -update_mime_database() { - if [ -f $ROOT/usr/bin/update-mime-database ] && [ -n "$updatemimedb" ]; then - chroot "$ROOT/" /usr/bin/update-mime-database /usr/share/mime - fi -} - -update_icon_database() { - if [ -f $ROOT/usr/bin/gtk-update-icon-cache ] && [ -n "$updateicondb" ]; then - chroot "$ROOT/" /usr/bin/gtk-update-icon-cache /usr/share/icons/hicolor - fi -} - -compile_glib_schemas() { - if [ -f $ROOT/usr/bin/glib-compile-schemas ] && [ -n "$compile_schemas" ]; then - chroot "$ROOT/" /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas - fi -} - -update_kernel_modules() { - if [ -f $ROOT/sbin/depmod ] && [ -n "$updatedepmod" ]; then - chroot "$ROOT/" /sbin/depmod -a - fi -} - # Old style case $1 in install|-i)