This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

draftsight.install

By: a guest on Feb 6th, 2012  |  syntax: Bash  |  size: 17.35 KB  |  views: 143  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. post_install() {
  2. while read line; do
  3.   USERID=`echo "$line" | awk -F":" '{ print $3 }'`
  4.   USERNAME=`echo "$line" | awk -F":" '{ print $1 }'`
  5.   if [ "$USERID" -ge 500 ]; then
  6.     USERHOME=`su "$USERNAME" -c "env | grep ^\"HOME=\""`
  7.     if [ ! -z "$USERHOME" ]; then
  8.       USERHOME=`echo "$USERHOME" | awk -F"=" '{ print $2 }'`
  9.       if [ -d "$USERHOME" ]; then
  10.         LIST_USERNAME=( "${LIST_USERNAME[@]}" "$USERNAME");
  11.       fi
  12.     fi
  13.   fi
  14. done < /etc/passwd
  15.  
  16. xdg-mime install --novendor --mode system "/opt/dassault-systemes/draftsight/mime/dassault-systemes"_"draftsight-dwg.xml"
  17. for (( INDEX = 0 ; INDEX < ${#LIST_USERNAME[@]} ; INDEX++ )) ; do
  18.   USERNAME=${LIST_USERNAME[$INDEX]}
  19.   echo "Set application as default for the user=$USERNAME"
  20.   su "$USERNAME" -c "xdg-mime default \"dassault-systemes\"_\"draftsight.desktop\" \"application/vnd.dassault-systemes.draftsight-dwg\""
  21. done
  22. xdg-mime install --novendor --mode system "/opt/dassault-systemes/draftsight/mime/dassault-systemes"_"draftsight-dxf.xml"
  23. for (( INDEX = 0 ; INDEX < ${#LIST_USERNAME[@]} ; INDEX++ )) ; do
  24.   USERNAME=${LIST_USERNAME[$INDEX]}
  25.   echo "Set application as default for the user=$USERNAME"
  26.   su "$USERNAME" -c "xdg-mime default \"dassault-systemes\"_\"draftsight.desktop\" \"application/vnd.dassault-systemes.draftsight-dxf\""
  27. done
  28. xdg-mime install --novendor --mode system "/opt/dassault-systemes/draftsight/mime/dassault-systemes"_"draftsight-dwt.xml"
  29. for (( INDEX = 0 ; INDEX < ${#LIST_USERNAME[@]} ; INDEX++ )) ; do
  30.   USERNAME=${LIST_USERNAME[$INDEX]}
  31.   echo "Set application as default for the user=$USERNAME"
  32.   su "$USERNAME" -c "xdg-mime default \"dassault-systemes\"_\"draftsight.desktop\" \"application/vnd.dassault-systemes.draftsight-dwt\""
  33. done
  34.  
  35. xdg-icon-resource install --noupdate --novendor --context apps --mode system --size 16 "/opt/dassault-systemes/draftsight/mime/pixmaps/16x16/dassault-systemes_draftsight.png" "dassault-systemes.draftsight"
  36. xdg-icon-resource install --noupdate --novendor --theme gnome --context apps --mode system --size 16 "/opt/dassault-systemes/draftsight/mime/pixmaps/16x16/dassault-systemes_draftsight.png" "dassault-systemes.draftsight"
  37. xdg-icon-resource install --noupdate --novendor --context mimetypes --mode system --size 16 "/opt/dassault-systemes/draftsight/mime/pixmaps/16x16/dassault-systemes_draftsight-dwg.png" "application-vnd.dassault-systemes.draftsight-dwg"
  38. xdg-icon-resource install --noupdate --novendor --theme gnome --context mimetypes --mode system --size 16 "/opt/dassault-systemes/draftsight/mime/pixmaps/16x16/dassault-systemes_draftsight-dwg.png" "application-vnd.dassault-systemes.draftsight-dwg"
  39. xdg-icon-resource install --noupdate --novendor --context mimetypes --mode system --size 16 "/opt/dassault-systemes/draftsight/mime/pixmaps/16x16/dassault-systemes_draftsight-dxf.png" "application-vnd.dassault-systemes.draftsight-dxf"
  40. xdg-icon-resource install --noupdate --novendor --theme gnome --context mimetypes --mode system --size 16 "/opt/dassault-systemes/draftsight/mime/pixmaps/16x16/dassault-systemes_draftsight-dxf.png" "application-vnd.dassault-systemes.draftsight-dxf"
  41. xdg-icon-resource install --noupdate --novendor --context mimetypes --mode system --size 16 "/opt/dassault-systemes/draftsight/mime/pixmaps/16x16/dassault-systemes_draftsight-dwt.png" "application-vnd.dassault-systemes.draftsight-dwt"
  42. xdg-icon-resource install --noupdate --novendor --theme gnome --context mimetypes --mode system --size 16 "/opt/dassault-systemes/draftsight/mime/pixmaps/16x16/dassault-systemes_draftsight-dwt.png" "application-vnd.dassault-systemes.draftsight-dwt"
  43. xdg-icon-resource install --noupdate --novendor --context apps --mode system --size 32 "/opt/dassault-systemes/draftsight/mime/pixmaps/32x32/dassault-systemes_draftsight.png" "dassault-systemes.draftsight"
  44. xdg-icon-resource install --noupdate --novendor --theme gnome --context apps --mode system --size 32 "/opt/dassault-systemes/draftsight/mime/pixmaps/32x32/dassault-systemes_draftsight.png" "dassault-systemes.draftsight"
  45. xdg-icon-resource install --noupdate --novendor --context mimetypes --mode system --size 32 "/opt/dassault-systemes/draftsight/mime/pixmaps/32x32/dassault-systemes_draftsight-dwg.png" "application-vnd.dassault-systemes.draftsight-dwg"
  46. xdg-icon-resource install --noupdate --novendor --theme gnome --context mimetypes --mode system --size 32 "/opt/dassault-systemes/draftsight/mime/pixmaps/32x32/dassault-systemes_draftsight-dwg.png" "application-vnd.dassault-systemes.draftsight-dwg"
  47. xdg-icon-resource install --noupdate --novendor --context mimetypes --mode system --size 32 "/opt/dassault-systemes/draftsight/mime/pixmaps/32x32/dassault-systemes_draftsight-dxf.png" "application-vnd.dassault-systemes.draftsight-dxf"
  48. xdg-icon-resource install --noupdate --novendor --theme gnome --context mimetypes --mode system --size 32 "/opt/dassault-systemes/draftsight/mime/pixmaps/32x32/dassault-systemes_draftsight-dxf.png" "application-vnd.dassault-systemes.draftsight-dxf"
  49. xdg-icon-resource install --noupdate --novendor --context mimetypes --mode system --size 32 "/opt/dassault-systemes/draftsight/mime/pixmaps/32x32/dassault-systemes_draftsight-dwt.png" "application-vnd.dassault-systemes.draftsight-dwt"
  50. xdg-icon-resource install --noupdate --novendor --theme gnome --context mimetypes --mode system --size 32 "/opt/dassault-systemes/draftsight/mime/pixmaps/32x32/dassault-systemes_draftsight-dwt.png" "application-vnd.dassault-systemes.draftsight-dwt"
  51. xdg-icon-resource install --noupdate --novendor --context apps --mode system --size 48 "/opt/dassault-systemes/draftsight/mime/pixmaps/48x48/dassault-systemes_draftsight.png" "dassault-systemes.draftsight"
  52. xdg-icon-resource install --noupdate --novendor --theme gnome --context apps --mode system --size 48 "/opt/dassault-systemes/draftsight/mime/pixmaps/48x48/dassault-systemes_draftsight.png" "dassault-systemes.draftsight"
  53. xdg-icon-resource install --noupdate --novendor --context mimetypes --mode system --size 48 "/opt/dassault-systemes/draftsight/mime/pixmaps/48x48/dassault-systemes_draftsight-dwg.png" "application-vnd.dassault-systemes.draftsight-dwg"
  54. xdg-icon-resource install --noupdate --novendor --theme gnome --context mimetypes --mode system --size 48 "/opt/dassault-systemes/draftsight/mime/pixmaps/48x48/dassault-systemes_draftsight-dwg.png" "application-vnd.dassault-systemes.draftsight-dwg"
  55. xdg-icon-resource install --noupdate --novendor --context mimetypes --mode system --size 48 "/opt/dassault-systemes/draftsight/mime/pixmaps/48x48/dassault-systemes_draftsight-dxf.png" "application-vnd.dassault-systemes.draftsight-dxf"
  56. xdg-icon-resource install --noupdate --novendor --theme gnome --context mimetypes --mode system --size 48 "/opt/dassault-systemes/draftsight/mime/pixmaps/48x48/dassault-systemes_draftsight-dxf.png" "application-vnd.dassault-systemes.draftsight-dxf"
  57. xdg-icon-resource install --noupdate --novendor --context mimetypes --mode system --size 48 "/opt/dassault-systemes/draftsight/mime/pixmaps/48x48/dassault-systemes_draftsight-dwt.png" "application-vnd.dassault-systemes.draftsight-dwt"
  58. xdg-icon-resource install --noupdate --novendor --theme gnome --context mimetypes --mode system --size 48 "/opt/dassault-systemes/draftsight/mime/pixmaps/48x48/dassault-systemes_draftsight-dwt.png" "application-vnd.dassault-systemes.draftsight-dwt"
  59. xdg-icon-resource install --noupdate --novendor --context apps --mode system --size 64 "/opt/dassault-systemes/draftsight/mime/pixmaps/64x64/dassault-systemes_draftsight.png" "dassault-systemes.draftsight"
  60. xdg-icon-resource install --noupdate --novendor --theme gnome --context apps --mode system --size 64 "/opt/dassault-systemes/draftsight/mime/pixmaps/64x64/dassault-systemes_draftsight.png" "dassault-systemes.draftsight"
  61. xdg-icon-resource install --noupdate --novendor --context mimetypes --mode system --size 64 "/opt/dassault-systemes/draftsight/mime/pixmaps/64x64/dassault-systemes_draftsight-dwg.png" "application-vnd.dassault-systemes.draftsight-dwg"
  62. xdg-icon-resource install --noupdate --novendor --theme gnome --context mimetypes --mode system --size 64 "/opt/dassault-systemes/draftsight/mime/pixmaps/64x64/dassault-systemes_draftsight-dwg.png" "application-vnd.dassault-systemes.draftsight-dwg"
  63. xdg-icon-resource install --noupdate --novendor --context mimetypes --mode system --size 64 "/opt/dassault-systemes/draftsight/mime/pixmaps/64x64/dassault-systemes_draftsight-dxf.png" "application-vnd.dassault-systemes.draftsight-dxf"
  64. xdg-icon-resource install --noupdate --novendor --theme gnome --context mimetypes --mode system --size 64 "/opt/dassault-systemes/draftsight/mime/pixmaps/64x64/dassault-systemes_draftsight-dxf.png" "application-vnd.dassault-systemes.draftsight-dxf"
  65. xdg-icon-resource install --noupdate --novendor --context mimetypes --mode system --size 64 "/opt/dassault-systemes/draftsight/mime/pixmaps/64x64/dassault-systemes_draftsight-dwt.png" "application-vnd.dassault-systemes.draftsight-dwt"
  66. xdg-icon-resource install --noupdate --novendor --theme gnome --context mimetypes --mode system --size 64 "/opt/dassault-systemes/draftsight/mime/pixmaps/64x64/dassault-systemes_draftsight-dwt.png" "application-vnd.dassault-systemes.draftsight-dwt"
  67. xdg-icon-resource install --noupdate --novendor --context apps --mode system --size 128 "/opt/dassault-systemes/draftsight/mime/pixmaps/128x128/dassault-systemes_draftsight.png" "dassault-systemes.draftsight"
  68. xdg-icon-resource install --noupdate --novendor --theme gnome --context apps --mode system --size 128 "/opt/dassault-systemes/draftsight/mime/pixmaps/128x128/dassault-systemes_draftsight.png" "dassault-systemes.draftsight"
  69. xdg-icon-resource install --noupdate --novendor --context mimetypes --mode system --size 128 "/opt/dassault-systemes/draftsight/mime/pixmaps/128x128/dassault-systemes_draftsight-dwg.png" "application-vnd.dassault-systemes.draftsight-dwg"
  70. xdg-icon-resource install --noupdate --novendor --theme gnome --context mimetypes --mode system --size 128 "/opt/dassault-systemes/draftsight/mime/pixmaps/128x128/dassault-systemes_draftsight-dwg.png" "application-vnd.dassault-systemes.draftsight-dwg"
  71. xdg-icon-resource install --noupdate --novendor --context mimetypes --mode system --size 128 "/opt/dassault-systemes/draftsight/mime/pixmaps/128x128/dassault-systemes_draftsight-dxf.png" "application-vnd.dassault-systemes.draftsight-dxf"
  72. xdg-icon-resource install --noupdate --novendor --theme gnome --context mimetypes --mode system --size 128 "/opt/dassault-systemes/draftsight/mime/pixmaps/128x128/dassault-systemes_draftsight-dxf.png" "application-vnd.dassault-systemes.draftsight-dxf"
  73. xdg-icon-resource install --noupdate --novendor --context mimetypes --mode system --size 128 "/opt/dassault-systemes/draftsight/mime/pixmaps/128x128/dassault-systemes_draftsight-dwt.png" "application-vnd.dassault-systemes.draftsight-dwt"
  74. xdg-icon-resource install --noupdate --novendor --theme gnome --context mimetypes --mode system --size 128 "/opt/dassault-systemes/draftsight/mime/pixmaps/128x128/dassault-systemes_draftsight-dwt.png" "application-vnd.dassault-systemes.draftsight-dwt"
  75.  
  76. xdg-icon-resource forceupdate
  77.  
  78. xdg-desktop-menu install --novendor --mode system "/opt/dassault-systemes/draftsight/mime/dassault-systemes"_"draftsight.desktop"
  79.  
  80. update-desktop-database -q
  81. update-mime-database /usr/share/mime/ &> /dev/null
  82. }
  83.  
  84. post_upgrade() {
  85.     post_install
  86. }
  87.  
  88. pre_remove() {
  89. xdg-mime uninstall --novendor --mode system "/opt/dassault-systemes/draftsight/mime/dassault-systemes"_"draftsight-dwg.xml"
  90. xdg-mime uninstall --novendor --mode system "/opt/dassault-systemes/draftsight/mime/dassault-systemes"_"draftsight-dxf.xml"
  91. xdg-mime uninstall --novendor --mode system "/opt/dassault-systemes/draftsight/mime/dassault-systemes"_"draftsight-dwt.xml"
  92.  
  93. xdg-icon-resource uninstall --noupdate --context apps --mode system --size 16 "dassault-systemes.draftsight"
  94. xdg-icon-resource uninstall --noupdate --context apps --theme gnome --mode system --size 16 "dassault-systemes.draftsight"
  95. xdg-icon-resource uninstall --noupdate --context mimetypes --mode system --size 16 "application-vnd.dassault-systemes.draftsight-dwg"
  96. xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --mode system --size 16 "application-vnd.dassault-systemes.draftsight-dwg"
  97. xdg-icon-resource uninstall --noupdate --context mimetypes --mode system --size 16 "application-vnd.dassault-systemes.draftsight-dxf"
  98. xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --mode system --size 16 "application-vnd.dassault-systemes.draftsight-dxf"
  99. xdg-icon-resource uninstall --noupdate --context mimetypes --mode system --size 16 "application-vnd.dassault-systemes.draftsight-dwt"
  100. xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --mode system --size 16 "application-vnd.dassault-systemes.draftsight-dwt"
  101. xdg-icon-resource uninstall --noupdate --context apps --mode system --size 32 "dassault-systemes.draftsight"
  102. xdg-icon-resource uninstall --noupdate --context apps --theme gnome --mode system --size 32 "dassault-systemes.draftsight"
  103. xdg-icon-resource uninstall --noupdate --context mimetypes --mode system --size 32 "application-vnd.dassault-systemes.draftsight-dwg"
  104. xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --mode system --size 32 "application-vnd.dassault-systemes.draftsight-dwg"
  105. xdg-icon-resource uninstall --noupdate --context mimetypes --mode system --size 32 "application-vnd.dassault-systemes.draftsight-dxf"
  106. xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --mode system --size 32 "application-vnd.dassault-systemes.draftsight-dxf"
  107. xdg-icon-resource uninstall --noupdate --context mimetypes --mode system --size 32 "application-vnd.dassault-systemes.draftsight-dwt"
  108. xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --mode system --size 32 "application-vnd.dassault-systemes.draftsight-dwt"
  109. xdg-icon-resource uninstall --noupdate --context apps --mode system --size 48 "dassault-systemes.draftsight"
  110. xdg-icon-resource uninstall --noupdate --context apps --theme gnome --mode system --size 48 "dassault-systemes.draftsight"
  111. xdg-icon-resource uninstall --noupdate --context mimetypes --mode system --size 48 "application-vnd.dassault-systemes.draftsight-dwg"
  112. xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --mode system --size 48 "application-vnd.dassault-systemes.draftsight-dwg"
  113. xdg-icon-resource uninstall --noupdate --context mimetypes --mode system --size 48 "application-vnd.dassault-systemes.draftsight-dxf"
  114. xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --mode system --size 48 "application-vnd.dassault-systemes.draftsight-dxf"
  115. xdg-icon-resource uninstall --noupdate --context mimetypes --mode system --size 48 "application-vnd.dassault-systemes.draftsight-dwt"
  116. xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --mode system --size 48 "application-vnd.dassault-systemes.draftsight-dwt"
  117. xdg-icon-resource uninstall --noupdate --context apps --mode system --size 64 "dassault-systemes.draftsight"
  118. xdg-icon-resource uninstall --noupdate --context apps --theme gnome --mode system --size 64 "dassault-systemes.draftsight"
  119. xdg-icon-resource uninstall --noupdate --context mimetypes --mode system --size 64 "application-vnd.dassault-systemes.draftsight-dwg"
  120. xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --mode system --size 64 "application-vnd.dassault-systemes.draftsight-dwg"
  121. xdg-icon-resource uninstall --noupdate --context mimetypes --mode system --size 64 "application-vnd.dassault-systemes.draftsight-dxf"
  122. xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --mode system --size 64 "application-vnd.dassault-systemes.draftsight-dxf"
  123. xdg-icon-resource uninstall --noupdate --context mimetypes --mode system --size 64 "application-vnd.dassault-systemes.draftsight-dwt"
  124. xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --mode system --size 64 "application-vnd.dassault-systemes.draftsight-dwt"
  125. xdg-icon-resource uninstall --noupdate --context apps --mode system --size 128 "dassault-systemes.draftsight"
  126. xdg-icon-resource uninstall --noupdate --context apps --theme gnome --mode system --size 128 "dassault-systemes.draftsight"
  127. xdg-icon-resource uninstall --noupdate --context mimetypes --mode system --size 128 "application-vnd.dassault-systemes.draftsight-dwg"
  128. xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --mode system --size 128 "application-vnd.dassault-systemes.draftsight-dwg"
  129. xdg-icon-resource uninstall --noupdate --context mimetypes --mode system --size 128 "application-vnd.dassault-systemes.draftsight-dxf"
  130. xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --mode system --size 128 "application-vnd.dassault-systemes.draftsight-dxf"
  131. xdg-icon-resource uninstall --noupdate --context mimetypes --mode system --size 128 "application-vnd.dassault-systemes.draftsight-dwt"
  132. xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --mode system --size 128 "application-vnd.dassault-systemes.draftsight-dwt"
  133.  
  134. xdg-icon-resource forceupdate
  135.  
  136. xdg-desktop-menu uninstall --novendor --mode system "/opt/dassault-systemes/draftsight/mime/dassault-systemes"_"draftsight.desktop"
  137.  
  138. update-mime-database /usr/share/mime/ &> /dev/null
  139. }
  140.  
  141. post_remove() {
  142. update-desktop-database -q
  143. update-mime-database /usr/share/mime/ &> /dev/null
  144.  
  145. if [ -d /var/opt/dassault-systemes ]; then
  146.   rm -fr /var/opt/dassault-systemes/
  147. fi
  148. }
clone this paste RAW Paste Data