-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup_repo.sh
executable file
·52 lines (40 loc) · 947 Bytes
/
setup_repo.sh
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
#!/bin/bash
if [ "$(id -u)" -ne 0 ]; then
echo "You should execute this script as root" >&2
exit 1
fi
if ! command -v repo-add &>/dev/null; then
echo "Error: command 'repo-add' not found" >&2
exit 1
fi
if [ ! -d ./work ]; then
echo "Error: directory 'work' does not exists" >&2
exit 1
fi
if [ ! -r ./.pkgname ]; then
echo "Error: file '.pkgname' does not exists or missing permissions" >&2
exit 1
fi
if [ -z "$(cat ./.pkgname)" ]; then
echo "Error: file '.pkgname' is empty" >&2
exit 1
fi
thispkgname="$(cat ./.pkgname)"
if [ ! -f ./"$thispkgname" ]; then
echo "Error: package does not exists" >&2
exit 1
fi
set -e
set -x
rm -r -f ./work/repo
rm -r -f /tmp/repo
backtome="$(realpath .)"
install -d -m 755 ./work/repo
install -d -m 755 /tmp/repo
cp -a ./"$thispkgname" ./work/repo/
pushd ./work/repo
repo-add asshole.db.tar *
cp -a * /tmp/repo/
popd
echo "Done."
# vim: set ft=sh ts=4 sw=4 et: