summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2018-06-22 13:22:49 -0400
committerLuke Shumaker <lukeshu@parabola.nu>2018-10-07 19:40:06 -0400
commit982bc5c0e3a8f0ad5a513ace1ea8ddfb55b6a63d (patch)
tree31d7a7dad8f9cf5fcde390cbaf5e07ac50f26342
parentc3a616f64fb29804695440811489e547e1f56506 (diff)
Add from Parabola: db-init
If you're seeing this in `git blame`, it chose to follow the wrong ancestor of a merge commit.
-rw-r--r--README.md2
-rwxr-xr-xdb-init28
2 files changed, 30 insertions, 0 deletions
diff --git a/README.md b/README.md
index 4167c9e..3235c02 100644
--- a/README.md
+++ b/README.md
@@ -23,6 +23,7 @@ The executables that you (might) care about are:
├── db-import-any [Parabola only]
├── db-import-pkg [Parabola only]
├── db-import-keyring [Parabola only]
+ ├── db-init [Parabola only]
├── db-move
├── db-remove
├── db-repo-add
@@ -89,6 +90,7 @@ Things that haven't been mentioned yet:
- `cron-jobs/devlist-mailer`
- `cron-jobs/make_repo_torrents`
- `cron-jobs/sourceballs`
+ - `db-init`
## Testing
* Install the `base-devel` package group, as well as the `bash-bats`, `kcov`, `librelib`, and `subversion` packages.
* The test suite can now be run with `make test`.
diff --git a/db-init b/db-init
new file mode 100755
index 0000000..bb332ab
--- /dev/null
+++ b/db-init
@@ -0,0 +1,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