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.

170 lines
4.7 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. dir=$1 ; shift
  41. package=${dir##*/}
  42. if [ "$package" = "$dir" ]; then
  43. echo "failed"
  44. echo -e "\t$dir must be <rep>/<pkg>!\n"
  45. exit
  46. fi
  47. rep="$( echo package/*/$package | cut -d'/' -f 2 )"
  48. if [ "$rep" != "*" ]; then
  49. echo "failed"
  50. echo -e "\tpackage $package belongs to $rep!\n"
  51. exit
  52. fi
  53. echo -n "Creating package/$dir ... "
  54. if [ -e package/$dir ] ; then
  55. echo "failed"
  56. echo -e "\tpackage/$dir already exists!\n"
  57. exit
  58. fi
  59. if mkdir -p package/$dir ; then
  60. echo "ok"
  61. else
  62. echo "failed"
  63. exit
  64. fi
  65. cd package/$dir
  66. rc="ROCK-COPYRIGHT"
  67. echo -n "Creating $package.desc ... "
  68. cat >>$package.desc <<EEE
  69. [COPY] --- ${rc}-NOTE-BEGIN ---
  70. [COPY]
  71. [COPY] This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  72. [COPY] Please add additional copyright information _after_ the line containing
  73. [COPY] the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  74. [COPY] the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  75. [COPY]
  76. [COPY] ROCK Linux: rock-src/package/$dir/$package.desc
  77. [COPY] ROCK Linux is Copyright (C) 1998 - `date +%Y` Clifford Wolf
  78. [COPY]
  79. [COPY] This program is free software; you can redistribute it and/or modify
  80. [COPY] it under the terms of the GNU General Public License as published by
  81. [COPY] the Free Software Foundation; either version 2 of the License, or
  82. [COPY] (at your option) any later version. A copy of the GNU General Public
  83. [COPY] License can be found at Documentation/COPYING.
  84. [COPY]
  85. [COPY] Many people helped and are helping developing ROCK Linux. Please
  86. [COPY] have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  87. [COPY] file for details.
  88. [COPY]
  89. [COPY] --- ${rc}-NOTE-END ---
  90. [I] TODO: Short Information
  91. [T] TODO: Long Expanation
  92. [T] TODO: Long Expanation
  93. [T] TODO: Long Expanation
  94. [T] TODO: Long Expanation
  95. [T] TODO: Long Expanation
  96. [U] TODO: URL
  97. [A] TODO: Author
  98. [M] TODO: Maintainer
  99. [C] TODO: Category
  100. [L] TODO: License
  101. [S] TODO: Status
  102. [V] TODO: Version
  103. [P] O -----5---9 800.000
  104. EEE
  105. while [ "$1" ]; do
  106. dl=$1; shift
  107. file=`echo $dl | sed 's,^.*/,,g'`
  108. server=${dl%$file}
  109. echo [D] 0 $file $server >> $package.desc
  110. done
  111. echo >> $package.desc
  112. echo "ok"
  113. echo -n "Creating $package.conf ... "
  114. cat >>$package.conf <<EEE
  115. # --- ${rc}-NOTE-BEGIN ---
  116. #
  117. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  118. # Please add additional copyright information _after_ the line containing
  119. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  120. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  121. #
  122. # ROCK Linux: rock-src/package/$dir/$package.conf
  123. # ROCK Linux is Copyright (C) 1998 - `date +%Y` Clifford Wolf
  124. #
  125. # This program is free software; you can redistribute it and/or modify
  126. # it under the terms of the GNU General Public License as published by
  127. # the Free Software Foundation; either version 2 of the License, or
  128. # (at your option) any later version. A copy of the GNU General Public
  129. # License can be found at Documentation/COPYING.
  130. #
  131. # Many people helped and are helping developing ROCK Linux. Please
  132. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  133. # file for details.
  134. #
  135. # --- ${rc}-NOTE-END ---
  136. EEE
  137. if [ "$create_main" == "1" ] ; then
  138. main=$package"_main";
  139. cat >>$package.conf <<EEE
  140. $main() {
  141. # TODO
  142. }
  143. custmain="$main"
  144. EEE
  145. fi
  146. echo "ok"
  147. echo "Remember to fill in the TODO's:"
  148. cd -
  149. grep TODO package/$dir/$package.*
  150. echo