Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
e4356fe29d | |||
0bcf1973fa | |||
70a82fc0b0 | |||
467542e3a1 | |||
2d8e14d2f8 |
3 changed files with 20 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@ keys/
|
||||||
repo/
|
repo/
|
||||||
build/
|
build/
|
||||||
*.list
|
*.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": ""
|
||||||
|
}
|
16
repo-mgmt
16
repo-mgmt
|
@ -4,6 +4,7 @@ readonly PODMAN_IMAGE="noveria:alpine-repo"
|
||||||
readonly ROOT_DIR="$(dirname $(readlink -f $(which ${0})))"
|
readonly ROOT_DIR="$(dirname $(readlink -f $(which ${0})))"
|
||||||
readonly PODMAN_IMAGE_DIR="${ROOT_DIR}/image"
|
readonly PODMAN_IMAGE_DIR="${ROOT_DIR}/image"
|
||||||
|
|
||||||
|
readonly CONFIG="/etc/repo-mgmt/config.json"
|
||||||
readonly KEYS_DIR="${ROOT_DIR}/keys"
|
readonly KEYS_DIR="${ROOT_DIR}/keys"
|
||||||
readonly REPO_DIR="${ROOT_DIR}/repo"
|
readonly REPO_DIR="${ROOT_DIR}/repo"
|
||||||
readonly BUILD_DIR="${ROOT_DIR}/build"
|
readonly BUILD_DIR="${ROOT_DIR}/build"
|
||||||
|
@ -177,8 +178,16 @@ function delete_pkg_from_repo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function publish_repo() {
|
function publish_repo() {
|
||||||
message_blue_double_colon "Publishing files to remote webserver"
|
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 "Not yet implemented"
|
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 -e "ssh -i ${ssh_priv_key_path}" --progress --rsync-path="mkdir -p ${remote_path} && rsync" "${REPO_DIR}/" "${remote_user}@${remote_server}:${remote_path}"
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -220,7 +229,8 @@ function build_pkgs() {
|
||||||
container_run "sudo apk update && sudo apk upgrade && cd /build/$pkg && abuild checksum && abuild -r && find /home/apkbuild/packages/build -name $1*.apk -exec mv {} /build/$1 \;"
|
container_run "sudo apk update && sudo apk upgrade && cd /build/$pkg && abuild checksum && abuild -r && find /home/apkbuild/packages/build -name $1*.apk -exec mv {} /build/$1 \;"
|
||||||
message_blue_single_arrow "Copying package to repo"
|
message_blue_single_arrow "Copying package to repo"
|
||||||
local VERSION_ID=$(container_run "grep VERSION_ID= /etc/os-release")
|
local VERSION_ID=$(container_run "grep VERSION_ID= /etc/os-release")
|
||||||
rsync -a --delete-before --progress "${BUILD_DIR}/$pkg"/*.apk "${REPO_DIR}/v$(echo $VERSION_ID | cut -d= -f2 | rev | cut -d. -f2- | rev)/noveria/x86_64"
|
find $REPO_DIR/v$(echo $VERSION_ID | cut -d= -f2 | rev | cut -d. -f2- | rev)/noveria/x86_64 -name $1*.apk -exec rm -f {} \;
|
||||||
|
rsync -a --delete --progress "${BUILD_DIR}/$pkg"/*.apk "${REPO_DIR}/v$(echo $VERSION_ID | cut -d= -f2 | rev | cut -d. -f2- | rev)/noveria/x86_64"
|
||||||
rm -f "${BUILD_DIR}/$pkg"/*.apk
|
rm -f "${BUILD_DIR}/$pkg"/*.apk
|
||||||
refresh_repo
|
refresh_repo
|
||||||
sign_repo
|
sign_repo
|
||||||
|
|
Loading…
Reference in a new issue