byhand-win32-loader 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. set -u
  3. set -e
  4. if [ $# -lt 5 ]; then
  5. echo "Usage: $0 filename version arch changes_file suite"
  6. exit 1
  7. fi
  8. export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
  9. . $SCRIPTVARS
  10. WIN32_LOADER_PATH="$1" # win32-loader_${VERSION}_${ARCH}{.exe,txt}
  11. WIN32_LOADER_FILE="${WIN32_LOADER_PATH##*/}"
  12. VERSION="$2"
  13. ARCH="$3"
  14. CHANGES="$4" # Changes file for the upload
  15. SUITE="$5"
  16. case $SUITE in
  17. unstable|sid|*proposed-updates)
  18. : # nothing to do
  19. ;;
  20. *)
  21. SUITE="${SUITE}-proposed-updates"
  22. ;;
  23. esac
  24. case "${WIN32_LOADER_FILE}" in
  25. win32-loader_*.exe|win32-loader_*.txt)
  26. : # okay
  27. ;;
  28. *)
  29. echo "Error: invalid filename for byhand-win32-loader"
  30. exit 1
  31. ;;
  32. esac
  33. # This must end with /
  34. TARGET="${ftpdir}/tools/win32-loader/${SUITE}/"
  35. # Prepare the target filename by removing the version and arch parts;
  36. # transforms any/path/win32-loader_${VERSION}_${ARCH}.${extension} to win32-loader.${extension}
  37. TARGET_FILENAME="${WIN32_LOADER_FILE%%_*}.${WIN32_LOADER_FILE##*.}"
  38. # Check validity of the target directory
  39. if [ ! -d "$TARGET" ]; then
  40. mkdir -p "$TARGET"
  41. fi
  42. # Put said file into the tools directory
  43. # Use --remove-destination to avoid problems with the fact that the target may
  44. # be a hardlink and in that case we'd update multiple suites together
  45. cp --remove-destination "$WIN32_LOADER_PATH" "${TARGET}${TARGET_FILENAME}"
  46. # Chmod it correctly
  47. chmod 0644 "${TARGET}${TARGET_FILENAME}"
  48. exit 0