This repository was archived by the owner on May 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakerepo
More file actions
executable file
·66 lines (49 loc) · 1.3 KB
/
makerepo
File metadata and controls
executable file
·66 lines (49 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
#
# vim ft: shell
set -eu -o pipefail
[ "${DEBUG:=false}" = "true" ] && set -x
print_info() {
printf "[\033[1;35m+\033[0m] INFO: %s\n" "${1}"
}
print_error() {
printf "[\033[1;34mx\033[0m] \033[1;34mERROR\033[0m: %s\n" "${1}" >&2
exit 1
}
print_usage() {
cat <<HEREDOC >&2
usage: $(basename "${0}") [-qh] OUTPUT_DIR
-q, --quiet Do not output to stdout
-h, --help Print this help and exit
HEREDOC
}
_makerepo() {
output_dir="${1:-}"
[ -z "$output_dir" ] && print_error "Missing output dir parameter"
mkdir -p "$output_dir"/{sources,packages}
print_info "Copying package files"
(
shopt -s globstar nullglob
cp -v ./**/{*.dsc,*.orig.tar*,*.debian.tar*} "$output_dir"/sources
cp -v ./**/*.deb "$output_dir"/packages
)
print_info "Generating package indexes"
( cd "$output_dir"; dpkg-scanpackages packages/ | gzip -9c > packages/Packages.gz )
( cd "$output_dir"; dpkg-scansources sources/ | gzip -9c > sources/Sources.gz )
}
while true; do
shiftpos=2
case "${1:-}" in
-q|--quiet)
exec >> /dev/null
shiftpos=1
;;
-h|--help)
print_usage
exit 0
;;
*) break ;;
esac
shift "$shiftpos"
done
_makerepo "$@"