Ok, I have tested some and this solution works with Xfce and Thunar at least (that's what I have on this system that uses the shared mime database). The only change in this diff is that the path in the Rebuild_MIME_Database function has changed. I also attach the new recipe for Shared-Mime-Info, which should enable this functionality in the Scripts.On 4/19/07, Jonas Karlsson <[EMAIL PROTECTED]> wrote:On Thu, 19 Apr 2007 23:50:26 +0200, Hisham Muhammad <[EMAIL PROTECTED]>wrote:> On 4/19/07, Jonas Karlsson <[EMAIL PROTECTED]> wrote:>> After having talked about this with Hisham I agree that we can wait with >> this, but not because I think this change could wait but because it has>> to >> be done slightly different. Hisham had an idea (and I agree with him) >> that >> the files should be created in Variables instead. This is done quite >> easy >> by first decide on a hierarchy in Variable, say /S/V/mime, and then >> create >> a symlink /System/Links/Shared/mime/applications -> >> /S/V/mime/applications. Then one can call update-mime-database with >> /S/V/mime as target and all files will be created there. To make this >> work>> with applications that use these files one has to include /S/V/mime in>> the >> XDG_DATA_DIRS variable, which would be done by appending it to that >> variable from an Environemt file, for example in the Shared-Mime-INFO >> package. > > Is XDG_DATA_DIRS necessary? If there's a symlink in Shared pointing to > Variables, then apps will find the mime data where they usually look > for. > Well, imo that solutions isn't as clean as the one I proposed. I'm guessing you're suggesting a link /S/L/Shared/mime -> /S/Variable/mime.Were would the link for /P/Foo/x.y/Shared/mime/package/foo.xml be created?SymlinkProgram would try to link it in /S/L/Shared/mime but it would be written in /S/Variable/mime. I'd rather keep the applications links in /S/L and set a path variable instead.You have a point. Sounds worth testing.
One problem, I just found, is that PostInstall only works with union sandbox, so this approach only works out of the box for users of union sandbox. And as the PostInstall script is run in a sandbox I have to use $variable_target instead of $goboVariable, and hope that those point to the same directory (which they should do lately).
-- /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 20 Apr 2007 12:15:11 -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 20 Apr 2007 12:15:12 -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 20 Apr 2007 12:15:12 -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 20 Apr 2007 12:15:12 -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 20 Apr 2007 12:15:12 -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 $([ ${XDG_DATA_HOME} ] && echo "${XDG_DATA_HOME}/mime" || echo "${goboVariable}/mime") >/dev/null
+fi
+}
+
function Link_Or_Expand_All() {
### python Link_Or_Expand_All CHANGELOG
Shared-Mime-Info--0.21--recipe.tar.bz2
Description: application/bzip2
_______________________________________________ gobolinux-devel mailing list [email protected] http://lists.gobolinux.org/mailman/listinfo/gobolinux-devel
