petspec 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. #!/bin/sh
  2. #optional params passed in:
  3. #"${NAMEONLY}" "${PUPCATEGORY}" "${PUPOFFICIALDEPS}" "${PUPMENUDESCR}" "$BASEPKG" "$SIZEK" "$PUPPATH" "$ARCHDEPENDENT" "$DEFREPO"
  4. #w476 bug fixes, to work properly with dir2pet.
  5. #w482 set default name of repo to 'official'.
  6. #v425 category does not necessarily have anything to do with menu.
  7. #100201 added PUPPATH, ARCHDEPENDENT, DEFREPO, improve setting of distro name & version.
  8. #100303 small bugfix.
  9. #100320 prevent crash if $5 only has name, no version number.
  10. #100508 bugfix empty field.
  11. #120517 update the compileddistro items.
  12. #120719 support raspbian.
  13. #120814 support sub-category. 120819 sub-category fixes.
  14. #130224 add Document;utility
  15. #old ex: "abiword-2.6.3" "abiword 2.6.3: wordprocessor" ONOFF "Document +fribidi,+gtk+,+goffice,+wv,+enchant 7556K"
  16. #new: pkgname|nameonly|version|pkgrelease|category[;subcategory]|size|path|fullfilename|dependencies|description|compileddistro|compiledrelease|repo|
  17. #ex: abiword-1.2.4|abiword|1.2.4|5|Document|999K|slackware/ab|abiword-1.2.4-5-i486.tgz|+aiksausus,+gtk2|a nice wordprocessor|slackware|12.2|official|
  18. . /etc/DISTRO_SPECS
  19. . /root/.packages/DISTRO_PKGS_SPECS
  20. . /root/.packages/DISTRO_PET_REPOS
  21. mkdir -p /var/local/petspec #100201
  22. DEF_nameonly="abiword"
  23. DEF_version="1.2.3-1"
  24. DEF_category="BuildingBlock"
  25. #DEF_subcategory="" #120814
  26. DEF_size_val="UNKNOWN"
  27. #DEF_path="pet_packages-4"
  28. DEF_fullfilename="abiword-1.2.3-1.pet"
  29. DEF_dependencies="+aiksaurus,+gtk2"
  30. DEF_description="A powerful wordprocessor"
  31. DEF_compileddistro="$DISTRO_BINARY_COMPAT"
  32. DEF_compiledrelease="$DISTRO_COMPAT_VERSION"
  33. #DEF_repo="official"
  34. DEF_kernel="`uname -r`"
  35. DEF_pkgname="${DEF_nameonly}-${DEF_version}"
  36. if [ $5 ];then
  37. DEF_nameonly="$1"
  38. [ "$2" != "EMPTY" ] && DEF_category="$2"
  39. [ "$3" != "EMPTY" ] && DEF_dependencies="$3"
  40. [ "$3" = "EMPTY" ] && DEF_dependencies=""
  41. [ "$4" != "EMPTY" ] && DEF_description="$4"
  42. [ "$4" = "EMPTY" ] && DEF_description="no description provided"
  43. DEF_pkgname="$5"
  44. xPATTERN="s%${DEF_nameonly}%%"
  45. DEF_version="`echo -n "$DEF_pkgname" | sed -e "$xPATTERN" -e 's%^\\-%%'`"
  46. [ "$DEF_version" = "" ] && DEF_version="UNKNOWN" #100320
  47. [ $5 ] && DEF_size_val="$6"
  48. DEF_fullfilename="${5}.pet"
  49. fi
  50. #100201 subdirectory of package on repo...
  51. DEF_path=""
  52. [ ! $7 ] && [ -f /var/local/petspec/DEF_path ] && DEF_path="`cat /var/local/petspec/DEF_path`"
  53. [ $7 ] && [ "$7" != "EMPTY" ] && DEF_path="${7}"
  54. #100201 determine if pkg is only scripts...
  55. ARCHDEPENDENT='yes'
  56. [ $8 ] && ARCHDEPENDENT="${8}"
  57. if [ "$ARCHDEPENDENT" != "yes" -a "$ARCHDEPENDENT" != "no" ];then
  58. DEF_compileddistro="`echo -n "$ARCHDEPENDENT" | cut -f 1 -d '|'`"
  59. DEF_compiledrelease="`echo -n "$ARCHDEPENDENT" | cut -f 2 -d '|'`"
  60. fi
  61. if [ "$ARCHDEPENDENT" = "no" ];then
  62. DEF_compileddistro="DISTRO INDEPENDENT"
  63. DEF_compiledrelease="DISTRO INDEPENDENT"
  64. fi
  65. [ "$DEF_compiledrelease" = "" ] && DEF_compiledrelease="$DISTRO_COMPAT_VERSION" #100508
  66. #100201 id of repository...
  67. DEF_repo=""
  68. [ ! $9 ] && [ -f /var/local/petspec/DEF_repo ] && DEF_repo="`cat /var/local/petspec/DEF_repo`"
  69. [ $9 ] && [ "$9" != "EMPTY" ] && DEF_repo="${9}"
  70. #120814 add sub-categories (note, icons for all categories and sub-cat are in /usr/local/lib/X11/mini-icons) ...
  71. ITEMSCAT="<item>${DEF_category}</item>"
  72. for ONECAT in 'NO CATEGORY' Desktop 'Desktop;appearance' 'Desktop;applet' 'Desktop;settings' 'Desktop;sleep' 'Desktop;windows' System 'System;memory' 'System;print' 'System;process' 'System;security' 'System;storage' Setup 'Setup;installation' 'Setup;puppy' 'Setup;wizard' Utility 'Utility;development' 'Utility;help' 'Utility;package' 'Utility;shell' Filesystem 'Filesystem;filemanager' 'Filesystem;find' 'Filesystem;storage' Graphic 'Graphic;camera' 'Graphic;draw' 'Graphic;flow' 'Graphic;paint' 'Graphic;print' 'Graphic;scanner' 'Graphic;utility' 'Graphic;viewer' Document 'Document;catalog' 'Document;layout' 'Document;edit' 'Document;viewer' 'Document;utility' Business 'Business;calc' 'Business;finance' 'Business;planner' 'Business;spreadsheet' Personal 'Personal;database' 'Personal;date' 'Personal;education' 'Personal;organizer' 'Personal;security' 'Personal;timing' Network 'Network;connect' 'Network;firewall' 'Network;phone' 'Network;transfer' 'Network;utility' Internet 'Internet;block' 'Internet;browser' 'Internet;chat' 'Internet;login' 'Internet;mailnews' 'Internet;transfer' 'Internet;utility' Multimedia 'Multimedia;mediaplayer' 'Multimedia;optical' 'Multimedia;sound' 'Multimedia;utility' 'Multimedia;video' Fun 'Fun;adventure' 'Fun;arcade' 'Fun;boardgame' 'Fun;cardgame' 'Fun;puzzle' 'Fun;shooter' Help BuildingBlock
  73. do
  74. #[ "$ONECAT" = "$DEF_category" ] && continue
  75. ITEMSCAT="${ITEMSCAT}<item>${ONECAT}</item>"
  76. done
  77. #sort compileddistro items...
  78. ITEMSCOMP="<item>${DEF_compileddistro}</item>"
  79. for ONECHOICE in 'DISTRO INDEPENDENT' arch debian gentoo mageia puppy raspbian scientific slackware t2 ubuntu
  80. do
  81. [ "$ONECHOICE" = "${DEF_compileddistro}" ] && continue
  82. ITEMSCOMP="${ITEMSCOMP}<item>${ONECHOICE}</item>"
  83. done
  84. DEPENDENCIES=""
  85. if [ "$DEF_dependencies" != "" ];then
  86. DEPENDENCIES="<default>${DEF_dependencies}</default>"
  87. fi
  88. export DLG_REPONAME='
  89. <window title="Name of repository" icon-name="gtk-index" window_position="1">
  90. <vbox>
  91. <text use-markup="true">
  92. <label>"This field is intended to have a unique single-word that identifies the repository where the PET package is being hosted. For example, we have used the word <b>official</b> for PETs hosted at ibiblio.org and the official mirrors.
  93. However, this field is not being used for anything, so currently does not serve any purpose, so recommend leave it empty. Besides, if you have created a PET that could be hosted at various sites, then you do not really have a single name that is appropriate."</label>
  94. <variable>VAR_RP</variable>
  95. </text>
  96. <button>
  97. <label>Close</label>
  98. <action type="closewindow">VAR_RP</action>
  99. </button>
  100. </vbox>
  101. </window>'
  102. export DLG_FOLDER='
  103. <window title="Folder path" icon-name="gtk-index" window_position="1">
  104. <vbox>
  105. <text use-markup="true">
  106. <label>"The Puppy Package Manager knows the URLs of the repositories, however, individual PET packages may be in different folders within the repo.
  107. If the PET is to be hosted on the offical repo ibiblio.org or mirrors, then this field can be left empty, as the package mamager knows to look in a folder named pet_packages-*, where * is <b>lucid</b> for Lucid Puppy, <b>wary5</b> for Wary Puppy, <b>drake</b> for Drake Puppy.
  108. It is recommended to leave this field empty."</label>
  109. <variable>VAR_F</variable>
  110. </text>
  111. <button>
  112. <label>Close</label>
  113. <action type="closewindow">VAR_F</action>
  114. </button>
  115. </vbox>
  116. </window>'
  117. export DLG_DEPS='
  118. <window title="Dependencies" icon-name="gtk-index" window_position="1">
  119. <vbox>
  120. <text use-markup="true">
  121. <label>"Enter a list of package names that this package is dependent on. If you know that the packages are already builtin to Puppy, then no need to list them. Here is an example:
  122. <b>+enchant,+fribidi,+goffice&amp;ge4.5.6,+libgsf,+wv</b>
  123. Please put a plus character in front of each name, comma delimiter. You may also optionally append a version-qualification, as shown for goffice. The accepted operators are <b>&amp;le &amp;ge &amp;lt &amp;gt &amp;eq</b>.
  124. If your package requires a certain kernel version, this may also be specified. Note, the dhcpcd package is one example. You can specify kernel-version dependency like this:
  125. <b>+linux_kernel&amp;ge2.6.38</b>
  126. Note1: It is planned in the future to implement a minus character prefix (-) to dependencies (instead of the +), which will mean a conflicting package (this package cannot work if that package is installed).
  127. Note2: More than one version-condition is allowed, for example, to specify a range: <b>+alsa-lib&amp;ge2.3&amp;lt2.4</b>
  128. Note3: You can find out the names of inbuilt packages in file /root/.packages/woof-installed-packages. The names of other not-installed packages can be found in /root/.packages/Packages-* files.
  129. Note4: As Puppy can use packages from many different distros, sometimes the same application will have a different name, even something as simple as alsa-lib or alsa_lib. When analyzing dependencies, Puppy has a list of package-name aliases to handle this. See variable PKG_NAME_ALIASES in file PKGS_MANAGEMENT (also in /root/.packages/ in a running Puppy."</label>
  130. <variable>VAR_DEPS</variable>
  131. </text>
  132. <button>
  133. <label>Close</label>
  134. <action type="closewindow">VAR_DEPS</action>
  135. </button>
  136. </vbox>
  137. </window>'
  138. export DLG_CAT='
  139. <window title="Categories" icon-name="gtk-index" window_position="1">
  140. <vbox>
  141. <text use-markup="true">
  142. <label>"These are the top-level categories:
  143. <i>Desktop System Setup Utility Filesystem Graphic Document Business Personal Network Internet Multimedia Fun Help BuildingBlock</i>
  144. You will also find these in the top-level menu (see bottom-left of screen). You may also optionally select a sub-category, but if none seem to apply, just choose the top-level only -- for example, <b>Fun</b> has sub-categories <b>adventure</b>, <b>arcade</b>, <b>boardgame</b>, <b>cardgame</b>, <b>puzzle</b> and <b>shooter</b>, but if none of those seem to apply, just choose <b>Fun</b>.
  145. <b>BuildingBlock</b> packages are those that are system-level utilities, data and libraries, that you would not normally choose to install via the Puppy Package Manager. Thus, they are by default filtered out by the PPM. For example, <i>libsdl</i> is a library, however some applications will have it as a dependency so if you choose to install one of those, then libsdl will also get installed -- <i>libsdl</i> is not something that you would want to install on its own, thus it qualifies as a <b>BuildingBlock</b>.
  146. <b>Technical notes:</b>
  147. Note that the Puppy Package Manager will recognize category and subcategory, and filters packages based on category, to display a smaller selection to choose from. Packages are listed in the PPM with icons alongside, that are obtained from /usr/local/lib/X11/mini-icons -- there is a generic icon for every category and sub-category.
  148. A category, with optional subcategory, does not mean that the application has a menu entry. A menu entry will only exist if an appropriate .desktop file exists in /usr/share/applications -- this is provided in the package. The .desktop file specifies whereabouts in the menu the entry is located, and ideally we would expect it to correspond to the category;subcategory field described above, however in theory the .desktop file can place it anywhere else."</label>
  149. <variable>VAR_C</variable>
  150. </text>
  151. <button>
  152. <label>Close</label>
  153. <action type="closewindow">VAR_C</action>
  154. </button>
  155. </vbox>
  156. </window>'
  157. export MAIN_DIALOG="
  158. <window title=\"Package database-entry creator\" icon-name=\"gtk-index\">
  159. <vbox>
  160. <text use-markup=\"true\"><label>\"<b>The fields marked with '*' are required, the rest fill in as much as possible or if uncertain leave blank.</b>\"</label></text>
  161. <hbox>
  162. <text><label>\" \"</label></text><text><label>*Name-only:</label></text>
  163. <entry>
  164. <default>${DEF_nameonly}</default><variable>DB_nameonly</variable>
  165. </entry>
  166. </hbox>
  167. <hbox>
  168. <text><label>\" \"</label></text><text><label>*Version:</label></text>
  169. <entry>
  170. <default>${DEF_version}</default><variable>DB_version</variable>
  171. </entry>
  172. </hbox>
  173. <hbox>
  174. <text>
  175. <label>*Category:</label>
  176. </text>
  177. <combobox>
  178. <variable>DB_category</variable>
  179. ${ITEMSCAT}
  180. </combobox>
  181. <button>
  182. <input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input>
  183. <action type=\"launch\">DLG_CAT</action>
  184. </button>
  185. </hbox>
  186. <hbox>
  187. <text><label>\" \"</label></text><text><label>Size of installed package:</label></text>
  188. <entry>
  189. <default>${DEF_size_val}</default><variable>DB_size_val</variable>
  190. </entry>
  191. <text><label>KB</label></text>
  192. </hbox>
  193. <hbox>
  194. <text><label>*Full package name:</label></text>
  195. <entry>
  196. <default>${DEF_fullfilename}</default><variable>DB_fullfilename</variable>
  197. </entry>
  198. </hbox>
  199. <hbox>
  200. <text><label>Dependencies:</label></text>
  201. <entry>
  202. ${DEPENDENCIES}<variable>DB_dependencies</variable>
  203. </entry>
  204. <button>
  205. <input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input>
  206. <action type=\"launch\">DLG_DEPS</action>
  207. </button>
  208. </hbox>
  209. <hbox>
  210. <text><label>Description:</label></text>
  211. <entry>
  212. <default>${DEF_description}</default><variable>DB_description</variable>
  213. </entry>
  214. </hbox>
  215. <frame Extra optional>
  216. <hbox>
  217. <text><label>Folder path within repository:</label></text>
  218. <entry>
  219. <default>\"${DEF_path}\"</default><variable>DB_path</variable>
  220. </entry>
  221. <button>
  222. <input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input>
  223. <action type=\"launch\">DLG_FOLDER</action>
  224. </button>
  225. </hbox>
  226. <hbox>
  227. <text>
  228. <label>Compiled in compatible-distro:</label>
  229. </text>
  230. <combobox>
  231. <variable>DB_compileddistro</variable>
  232. ${ITEMSCOMP}
  233. </combobox>
  234. </hbox>
  235. <hbox>
  236. <text><label>\" \"</label></text><text><label>Compatible-distro version:</label></text>
  237. <entry>
  238. <default>${DEF_compiledrelease}</default><variable>DB_compiledrelease</variable>
  239. </entry>
  240. </hbox>
  241. <hbox>
  242. <text><label>\" \"</label></text><text><label>Single unique name of repository:</label></text>
  243. <entry>
  244. <default>\"${DEF_repo}\"</default><variable>DB_repo</variable>
  245. </entry>
  246. <button>
  247. <input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input>
  248. <action type=\"launch\">DLG_REPONAME</action>
  249. </button>
  250. </hbox>
  251. </frame>
  252. <hbox>
  253. <button>
  254. <label>Help</label>
  255. <action>defaulthtmlviewer http://puppylinux.com/woof/pkg-db-format.htm & </action>
  256. </button>
  257. <button>
  258. <label>Generate package database entry</label>
  259. <action type=\"exit\">GENERATE_DB</action>
  260. </button>
  261. <button cancel></button>
  262. </hbox>
  263. </vbox>
  264. </window>
  265. "
  266. RETVALS="`gtkdialog4 --program=MAIN_DIALOG`"
  267. #ex:
  268. #DB_category="BuildingBlock"
  269. #DB_compileddistro="ubuntu"
  270. #DB_compiledrelease="jaunty"
  271. #DB_dependencies="+aiksaurus,+gtk2"
  272. #DB_description="A powerful wordprocessor"
  273. #DB_fullfilename="abiword-1.2.3-1.pet"
  274. #DB_path="pet_packages-5"
  275. #DB_pkgname="abiword"
  276. #DB_repo="5"
  277. #DB_size_val="UNKNOWN"
  278. #DB_version="1.2.3-1"
  279. #EXIT="GENERATE_DB"
  280. eval "$RETVALS"
  281. [ "$EXIT" != "GENERATE_DB" ] && exit 1
  282. echo -n "$DB_path" > /var/local/petspec/DEF_path #100201
  283. echo -n "$DB_repo" > /var/local/petspec/DEF_repo #100201
  284. DB_size="$DB_size_val"'K'
  285. [ "$DB_size_val" = "UNKNOWN" ] && DB_size=""
  286. [ "$DB_category" = "NO CATEGORY" ] && DB_category=""
  287. [ "$DB_compileddistro" = "DISTRO INDEPENDENT" ] && DB_compileddistro=""
  288. [ "$DB_compiledrelease" = "DISTRO INDEPENDENT" ] && DB_compiledrelease="" #100303
  289. DB_version="`echo -n "$DB_version" | sed -e 's% %%g'`" #100320 precaution, get rid of any spaces.
  290. if [ "$DB_version" = "" -o "$DB_version" = "UNKNOWN" ];then #100320
  291. DB_pkgname="$DB_nameonly"
  292. DB_version=""
  293. else
  294. DB_pkgname="${DB_nameonly}-${DB_version}"
  295. fi
  296. DB_ENTRY="${DB_pkgname}|${DB_nameonly}|${DB_version}|${DB_pkgrelease}|${DB_category}|${DB_size}|${DB_path}|${DB_fullfilename}|${DB_dependencies}|${DB_description}|${DB_compileddistro}|${DB_compiledrelease}|${DB_repo}|"
  297. echo
  298. echo "$DB_ENTRY"
  299. echo "This is the package database entry:
  300. $DB_ENTRY" > /tmp/petspec_db_entry
  301. nohup defaulttextviewer /tmp/petspec_db_entry 2>/dev/null &
  302. exit 0
  303. ###END###