OpenSDE Framework (without history before r20070)
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.

144 lines
3.4 KiB

  1. #!/bin/bash
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: lib/sde-package/new.sh
  6. # Copyright (C) 2006 - 2007 The OpenSDE Project
  7. # Copyright (C) 2004 - 2006 The T2 SDE Project
  8. # Copyright (C) 1998 - 2003 Clifford Wolf
  9. #
  10. # More information can be found in the files COPYING and README.
  11. #
  12. # This program is free software; you can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; version 2 of the License. A copy of the
  15. # GNU General Public License can be found in the file COPYING.
  16. # --- SDE-COPYRIGHT-NOTE-END ---
  17. # Written by Benjamin Schieder <blindcoder@scavenger.homeip.net>
  18. #
  19. # Use:
  20. # newpackage.sh [-main] <rep>/<pkg> http://www.example.com/down/pkg.tar.bz2
  21. #
  22. # will create <pkg>.desc and <pkg>.conf. .desc will contain the [D] and [COPY]
  23. # already filled in. The other tags are mentioned with TODO.
  24. #
  25. # .conf will contain an empty <pkg>_main() { } and custmain="<pkg>_main"
  26. # if -main is specified.
  27. #
  28. if [ "$1" == "-main" ] ; then
  29. create_main=1
  30. shift
  31. fi
  32. if [ $# -lt 2 ] ; then
  33. cat <<-EEE
  34. Usage:
  35. $0 <option> package/repository/packagename Download_1 < Download_2, Download_n >
  36. Where <option> may be:
  37. -main Create a package.conf file with main-function
  38. EEE
  39. exit 1
  40. fi
  41. dir=${1#package/} ; shift
  42. package=${dir##*/}
  43. if [ "$package" = "$dir" ]; then
  44. echo "failed"
  45. echo -e "\t$dir must be <rep>/<pkg>!\n"
  46. exit
  47. fi
  48. rep="$( echo package/*/$package | cut -d'/' -f 2 )"
  49. if [ "$rep" != "*" ]; then
  50. echo "failed"
  51. echo -e "\tpackage $package belongs to $rep!\n"
  52. exit
  53. fi
  54. rep=${dir/\/$package/}
  55. confdir="package/$dir"
  56. maintainer='The OpenSDE Community <list@opensde.org>'
  57. echo -n "Creating $confdir ... "
  58. if [ -e $confdir ] ; then
  59. echo "failed"
  60. echo -e "\t$confdir already exists!\n"
  61. exit
  62. fi
  63. if mkdir -p $confdir ; then
  64. echo "ok"
  65. else
  66. echo "failed"
  67. exit
  68. fi
  69. echo -n "Creating $package.desc ... "
  70. TAG=SDE-COPYRIGHT-NOTE
  71. cat >$confdir/$package.desc <<EEE
  72. [COPY] --- $TAG-BEGIN ---
  73. [COPY] This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  74. [COPY]
  75. [COPY] Filename: package/.../$package/$package.desc
  76. [COPY] Copyright (C) $( date +%Y ) The OpenSDE Project
  77. [COPY]
  78. [COPY] More information can be found in the files COPYING and README.
  79. [COPY]
  80. [COPY] This program is free software; you can redistribute it and/or modify
  81. [COPY] it under the terms of the GNU General Public License as published by
  82. [COPY] the Free Software Foundation; version 2 of the License. A copy of the
  83. [COPY] GNU General Public License can be found in the file COPYING.
  84. [COPY] --- $TAG-END ---
  85. [I] TODO: Short Information
  86. [T] TODO: Long Expanation
  87. [T] TODO: Long Expanation
  88. [T] TODO: Long Expanation
  89. [T] TODO: Long Expanation
  90. [T] TODO: Long Expanation
  91. [U] TODO: URL
  92. [A] TODO: Author
  93. [M] ${maintainer:-TODO: Maintainer}
  94. [C] TODO: Category
  95. [L] TODO: License
  96. [S] TODO: Status
  97. [V] TODO: Version
  98. [P] X -----5---9 800.000
  99. EEE
  100. while [ "$1" ]; do
  101. dl=$1; shift
  102. file=`echo $dl | sed 's,^.*/,,g'`
  103. server=${dl%$file}
  104. echo [D] 0 $file $server >> $confdir/$package.desc
  105. done
  106. echo >> $confdir/$package.desc
  107. echo "ok"
  108. echo -n "Creating $package.conf ... "
  109. if [ "$create_main" == "1" ] ; then
  110. cat >>$confdir/$package.conf <<-EEE
  111. ${package}_main() {
  112. : TODO
  113. }
  114. custmain="${package}_main"
  115. EEE
  116. fi
  117. echo "ok"
  118. echo "Remember to fill in the TODO's:"
  119. grep TODO $confdir/$package.*
  120. echo