Here's a patch to update the MIME database if the installed application
includes a xml file, which defines its MIME types.
I've added some utility functions to Functions/File and a function to
Functions/GoboLinux to rebuild the MIME DB. The MIME database should only
be rebuilt if the application provides a xml file (placed in
Shared/mime/packages).
One "glitch", as I see it, is that this will place actual file in
/System/Links/Shared/mime (or wherever the ${goboShared}/mime directory
is). But I guess sometimes we have to accept some files in the /S/L
directory? Otherwice I don't know how to solve this.
--
/Jonas
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Index: bin/SymlinkProgram
===================================================================
RCS file: /sources/goboscripts/tools/Scripts/bin/SymlinkProgram,v
retrieving revision 1.44
diff -u -r1.44 SymlinkProgram
--- bin/SymlinkProgram 21 Mar 2007 01:42:29 -0000 1.44
+++ bin/SymlinkProgram 18 Apr 2007 08:42:21 -0000
@@ -290,41 +290,44 @@
################################################################################
-if [ "$linkshared" != "no" -a "$goboIndex" ]
+if [ "$linkshared" != "no" ]
then
- Log_Normal "Symlinking shared..."
- link_directory "$current/share" "$goboShared"
-elif [ "$linkshared" != "no" ]
-then
- Log_Normal "Symlinking shared..."
- cd "$current"
- Quiet rmdir "share"
- Quiet rmdir "Shared"
- if Is_Real_Directory "share"
- then
- [ ! -d "Shared" ] && mv share Shared
- fi
- if Is_Real_Directory "Shared"
+ if [ "$goboIndex" ]
then
- link=`readlink -f share`
- if ! [ "$link" = "$goboShared" ]
+ Log_Normal "Symlinking shared..."
+ link_directory "$current/share" "$goboShared"
+ else
+ Log_Normal "Symlinking shared..."
+ cd "$current"
+ Quiet rmdir "share"
+ Quiet rmdir "Shared"
+ if Is_Real_Directory "share"
+ then
+ [ ! -d "Shared" ] && mv share Shared
+ fi
+ if Is_Real_Directory "Shared"
then
- Quiet rm "share"
- [ "`echo ${goboShared:${#goboPrefix}:${#goboShared}} | cut -b1`" != "/" ] && slash="/"
- if Boolean "relative" && [ -d "../../..${slash}${goboShared:${#goboPrefix}:${#goboShared}}" ]
+ link=`readlink -f share`
+ if ! [ "$link" = "$goboShared" ]
then
- Quiet ln -snf "../../..${slash}${goboShared:${#goboPrefix}:${#goboShared}}" share
- else
- Quiet ln -snf "$goboShared" share
+ Quiet rm "share"
+ [ "`echo ${goboShared:${#goboPrefix}:${#goboShared}} | cut -b1`" != "/" ] && slash="/"
+ if Boolean "relative" && [ -d "../../..${slash}${goboShared:${#goboPrefix}:${#goboShared}}" ]
+ then
+ Quiet ln -snf "../../..${slash}${goboShared:${#goboPrefix}:${#goboShared}}" share
+ else
+ Quiet ln -snf "$goboShared" share
+ fi
fi
+ link_directory "$current/Shared" "$goboShared"
fi
- link_directory "$current/Shared" "$goboShared"
- fi
- if ! Is_Real_Directory "Shared" && Is_Link "share"
- then
- rm "share"
+ if ! Is_Real_Directory "Shared" && Is_Link "share"
+ then
+ rm "share"
+ fi
+ Quiet cd -
fi
- Quiet cd -
+ Is_Real_Nonempty_Directory "${current}/Shared/mime/packages" && Rebuild_MIME_Database
fi
################################################################################
Index: bin/RemoveProgram
===================================================================
RCS file: /sources/goboscripts/tools/Scripts/bin/RemoveProgram,v
retrieving revision 1.16
diff -u -r1.16 RemoveProgram
--- bin/RemoveProgram 27 Mar 2007 22:28:20 -0000 1.16
+++ bin/RemoveProgram 18 Apr 2007 08:42:21 -0000
@@ -40,6 +40,8 @@
Log_Verbose "Getting program file list..."
filesdir=$(Get_System_Paths "${goboPrograms}/${program}/${version}")
+Is_Real_Nonempty_Directory "${goboPrograms}/${program}/${version}/Shared/mime/packages" && rebuildmimedb=true
+
Log_Normal "Removing ${goboPrograms}/${program}/${version}..."
if [ -f ./Resources/UnmanagedFiles ] && ! Is_Entry "unmanaged" "keep"
then
@@ -56,6 +58,7 @@
#Log_Normal "Rebuilding Environment Cache file..."
#yes | RebuildLinks -n
+[ "${rebuildmimedb}" = "true" ] && Rebuild_MIME_Database
Gen_Env_Cache
Index: bin/DisableProgram
===================================================================
RCS file: /sources/goboscripts/tools/Scripts/bin/DisableProgram,v
retrieving revision 1.16
diff -u -r1.16 DisableProgram
--- bin/DisableProgram 27 Mar 2007 22:28:20 -0000 1.16
+++ bin/DisableProgram 18 Apr 2007 08:42:21 -0000
@@ -54,6 +54,7 @@
{ Is_Entry "unmanaged" "ask" && ! Ask "There are unmanaged files present. Do you want to remove them?"; } || Uninstall_Unmanaged_Files "${goboPrograms}/$programname/$versionnumber-Disabled/Resources/UnmanagedFiles"
fi
+Is_Real_Nonempty_Directory "${disabled}/Shared/mime/packages" && Rebuild_MIME_Database
Gen_Env_Cache
Index: Functions/File
===================================================================
RCS file: /sources/goboscripts/tools/Scripts/Functions/File,v
retrieving revision 1.34
diff -u -r1.34 File
--- Functions/File 17 Apr 2007 19:06:43 -0000 1.34
+++ Functions/File 18 Apr 2007 08:42:21 -0000
@@ -9,6 +9,10 @@
function Is_Real_Directory() { [ -d "$1" -a ! -L "$1" ] ;}
+function Is_Real_Empty_Directory() { Is_Real_Directory "$1" && Is_Empty_Directory "$1" ;}
+
+function Is_Real_Nonempty_Directory() { Is_Real_Directory "$1" && Is_Nonempty_Directory "$1" ;}
+
function Is_Directory() { [ -d "$1" ] ;}
function Is_Executable() { [ -x "$1" ] ;}
@@ -25,6 +29,8 @@
function Is_Broken_Link() { [ -L "$1" -a ! -e "$1" ] ;}
+function Executable_Exists_In_Path() { [ -n "$(which ${1} 2>/dev/null)" ] ;}
+
function Make_Directory() {
Parameters "$@" dir
mkdir -p "$dir"
Index: Functions/GoboLinux
===================================================================
RCS file: /sources/goboscripts/tools/Scripts/Functions/GoboLinux,v
retrieving revision 1.30
diff -u -r1.30 GoboLinux
--- Functions/GoboLinux 27 Mar 2007 22:28:20 -0000 1.30
+++ Functions/GoboLinux 18 Apr 2007 08:42:21 -0000
@@ -60,6 +60,14 @@
echo -e "if [ \"\$unsetvars\" ]\nthen\n$unsetvars\nfi\n" >> "$cache"
}
+function Rebuild_MIME_Database() {
+if Executable_Exists_In_Path "update-mime-database"
+then
+ Log_Normal "Rebuilding MIME database..."
+ update-mime-database ${goboShared}/mime >/dev/null
+fi
+}
+
function Link_Or_Expand_All() {
### python Link_Or_Expand_All CHANGELOG
_______________________________________________
gobolinux-devel mailing list
gobolinux-devel@lists.gobolinux.org
http://lists.gobolinux.org/mailman/listinfo/gobolinux-devel