Various compilation scripts & patches for Linux programs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

185 lines
6.8 KiB

7 years ago
  1. --- /dev/null
  2. +++ b/bash/winexec
  3. @@ -0,0 +1,27 @@
  4. +#!/bin/bash
  5. +
  6. +allargs=("$@")
  7. +
  8. +fixpath=0
  9. +for idx in "${!allargs[@]}"; do
  10. + arg="${allargs[$idx]}"
  11. +
  12. + if [[ $fixpath -eq 0 ]]; then
  13. + # fix file paths only after the first executable is found in arg
  14. + if [[ "$arg" == *.exe ]]; then
  15. + fixpath=1
  16. + fi
  17. + if [[ "$arg" == *.EXE ]]; then
  18. + fixpath=1
  19. + fi
  20. + continue
  21. + elif [[ $fixpath -eq 1 ]]; then
  22. + # if arg starts with '/' and it's a path that exists on host
  23. + # precede the path with drive 'Z:'
  24. + if [[ "${arg:0:1}" == '/' && -e "$arg" ]]; then
  25. + allargs[$idx]="z:${arg//\//\\}"
  26. + fi
  27. + fi
  28. +done
  29. +
  30. +exec env "${allargs[@]}"
  31. --- /dev/null
  32. +++ b/bash/remove_shortcut
  33. @@ -0,0 +1,41 @@
  34. +#!/usr/bin/env bash
  35. +
  36. +# Copyright (C) 2011 Pâris Quentin
  37. +
  38. +
  39. +# This program is free software; you can redistribute it and/or modify
  40. +# it under the terms of the GNU General Public License as published by
  41. +# the Free Software Foundation; either version 2 of the License, or
  42. +# (at your option) any later version.
  43. +
  44. +# This program is distributed in the hope that it will be useful,
  45. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  46. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  47. +# GNU General Public License for more details.
  48. +
  49. +# You should have received a copy of the GNU General Public License along
  50. +# with this program; if not, write to the Free Software Foundation, Inc.,
  51. +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  52. +
  53. +# This script makes shortcut of programs
  54. +
  55. +[ "$PLAYONLINUX" = "" ] && exit 0
  56. +source "$PLAYONLINUX/lib/sources"
  57. +
  58. +
  59. +TITLE="$(eval_gettext '$APPLICATION_TITLE shortcut remover')"
  60. +
  61. +if [ "$1" ]; then
  62. + PACKAGE="$1"
  63. +else
  64. + POL_SetupWindow_games "$(eval_gettext "Please choose a software to package")" "$TITLE"
  65. + PACKAGE="$APP_ANSWER"
  66. +fi
  67. +
  68. +POL_SetupWindow_Init
  69. +POL_SetupWindow_wait_next_signal "$(eval_gettext "Removing shortcut...")" "$TITLE"
  70. +POL_Shortcut_RemoveDesktopShortcut "$PACKAGE"
  71. +POL_SetupWindow_message "$(eval_gettext "The shortcut has been removed from $HOME.local/share/applications/ and your desktop")" "$TITLE"
  72. +POL_SetupWindow_Close
  73. +
  74. +exit 0
  75. --- a/python/mainwindow.py
  76. +++ b/python/mainwindow.py
  77. @@ -784,7 +784,9 @@
  78. i+=1
  79. self.menuGaucheAddLink("pol_prgm_configure", _("Configure"), i,Variables.playonlinux_env+"/resources/images/menu/run.png",self.Configure)
  80. i+=1
  81. - self.menuGaucheAddLink("pol_prgm_shortcut", _("Create a shortcut"), i,Variables.playonlinux_env+"/resources/images/menu/shortcut.png",self.Package)
  82. + self.menuGaucheAddLink("pol_prgm_shortcut", _("Create desktop shortcut"), i,Variables.playonlinux_env+"/resources/images/menu/shortcut.png",self.Package)
  83. + i+=1
  84. + self.menuGaucheAddLink("pol_prgm_shortcut_rem", _("Remove desktop shortcut"), i,Variables.playonlinux_env+"/resources/images/menu/shortcut.png",self.RemShortcut)
  85. i+=1
  86. self.menuGaucheAddLink("pol_prgm_adddir", _("Open the directory"), i,Variables.playonlinux_env+"/resources/images/menu/folder-wine.png",self.GoToAppDir)
  87. @@ -980,6 +982,10 @@
  88. def Package(self, event):
  89. game_exec = self.GetSelectedProgram()
  90. subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/make_shortcut", game_exec])
  91. +
  92. + def RemShortcut(self, event):
  93. + game_exec = self.GetSelectedProgram()
  94. + subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/remove_shortcut", game_exec])
  95. def UninstallGame(self, event):
  96. game_exec = self.GetSelectedProgram()
  97. --- a/lib/scripts.lib
  98. +++ b/lib/scripts.lib
  99. @@ -384,7 +384,7 @@
  100. # Do nothing on Mac OS
  101. if [ -n "$Categories" -a "$POL_OS" = "Linux" ] || [ -n "$Categories" -a "$POL_OS" = "BSD" ]; then
  102. LOCALAPPS="$HOME/.local/share/applications"
  103. - make_desktop_shortcut "$iconPath" "$ICON_FILENAME" "$LOCALAPPS" "$PLAYONLINUX/playonlinux --run \"$ICON_FILENAME\"" "$binary_name" "$Categories" "playonlinux-"
  104. + make_desktop_shortcut "$iconPath" "$ICON_FILENAME" "$LOCALAPPS" "$PLAYONLINUX/bash/winexec $PLAYONLINUX/playonlinux --run \"$ICON_FILENAME\"" "$binary_name" "$Categories" "playonlinux-"
  105. fi
  106. fi
  107. @@ -394,7 +394,7 @@
  108. if [ "$POL_OS" = "Mac" ]; then
  109. POL_SetupWindow_AutoApp "$ICON_FILENAME"
  110. else
  111. - make_desktop_shortcut "$iconPath" "$ICON_FILENAME" "$DESKTOP" "$PLAYONLINUX/playonlinux --run \"$ICON_FILENAME\"" "$binary_name" "$Categories"
  112. + make_desktop_shortcut "$iconPath" "$ICON_FILENAME" "$DESKTOP" "$PLAYONLINUX/bash/winexec $PLAYONLINUX/playonlinux --run \"$ICON_FILENAME\"" "$binary_name" "$Categories"
  113. fi
  114. fi
  115. fi
  116. @@ -1039,13 +1039,33 @@
  117. # http://stackoverflow.com/questions/8939580/bash-split-a-string-exactly-like-readline-would-split-it
  118. eval set -- $(grep '^POL_Wine ' "$POL_USER_ROOT/shortcuts/$PACKAGE"|tail -n 1)
  119. local binary="$2"
  120. - make_desktop_shortcut "$iconPath" "$PACKAGE" "$DESKTOP" "$PLAYONLINUX/playonlinux --run \"$PACKAGE\"" "$binary" ""
  121. + LOCALAPPS="$HOME/.local/share/applications"
  122. + make_desktop_shortcut "$iconPath" "$PACKAGE" "$LOCALAPPS" "$DESKTOP" "$PLAYONLINUX/bash/winexec $PLAYONLINUX/playonlinux --run \"$PACKAGE\"" "$binary" ""
  123. + ln -s "$PLACE/$PACKAGE.desktop" "$DESKTOP"
  124. ;;
  125. *)
  126. POL_Debug_Warning "POL_Shortcut_MakeDesktopShortcut: not supported OS: $POL_OS"
  127. esac
  128. }
  129. +
  130. +POL_Shortcut_RemoveDesktopShortcut()
  131. +{
  132. + PACKAGE="$1"
  133. + if [ "$POL_OS" = "Mac" ]; then
  134. + if [ -f "$HOME/Desktop/$PACKAGE.app" ]; then
  135. + rm "$HOME/Desktop/$PACKAGE.app"
  136. + fi
  137. + fi
  138. + if [ "$POL_OS" = "Linux" ] || [ "$POL_OS" == "FreeBSD" ]; then
  139. + LOCALAPPS="$HOME/.local/share/applications"
  140. + if [ -f "$LOCALAPPS/$PACKAGE.desktop" ];then
  141. + rm "$DESKTOP/$PACKAGE.desktop"
  142. + rm "$LOCALAPPS/$PACKAGE.desktop"
  143. + fi
  144. + fi
  145. +}
  146. +
  147. POL_System_is32bit()
  148. {
  149. # Check if the file (1) is a 32bit executable
  150. --- a/lib/playonlinux.lib
  151. +++ b/lib/playonlinux.lib
  152. @@ -670,12 +670,12 @@
  153. (echo "[Desktop Entry]"
  154. echo "Encoding=UTF-8"
  155. echo "Name=$ICON_NAME"
  156. - echo "Comment=PlayOnLinux"
  157. echo "Type=Application"
  158. - echo "Exec=$EXECUTABLE %F"
  159. + echo "Exec=$EXECUTABLE"
  160. echo "Icon=$ICON"
  161. - echo "Name[fr_FR]=$ICON_NAME"
  162. echo "StartupWMClass=$WMCLASS"
  163. + echo "StartupNotify=true"
  164. + echo "Comment="
  165. echo "Categories=$CATEGORIES") > "${SHORT_NAME}.desktop"
  166. chmod +x "${SHORT_NAME}.desktop"
  167. }
  168. --- a/bash/make_shortcut
  169. +++ b/bash/make_shortcut
  170. @@ -34,7 +34,7 @@
  171. POL_SetupWindow_Init
  172. POL_SetupWindow_wait_next_signal "$(eval_gettext "Creating shortcut...")" "$TITLE"
  173. POL_Shortcut_MakeDesktopShortcut "$PACKAGE"
  174. -POL_SetupWindow_message "$(eval_gettext "The shortcut has been placed on your desktop")" "$TITLE"
  175. +POL_SetupWindow_message "$(eval_gettext "The shortcut has been placed on $HOME.local/share/applications/ and linked to your desktop")" "$TITLE"
  176. POL_SetupWindow_Close