spk rev 29

spk-add: one function to update all dbs
author Christophe Lincoln <pankso@slitaz.org>
date Tue May 15 19:02:53 2012 +0200 (2012-05-15)
parents 19f1b93fd7d8
children daf5adaaa87b
files spk-add
line diff
     1.1 --- a/spk-add	Tue May 15 18:56:21 2012 +0200
     1.2 +++ b/spk-add	Tue May 15 19:02:53 2012 +0200
     1.3 @@ -35,6 +35,29 @@
     1.4  	exit 0
     1.5  }
     1.6  
     1.7 +# Update system databases
     1.8 +update_databases() {
     1.9 +	if [ -f $ROOT/usr/bin/update-desktop-database ] && [ -n "$updatedesktopdb" ]; then
    1.10 +		chroot "$ROOT/" /usr/bin/update-desktop-database /usr/share/applications 2>/dev/null
    1.11 +	fi
    1.12 +	# Mimetypes
    1.13 +	if [ -f $ROOT/usr/bin/update-mime-database ] && [ -n "$updatemimedb" ]; then
    1.14 +		chroot "$ROOT/" /usr/bin/update-mime-database /usr/share/mime
    1.15 +	fi
    1.16 +	# Icons
    1.17 +	if [ -f $ROOT/usr/bin/gtk-update-icon-cache ] && [ -n "$updateicondb" ]; then
    1.18 +		chroot "$ROOT/" /usr/bin/gtk-update-icon-cache /usr/share/icons/hicolor
    1.19 +	fi
    1.20 +	# Glib schemas
    1.21 +	if [ -f $ROOT/usr/bin/glib-compile-schemas ] && [ -n "$compile_schemas" ]; then
    1.22 +		chroot "$ROOT/" /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas
    1.23 +	fi
    1.24 +	# Kernel modules
    1.25 +	if [ -f $ROOT/sbin/depmod ] && [ -n "$updatedepmod" ]; then
    1.26 +		chroot "$ROOT/" /sbin/depmod -a
    1.27 +	fi
    1.28 +}
    1.29 +
    1.30  # This function installs a package in the rootfs.
    1.31  # Parameters: package_name package_file
    1.32  install_package() {
    1.33 @@ -210,7 +233,6 @@
    1.34  	if [ "$(fgrep /lib/modules $package_dir/files.list)" ]; then
    1.35  		updatedepmod=yes
    1.36  	fi
    1.37 -
    1.38  	separator
    1.39  	eval_gettext "\$package_name (\$VERSION\$EXTRAVERSION) is installed."; newline
    1.40  	newline
    1.41 @@ -229,10 +251,7 @@
    1.42  	fi
    1.43  
    1.44  	install_package $package_file
    1.45 -	update_desktop_database
    1.46 -	update_mime_database
    1.47 -	update_icon_database
    1.48 -	compile_glib_schemas
    1.49 +	update_databases
    1.50  }
    1.51  
    1.52  # Download and install a package. TODO: Handle Undigest Mirrors
    1.53 @@ -284,8 +303,7 @@
    1.54  	install_package "$CACHE_DIR/$package_full.tazpkg"
    1.55  
    1.56  	[ -n "$AUTOEXEC" ] && $package_name $ROOT
    1.57 -	update_desktop_database
    1.58 -	update_mime_database
    1.59 +	update_databases
    1.60  }
    1.61  
    1.62  # Install all missing deps. Auto install or ask user then install all missing
    1.63 @@ -320,37 +338,6 @@
    1.64  	fi
    1.65  }
    1.66  
    1.67 -# Update system databases
    1.68 -update_desktop_database() {
    1.69 -	if [ -f $ROOT/usr/bin/update-desktop-database ] && [ -n "$updatedesktopdb" ]; then
    1.70 -		chroot "$ROOT/" /usr/bin/update-desktop-database /usr/share/applications 2>/dev/null
    1.71 -	fi
    1.72 -}
    1.73 -
    1.74 -update_mime_database() {
    1.75 -	if [ -f $ROOT/usr/bin/update-mime-database ] && [ -n "$updatemimedb" ]; then
    1.76 -		chroot "$ROOT/" /usr/bin/update-mime-database /usr/share/mime
    1.77 -	fi
    1.78 -}
    1.79 -
    1.80 -update_icon_database() {
    1.81 -	if [ -f $ROOT/usr/bin/gtk-update-icon-cache ] && [ -n "$updateicondb" ]; then
    1.82 -		chroot "$ROOT/" /usr/bin/gtk-update-icon-cache /usr/share/icons/hicolor
    1.83 -	fi
    1.84 -}
    1.85 -
    1.86 -compile_glib_schemas() {
    1.87 -	if [ -f $ROOT/usr/bin/glib-compile-schemas ] && [ -n "$compile_schemas" ]; then
    1.88 -		chroot "$ROOT/" /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas
    1.89 -	fi
    1.90 -}
    1.91 -
    1.92 -update_kernel_modules() {
    1.93 -	if [ -f $ROOT/sbin/depmod ] && [ -n "$updatedepmod" ]; then
    1.94 -		chroot "$ROOT/" /sbin/depmod -a
    1.95 -	fi
    1.96 -}
    1.97 -
    1.98  # Old style
    1.99  case $1 in
   1.100  	install|-i)