El Mon, 2 Apr 2007 10:17:34 -0700
"Carlo Calica" <[EMAIL PROTECTED]> escribi__:
> A quick look at DisableProgram suggests it'll be fine.  Thanks a lot
> for testing and providing patches.
> 
> 

DisablePrograms doesn't work very well with detached programs, it
removes current link under /Programs/app_name, but it can't unlink
files becouse links does not point to /P but to anywhere $goboInstall
points (/Depot/Programs) in my case.

Btw, what means the last TODO in the file, is yet active? current is
removed when program is disabled.

Here is the patch to solve that, i tested it with some programs
(under /Programs and under /Depot/Programs) and seems to work fine.


--- PATCH

--- /Depot/Users/eof/srcs/GoboCVS/tools/Scripts/bin/DisableProgram
2007-03-30 10:48:51.000000000 +0200
+++ /Programs/Scripts/CVS/bin/DisableProgram    2007-04-02
19:45:15.000000000 +0200
@@ -5,6 +5,7 @@
 Import GoboLinux
 Import Log
 Import OptionParser
+Import Directories
 
 ### Options
###################################################################
 
@@ -30,34 +31,38 @@
 else versionnumber=`Get_Version "$programname" "Current"`
 fi
 
-prefix="${goboPrograms}/$programname/$versionnumber"
+# Enabled support to disable detached programs. (Aitor)
+programdir="${goboPrograms}/$programname/$versionnumber"
+installdir=`Get_Dir install "$programname" "$versionnumber"`
 
-Is_Directory "$prefix" || Die "$programname version $versionnumber was
not found."
+[ -z $installdir ] && installdir=$programdir
+
+Is_Directory "$installdir" || Die "$programname version $versionnumber
was not found."
 
 Log_Normal "Disabling ${programname}, version ${versionnumber}."
                                
-disabled="${goboPrograms}/$programname/$versionnumber-Disabled"
+disabled="${installdir}-Disabled"
                                
 if [ "`Get_Version "$programname" "Current"`" == "$versionnumber" ]
 then                           
     rm -rf ${goboPrograms}/$programname/Current
 fi                             
-mv "$prefix" "$disabled" || Die "Couldn't disable $programname
$versionnumber."
+mv "$installdir" "$disabled" || Die "Couldn't disable $programname
$versionnumber."
                                
 filesdir=$(Get_System_Paths "$disabled")
                                
 Log_Normal "Removing links..." 
 RemoveBroken $filesdir || Die "Couldn't cleanup links."
                                
-if [ -f ./Resources/UnmanagedFiles ] && ! Is_Entry "unmanaged" "keep"
+if [ -f ${installdir}/Resources/UnmanagedFiles ] && ! Is_Entry
"unmanaged" "keep"
 then                           
-   { 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"
+   { Is_Entry "unmanaged" "ask" && ! Ask "There are unmanaged files
present. Do you want to remove them?"; } || Uninstall_Unmanaged_Files
"${disabled}/Resources/UnmanagedFiles"
 fi
 
 Gen_Env_Cache
 
 
-mv "$disabled" "$prefix" || Die "Please check $disabled."
+mv "$disabled" "$installdir" || Die "Please check $disabled."
 Log_Normal "${programname} ${versionnumber} disabled."
 
 # TODO unlink current if it's the one that was disabled.

--- END

P.D, Now that i can't go to work i'm glad to learn how gobo works in deep.


Greets,
Aitor
-- 
... Bardulia quae nunc vocatur Castella ...

_______________________________________________
gobolinux-devel mailing list
gobolinux-devel@lists.gobolinux.org
http://lists.gobolinux.org/mailman/listinfo/gobolinux-devel

Reply via email to