mirror of the now-defunct rocklinux.org
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.

182 lines
4.9 KiB

  1. #!/bin/bash
  2. #
  3. # Written by Benjamin Schieder <blindcoder@scavenger.homeip.net>
  4. #
  5. # Use:
  6. # newpackage.sh [-main] <rep>/<pkg> http://www.example.com/down/pkg.tar.bz2
  7. #
  8. # will create <pkg>.desc and <pkg>.conf. .desc will contain the [D] and [COPY]
  9. # already filled in. The other tags are mentioned with TODO.
  10. #
  11. # .conf will contain an empty <pkg>_main() { } and custmain="<pkg>_main"
  12. # if -main is specified.
  13. #
  14. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  15. #
  16. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  17. # Please add additional copyright information _after_ the line containing
  18. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  19. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  20. #
  21. # ROCK Linux: rock-src/misc/archive/newpackage.sh
  22. # ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
  23. #
  24. # This program is free software; you can redistribute it and/or modify
  25. # it under the terms of the GNU General Public License as published by
  26. # the Free Software Foundation; either version 2 of the License, or
  27. # (at your option) any later version. A copy of the GNU General Public
  28. # License can be found at Documentation/COPYING.
  29. #
  30. # Many people helped and are helping developing ROCK Linux. Please
  31. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  32. # file for details.
  33. #
  34. # --- ROCK-COPYRIGHT-NOTE-END ---
  35. #
  36. if [ "$1" == "-main" ] ; then
  37. create_main=1
  38. shift
  39. fi
  40. if [ $# -lt 2 ] ; then
  41. cat <<-EEE
  42. Usage:
  43. $0 <option> package/repository/packagename Download_1 < Download_2, Download_n >
  44. Where <option> may be:
  45. -main Create a package.conf file with main-function
  46. EEE
  47. exit 1
  48. fi
  49. dir=${1#package/} ; shift
  50. package=${dir##*/}
  51. if [ "$package" = "$dir" ]; then
  52. echo "failed"
  53. echo -e "\t$dir must be <rep>/<pkg>!\n"
  54. exit
  55. fi
  56. rep="$( echo package/*/$package | cut -d'/' -f 2 )"
  57. if [ "$rep" != "*" ]; then
  58. echo "failed"
  59. echo -e "\tpackage $package belongs to $rep!\n"
  60. exit
  61. fi
  62. echo -n "Creating package/$dir ... "
  63. if [ -e package/$dir ] ; then
  64. echo "failed"
  65. echo -e "\tpackage/$dir already exists!\n"
  66. exit
  67. fi
  68. if mkdir -p package/$dir ; then
  69. echo "ok"
  70. else
  71. echo "failed"
  72. exit
  73. fi
  74. cd package/$dir
  75. rc="ROCK-COPYRIGHT"
  76. echo -n "Creating $package.desc ... "
  77. cat >>$package.desc <<EEE
  78. [COPY] --- ${rc}-NOTE-BEGIN ---
  79. [COPY]
  80. [COPY] This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  81. [COPY] Please add additional copyright information _after_ the line containing
  82. [COPY] the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  83. [COPY] the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  84. [COPY]
  85. [COPY] ROCK Linux: rock-src/package/$dir/$package.desc
  86. [COPY] ROCK Linux is Copyright (C) 1998 - `date +%Y` Clifford Wolf
  87. [COPY]
  88. [COPY] This program is free software; you can redistribute it and/or modify
  89. [COPY] it under the terms of the GNU General Public License as published by
  90. [COPY] the Free Software Foundation; either version 2 of the License, or
  91. [COPY] (at your option) any later version. A copy of the GNU General Public
  92. [COPY] License can be found at Documentation/COPYING.
  93. [COPY]
  94. [COPY] Many people helped and are helping developing ROCK Linux. Please
  95. [COPY] have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  96. [COPY] file for details.
  97. [COPY]
  98. [COPY] --- ${rc}-NOTE-END ---
  99. [I] TODO: Short Information
  100. [T] TODO: Long Expanation
  101. [T] TODO: Long Expanation
  102. [T] TODO: Long Expanation
  103. [T] TODO: Long Expanation
  104. [T] TODO: Long Expanation
  105. [U] TODO: URL
  106. [A] TODO: Author
  107. [M] TODO: Maintainer
  108. [C] TODO: Category
  109. [L] TODO: License
  110. [S] TODO: Status
  111. [V] TODO: Version
  112. [P] X -----5---9 800.000
  113. EEE
  114. while [ "$1" ]; do
  115. dl=$1; shift
  116. file=`echo $dl | sed 's,^.*/,,g'`
  117. server=${dl%$file}
  118. echo [D] 0 $file $server >> $package.desc
  119. done
  120. echo >> $package.desc
  121. echo "ok"
  122. echo -n "Creating $package.conf ... "
  123. if [ "$create_main" == "1" ] ; then
  124. cat >>$package.conf <<-EEE
  125. # --- ${rc}-NOTE-BEGIN ---
  126. #
  127. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  128. # Please add additional copyright information _after_ the line containing
  129. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  130. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  131. #
  132. # ROCK Linux: rock-src/package/$dir/$package.conf
  133. # ROCK Linux is Copyright (C) 1998 - `date +%Y` Clifford Wolf
  134. #
  135. # This program is free software; you can redistribute it and/or modify
  136. # it under the terms of the GNU General Public License as published by
  137. # the Free Software Foundation; either version 2 of the License, or
  138. # (at your option) any later version. A copy of the GNU General Public
  139. # License can be found at Documentation/COPYING.
  140. #
  141. # Many people helped and are helping developing ROCK Linux. Please
  142. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  143. # file for details.
  144. #
  145. # --- ${rc}-NOTE-END ---
  146. EEE
  147. cat >>$package.conf <<-EEE
  148. ${package}_main() { #TODO
  149. }
  150. custmain="${package}_main"
  151. EEE
  152. fi
  153. echo "ok"
  154. echo "Remember to fill in the TODO's:"
  155. cd -
  156. grep TODO package/$dir/$package.*
  157. echo