add config
This commit is contained in:
parent
d64d93caca
commit
2d8e14d2f8
3 changed files with 18 additions and 26 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@ keys/
|
|||
repo/
|
||||
build/
|
||||
*.list
|
||||
config_test.json
|
||||
|
|
6
config.json
Normal file
6
config.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"remote_user": "",
|
||||
"remote_server": "",
|
||||
"remote_path": "",
|
||||
"ssh_priv_key_path": ""
|
||||
}
|
37
repo-mgmt
37
repo-mgmt
|
@ -4,6 +4,7 @@ readonly PODMAN_IMAGE="noveria:alpine-repo"
|
|||
readonly ROOT_DIR="$(dirname $(readlink -f $(which ${0})))"
|
||||
readonly PODMAN_IMAGE_DIR="${ROOT_DIR}/image"
|
||||
|
||||
readonly CONFIG="/etc/repo-mgmt/config.json"
|
||||
readonly KEYS_DIR="${ROOT_DIR}/keys"
|
||||
readonly REPO_DIR="${ROOT_DIR}/repo"
|
||||
readonly BUILD_DIR="${ROOT_DIR}/build"
|
||||
|
@ -22,30 +23,6 @@ readonly APKBUILD_GIT_REPO_BASE="https://git.noveria.org/APKBUILD"
|
|||
# Miscellaneous functions
|
||||
##
|
||||
|
||||
function usage() {
|
||||
echo -e "Noveria Alpine Linux repository build management
|
||||
|
||||
Usage: $(basename $0) <operations> [...]
|
||||
|
||||
Operations:
|
||||
Miscellaneous:
|
||||
-h, --help Usage information
|
||||
-p, --publish Publish files to webserver (not yet implemented)
|
||||
--debug Start debug-container bash shell
|
||||
--init Initialize local directories & abuild keys
|
||||
|
||||
Podman:
|
||||
-b, --build (Re)build podman image
|
||||
|
||||
DB management:
|
||||
-d, --delete <pkgname> Delete package
|
||||
-r, --refresh Refresh APKINDEX with packages in repo
|
||||
-s, --sign Sign APKINDEX with abuild private key
|
||||
|
||||
Package management:
|
||||
-k, --apkbuild Build binary package from APKBUILD and move to, refresh and sign local repository
|
||||
"
|
||||
}
|
||||
|
||||
function init_local() {
|
||||
if [[ ! -d "${BUILD_DIR}" || ! -d "${REPO_DIR}" || ! -d "${KEYS_DIR}" || ! -f "${PKG_LIST_FILE}" ]]; then
|
||||
|
@ -177,8 +154,16 @@ function delete_pkg_from_repo() {
|
|||
}
|
||||
|
||||
function publish_repo() {
|
||||
message_blue_double_colon "Publishing files to remote webserver"
|
||||
message_error "Not yet implemented"
|
||||
if [[ -z $(jq -r '.remote_user' $CONFIG) || -z $(jq -r '.remote_server' $CONFIG) || -z $(jq -r '.remote_path' $CONFIG) || -z $(jq -r '.ssh_priv_key_path' $CONFIG) ]]; then
|
||||
message_error "Config is incomplete. Please fill out first!"
|
||||
fi
|
||||
local remote_user="$(jq -r '.remote_user' $CONFIG)"
|
||||
local remote_server="$(jq -r '.remote_server' $CONFIG)"
|
||||
local remote_path="$(jq -r '.remote_path' $CONFIG)"
|
||||
local ssh_priv_key_path="$(jq -r '.ssh_priv_key_path' $CONFIG)"
|
||||
|
||||
message_blue_double_colon "Publishing files to remote webserver: ${remote_user}@${remote_server}:${remote_path}/"
|
||||
rsync -a --delete --progress --rsync-path="mkdir -p ${remote_path} && rsync" "${REPO_DIR}/" "${remote_user}@${remote_server}:${remote_path}"
|
||||
}
|
||||
|
||||
##
|
||||
|
|
Loading…
Reference in a new issue