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