Revision: 54017
          http://brlcad.svn.sourceforge.net/brlcad/?rev=54017&view=rev
Author:   jordisayol
Date:     2012-12-07 03:12:06 +0000 (Fri, 07 Dec 2012)
Log Message:
-----------
Improve rpm install and remove scripts

Modified Paths:
--------------
    brlcad/trunk/sh/make_rpm.sh

Modified: brlcad/trunk/sh/make_rpm.sh
===================================================================
--- brlcad/trunk/sh/make_rpm.sh 2012-12-07 03:08:06 UTC (rev 54016)
+++ brlcad/trunk/sh/make_rpm.sh 2012-12-07 03:12:06 UTC (rev 54017)
@@ -226,25 +226,29 @@
 
 %post
 
-F="/usr/share/applications/defaults.list"
-G="/etc/gnome/defaults.list"
-H="mged.desktop"
+file="/usr/share/applications/mimeapps.list"
+section="Added Associations"
+app="mged.desktop;archer.desktop;rtwizard.desktop;"
+key_v4="application/brlcad-v4=$app"
+key_v5="application/brlcad-v5=$app"
 
-if [ ! -f $F ] && [ ! -h $F ]
+if [ ! -e $file ]
 then
-       if [ -f $G ]
-       then
-               ln -s $G $F || :
-       else
-               echo "[Default Applications]" > $F || :
-       fi
+    touch $file || :
 fi
 
-sed --follow-symlinks -i "/application\/brlcad-v[45]/d" $F || :
+if [ -f $file ]
+then
+    sed --follow-symlinks -i "/application\/brlcad-v[45]/d" $file || :
+    line=$(sed -n "/^\[$section\]/=" $file | tail -1) || :
+    if [ -z "$line" ]
+    then
+       echo "[$section]\n$key_v4\n$key_v5" >> $file || :
+    else
+       sed --follow-symlinks -i "$line a$key_v4\n$key_v5" $file || :
+    fi
+fi
 
-echo "application/brlcad-v4=$H" >> $F || :
-echo "application/brlcad-v5=$H" >> $F || :
-
 source /etc/profile.d/brlcad.sh || :
 
 update-mime-database /usr/share/mime || :
@@ -258,16 +262,16 @@
 echo -e '
 %postun
 
-F="/usr/share/applications/defaults.list"
+file="/usr/share/applications/mimeapps.list"
 
-if [ -f $F ] || [ -h $F ]
+if [ -f $file ] && [ $1 -eq 0 ]
 then
-       sed --follow-symlinks -i "/application\/brlcad-v[45]/d" $F || :
+    sed --follow-symlinks -i "/application\/brlcad-v[45]/d" $file
 fi
 
-if [ -f $F ] && [ -z "$(sed "/\[Default Applications\]/d" $F)" ]
+if [ -f $file ] && [ -z "$(sed "/\[Added Associations\]/d" $file)" ]
 then
-       rm $F || :
+    rm $file || :
 fi
 
 update-mime-database /usr/share/mime || :

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to