fix: add createrepo.sh
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Markus Pesch 2022-05-03 12:34:29 +02:00
parent c1d6c38223
commit 903be7c5ad
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
2 changed files with 46 additions and 3 deletions

View File

@ -4,6 +4,33 @@
[![Docker Pulls](https://img.shields.io/docker/pulls/volkerraschek/createrepo)](https://hub.docker.com/r/volkerraschek/createrepo)
This project contains all sources to build the container image
`docker.io/volkerraschek/createrepo`. The primary goal of this project is to package
the binary `createrepo` as container image to provide the functionally for CI/CD
workflows or for systems which does contains the binary.
`docker.io/volkerraschek/createrepo` and the shell script `createrepo.sh`.
The primary goal of this project is to package the binary `createrepo` as
container image to provide the functionally for CI/CD workflows or for systems
which does contains the binary.
## createrepo.sh
The shell script `createrepo.sh` is a wrapper for the binary `createrepo`, which
is not available depending on the distribution. It starts the container image
`docker.io/volkerraschek/createrepo` in the background to call the binary. For
this reason, a container runtime like `docker` or `podman` is necessary.
### Installation
The script can be installed via the following command:
```bash
curl https://git.cryptic.systems/volker.raschek/createrepo-docker/raw/branch/master/createrepo.sh --output - | sudo tee /usr/local/bin/createrepo.sh && sudo chmod +x /usr/local/bin/createrepo.sh
```
### Usage
The script forwards all arguments directly to the binary running inside the
container. For this reason, all arguments from the original binary can be used.
```bash
createrepo.sh --update . # Update local repository
createrepo.sh --update /var/www/my-repo # Update repository based on specific path
```

16
createrepo.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
set -e
CONTAINER_RUNTIME=$(which docker)
CREATEREPO_IMAGE_VERSION=0.17.2
CUSTOM_UID=$(getent passwd ${USER} | cut -d ':' -f 3)
CUSTOM_GID=$(getent passwd ${USER} | cut -d ':' -f 4)
${CONTAINER_RUNTIME} run \
--rm \
--volume ${PWD}:${PWD} \
--workdir ${PWD} \
--user ${CUSTOM_UID}:${CUSTOM_GID} \
docker.io/volkerraschek/createrepo:${CREATEREPO_IMAGE_VERSION} ${@}