modified version of jenkins debian glue (https://github.com/mika/jenkins-debian-glue) for devuan
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.
 
 
 
 
 

69 lines
2.1 KiB

  1. #!/bin/bash
  2. if [ -z ${JENKINS_DEBIAN_GLUE_QUIET:-} ]; then
  3. set -x
  4. fi
  5. set -e
  6. # backwards compatibility, see PR#94
  7. if [ -z "${REPOSITORY:-}" ] ; then
  8. repository_is_missing_in_env=true
  9. else
  10. repository_is_missing_in_env=false
  11. fi
  12. if [ -r /etc/jenkins/debian_glue ] ; then
  13. . /etc/jenkins/debian_glue
  14. fi
  15. # backwards compatibility, see PR#94
  16. if [ -n "${REPOSITORY:-}" ] && $repository_is_missing_in_env ; then
  17. echo "*** WARNING: 'REPOSITORY' set in /etc/jenkins/debian_glue but should be DEFAULT_REPOSITORY ***"
  18. echo "*** WARNING: Setting DEFAULT_REPOSITORY to $REPOSITORY for backwards compatibility ***"
  19. echo "*** WARNING: Please replace REPOSITORY=... in /etc/jenkins/debian_glue with DEFAULT_REPOSITORY=... ***"
  20. DEFAULT_REPOSITORY="${REPOSITORY}"
  21. fi
  22. if [ -z "${DEFAULT_REPOSITORY:-}" ] ; then
  23. echo "*** Repository variable DEFAULT_REPOSITORY is unset, using default [$DEFAULT_REPOSITORY] ***"
  24. DEFAULT_REPOSITORY='/srv/repository'
  25. fi
  26. # REPOSITORY can overwrite DEFAULT_REPOSITORY, so define only if unset
  27. if [ -z "${REPOSITORY:-}" ] ; then
  28. REPOSITORY="${DEFAULT_REPOSITORY}"
  29. echo "*** Repository variable REPOSITORY is unset, using default [$REPOSITORY] ***"
  30. fi
  31. # support usage of a reprepro wrapper
  32. REPREPRO_CMD="${REPREPRO_CMD:-reprepro}"
  33. if [ -z "${REPREPRO_OPTS:-}" ] ; then
  34. REPREPRO_OPTS='--waitforlock 1000 -v'
  35. fi
  36. if [ "$#" -lt 1 ] ; then
  37. echo "Usage: $0 <codename>" >&2
  38. exit 1
  39. fi
  40. codename="$1"
  41. if ! [ -r "${REPOSITORY}/conf/distributions" ] ; then
  42. echo "*** Error: could not read ${REPOSITORY}/conf/distributions" >&2
  43. exit 1
  44. fi
  45. if ! grep -q "^\(Codename\|Suite\): ${codename}$" "${REPOSITORY}/conf/distributions" ; then
  46. echo "*** Codename $codename does not exist in ${REPOSITORY}/conf/distributions - nothing to do."
  47. exit 0
  48. fi
  49. echo "*** Removing codename $codename from reprepro configuration in $REPOSITORY ***"
  50. perl -i -00 -pe "if (!\$done && m|$codename|) { \$_=q(); \$done++}" "${REPOSITORY}/conf/distributions"
  51. echo "*** Removing vanished data from reprepro ***"
  52. ${REPREPRO_CMD} $REPREPRO_OPTS -b "$REPOSITORY" --delete clearvanished
  53. # vim:foldmethod=marker ts=2 ft=sh ai expandtab sw=2