-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdb-add
More file actions
executable file
·56 lines (44 loc) · 1.02 KB
/
db-add
File metadata and controls
executable file
·56 lines (44 loc) · 1.02 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
#!/bin/bash
. "$(dirname $0)/config"
. "$(dirname $0)/db-functions"
if [ $# -lt 3 ]; then
msg "usage: ${0##*/} <repo> <arch> <pkgfile> ..."
exit 1
fi
repo="$1"
arch="$2"
pkgfiles=(${@:3})
ftppath="$FTP_BASE/$repo/os"
if ! check_repo_permission $repo; then
die "You don't have permission to add packages to ${repo}"
fi
if [ "$arch" == "all" ]; then
tarches=(${ARCHES[@]})
else
tarches=("$arch")
fi
for tarch in ${tarches[@]}; do
repo_lock $repo $tarch || exit 1
done
msg "Adding packages for [$repo]..."
errored=false
for pkgfile in ${pkgfiles[@]}; do
if [[ -f "$pkgfile" ]]; then
if $REQUIRE_SIGNATURE && [[ ! -f "${pkgfile}.sig" ]]; then
error "Package signature ${pkgfile}.sig not found!"
errored=true
break
fi
arch_add_to_pool "$pkgfile"
fi
for tarch in ${tarches[@]}; do
msg2 "$tarch\t${pkgfile##*/}"
arch_db_add $repo $tarch $pkgfile
done
done
if ! $errored; then
arch_history_commit "db-add: ${tarches[*]}: ${pkgfiles[*]##*/}"
fi
for tarch in ${tarches[@]}; do
repo_unlock $repo $tarch
done