summaryrefslogtreecommitdiff
path: root/db-init
blob: bb332ab24a6fcce2e6349ce0bcf6b860db9115df (plain)
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
#!/bin/bash
# Creates the repo structure defined in config

source "$(dirname "$(readlink -e "$0")")/config"

umask 002

mkdir -pv -- "${FTP_BASE}"/{"${PKGPOOL}","${SRCPOOL}"} "${CLEANUP_DESTDIR}" "${SOURCE_CLEANUP_DESTDIR}"

for repo in "${PKGREPOS[@]}"; do
	for arch in "${ARCHES[@]}"; do
		mkdir -pv -- "${FTP_BASE}/${repo}/os/${arch}"
		if ! [[ -f "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" ]]; then
			touch -- "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}"
			printf 'created file %q\n' "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}"
		fi
		if ! [[ -f "${FTP_BASE}/${repo}/os/${arch}/${repo}${FILESEXT}" ]]; then
			touch -- "${FTP_BASE}/${repo}/os/${arch}/${repo}${FILESEXT}"
			printf 'created file %q\n' "${FTP_BASE}/${repo}/os/${arch}/${repo}${FILESEXT}"
		fi
		if ! [[ -L "${FTP_BASE}/${repo}/os/${arch}/${repo}.db" ]]; then
			ln -svT -- "${repo}${DBEXT}" "${FTP_BASE}/${repo}/os/${arch}/${repo}.db"
		fi
		if ! [[ -L "${FTP_BASE}/${repo}/os/${arch}/${repo}.files" ]]; then
			ln -svT -- "${repo}${FILESEXT}" "${FTP_BASE}/${repo}/os/${arch}/${repo}.files"
		fi
	done
done