mirror of
https://codeberg.org/hyperreal/vauxite-build
synced 2024-11-25 12:23:42 +01:00
Remove static delta generation
This commit is contained in:
parent
c412151c15
commit
647ef7435c
32
README.md
32
README.md
@ -1,32 +0,0 @@
|
|||||||
# Vauxite
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
Clone this repo into the home directory:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
git clone https://git.sr.ht/~hyperreal/vauxite.git
|
|
||||||
```
|
|
||||||
|
|
||||||
Ensure ostree and rpm-ostree are installed:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
sudo dnf install -y ostree rpm-ostree
|
|
||||||
```
|
|
||||||
|
|
||||||
Run the `ostree-engine` script:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
~/vauxite/ostree-engine --sourcebranch f39 --treefile vauxite.yaml --ostreebranch vauxite/f39/x86_64/main --destrepo /srv/repo
|
|
||||||
```
|
|
||||||
|
|
||||||
You can put the above command into a shell script to be run regularly by cron. I put mine in `/etc/cron.weekly`.
|
|
||||||
|
|
||||||
`/srv/repo` is assumed to be the document root of a web server.
|
|
||||||
|
|
||||||
### Rebase
|
|
||||||
|
|
||||||
```shell
|
|
||||||
sudo ostree remote add --no-gpg-verify vauxite <URL of your web server>
|
|
||||||
rpm-ostree rebase vauxite:vauxite/f39/x86_64/main
|
|
||||||
```
|
|
30
README.org
Normal file
30
README.org
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#+title: vauxite-build
|
||||||
|
|
||||||
|
This is my personalized Vauxite configuration. Vauxite is an unofficial Xfce variant of ostree-based Fedora. I'm currently working with Fedora developers to make it an official variant. There is already a sort-of-official treefile for Vauxite at https://pagure.io/workstation-ostree-config, as well as an experimental Vauxite container image hosted at https://quay.io/repository/fedora-ostree-desktops/vauxite.
|
||||||
|
|
||||||
|
The ~vauxite.json~ treefile and ~xfce-desktop-pkgs.yaml~ under the ~src~ directory contain my personal customizations and differ from the [[https://pagure.io/workstation-ostree-config][upstream ones]]. As such, they may not be suitable for everyone.
|
||||||
|
|
||||||
|
** How I use this repository
|
||||||
|
- I run Fedora Server in a VM on my homelab machine. This Fedora Server has the ~ostree~ and ~rpm-ostree~ commands installed.
|
||||||
|
- I clone this repository as root under ~/var/local/vauxite-build~.
|
||||||
|
- I then run the ~ostree-engine~ script to build and deploy a new commit for the given reference branch (e.g. ~vauxite/f39/x86_64/main~). The ~rsync-repos~ command is used in the ~ostree-engine~ script to deploy the resulting OSTree repository to a web server root, which serves as the remote repository.
|
||||||
|
|
||||||
|
To add the repository as a remote on my local client machine:
|
||||||
|
#+begin_src shell
|
||||||
|
sudo ostree remote add --no-gpg-verify vauxite <URL of web server>
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
I then rebase to the vauxite branch:
|
||||||
|
#+begin_src shell
|
||||||
|
rpm-ostree rebase vauxite:vauxite/f39/x86_64/main
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
To build new commits that contain updates, I put this in ~/etc/cron.d/ostree-engine~ on the Fedora Server:
|
||||||
|
#+begin_src shell
|
||||||
|
0 0 * * 2 root /var/local/vauxite-build/ostree-engine
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
This will run the ~ostree-engine~ script every Tuesday at midnight. Then I can update my local client machine like this:
|
||||||
|
#+begin_src shell
|
||||||
|
rpm-ostree update
|
||||||
|
#+end_src
|
@ -16,7 +16,7 @@ TREEFILE="${TMP_WORK_DIR}/vauxite.json"
|
|||||||
|
|
||||||
if [ "$(id -u)" != "0" ]; then
|
if [ "$(id -u)" != "0" ]; then
|
||||||
gum log --time datetime --level error "Please run build with sudo"
|
gum log --time datetime --level error "Please run build with sudo"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function log_struc_info() {
|
function log_struc_info() {
|
||||||
@ -58,26 +58,26 @@ if [ -d "${DEPLOY_REPO}" ] && [ -n "$(ls "${DEPLOY_REPO}")" ]; then
|
|||||||
log_info "Deploy repo found. Initialize ostree repo in bare-user mode."
|
log_info "Deploy repo found. Initialize ostree repo in bare-user mode."
|
||||||
if ! ostree --repo="${BUILD_REPO}" init --mode=bare-user; then
|
if ! ostree --repo="${BUILD_REPO}" init --mode=bare-user; then
|
||||||
log_struc_error "Error initializing ostree repo in bare-user mode" status "$?"
|
log_struc_error "Error initializing ostree repo in bare-user mode" status "$?"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_info "Pull existing deploy repo into local build repo"
|
log_info "Pull existing deploy repo into local build repo"
|
||||||
if ! ostree --repo="${BUILD_REPO}" pull-local --depth=2 "${DEPLOY_REPO}" "${OSTREE_BRANCH}"; then
|
if ! ostree --repo="${BUILD_REPO}" pull-local --depth=2 "${DEPLOY_REPO}" "${OSTREE_BRANCH}"; then
|
||||||
log_struc_error "Error pulling existing deploy repo into local build repo" status "$?"
|
log_struc_error "Error pulling existing deploy repo into local build repo" status "$?"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log_info "Deploy repo not found. Initialize new deploy repo in archive mode."
|
log_info "Deploy repo not found. Initialize new deploy repo in archive mode."
|
||||||
if ! ostree --repo="${BUILD_REPO}" init --mode=archive; then
|
if ! ostree --repo="${BUILD_REPO}" init --mode=archive; then
|
||||||
log_struc_error "Error initializing new deploy repo in archive mode" status "$?"
|
log_struc_error "Error initializing new deploy repo in archive mode" status "$?"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_struc_info "Clone source repo" url "${SOURCE_URL}" branch "${SOURCE_BRANCH}" directory "${SOURCE_REPO}"
|
log_struc_info "Clone source repo" url "${SOURCE_URL}" branch "${SOURCE_BRANCH}" directory "${SOURCE_REPO}"
|
||||||
if ! git clone -b "${SOURCE_BRANCH}" "${SOURCE_URL}" "${SOURCE_REPO}"; then
|
if ! git clone -b "${SOURCE_BRANCH}" "${SOURCE_URL}" "${SOURCE_REPO}"; then
|
||||||
log_struc_error "Error cloning source repo" status "$?"
|
log_struc_error "Error cloning source repo" status "$?"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_struc_info "Copy contents of source repo into temporary work directory" source_repo "${SOURCE_REPO}" directory "${TMP_WORK_DIR}"
|
log_struc_info "Copy contents of source repo into temporary work directory" source_repo "${SOURCE_REPO}" directory "${TMP_WORK_DIR}"
|
||||||
@ -94,20 +94,20 @@ METADATA_STR="$(date '+%Y-%m-%dT%H%M%S')"
|
|||||||
log_struc_info "Compose ostree" cachedir "${CACHE_DIR}" repo "${BUILD_REPO}" metadata-string "${METADATA_STR}" treefile "${TREEFILE}"
|
log_struc_info "Compose ostree" cachedir "${CACHE_DIR}" repo "${BUILD_REPO}" metadata-string "${METADATA_STR}" treefile "${TREEFILE}"
|
||||||
if ! rpm-ostree compose tree --unified-core --cachedir="${CACHE_DIR}" --repo="${BUILD_REPO}" --add-metadata-string=Build="${METADATA_STR}" "${TREEFILE}"; then
|
if ! rpm-ostree compose tree --unified-core --cachedir="${CACHE_DIR}" --repo="${BUILD_REPO}" --add-metadata-string=Build="${METADATA_STR}" "${TREEFILE}"; then
|
||||||
log_struc_error "Error composing ostree" status "$?"
|
log_struc_error "Error composing ostree" status "$?"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prepare deploy
|
# Prepare deploy
|
||||||
log_info "Prune refs older than 30 days"
|
log_info "Prune refs older than 30 days"
|
||||||
if ! ostree --repo="${BUILD_REPO}" prune --refs-only --keep-younger-than='30 days ago'; then
|
if ! ostree --repo="${BUILD_REPO}" prune --refs-only --keep-younger-than='30 days ago'; then
|
||||||
log_struc_error "Error pruning refs" status "$?"
|
log_struc_error "Error pruning refs" status "$?"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_struc_info "Pull new ostree commit into deploy repo" deploy_repo "${DEPLOY_REPO}"
|
log_struc_info "Pull new ostree commit into deploy repo" deploy_repo "${DEPLOY_REPO}"
|
||||||
if ! ostree --repo="${DEPLOY_REPO}" pull-local --depth=1 "${BUILD_REPO}" "${OSTREE_BRANCH}"; then
|
if ! ostree --repo="${DEPLOY_REPO}" pull-local --depth=1 "${BUILD_REPO}" "${OSTREE_BRANCH}"; then
|
||||||
log_struc_error "Error pulling new ostree commit into deploy repo" status "$?"
|
log_struc_error "Error pulling new ostree commit into deploy repo" status "$?"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_struc_info "Remove local build repo" build_repo "${BUILD_REPO}"
|
log_struc_info "Remove local build repo" build_repo "${BUILD_REPO}"
|
||||||
@ -116,42 +116,19 @@ rm -rf "${BUILD_REPO}"
|
|||||||
log_struc_info "Check filesystem for errors" deploy_repo "${DEPLOY_REPO}" ostree_branch "${OSTREE_BRANCH}"
|
log_struc_info "Check filesystem for errors" deploy_repo "${DEPLOY_REPO}" ostree_branch "${OSTREE_BRANCH}"
|
||||||
if ! ostree --repo="${DEPLOY_REPO}" fsck "${OSTREE_BRANCH}"; then
|
if ! ostree --repo="${DEPLOY_REPO}" fsck "${OSTREE_BRANCH}"; then
|
||||||
log_struc_error "Error checking filesystem for errors" status "$?"
|
log_struc_error "Error checking filesystem for errors" status "$?"
|
||||||
exit
|
exit 1
|
||||||
fi
|
|
||||||
|
|
||||||
# Generate deltas
|
|
||||||
log_info "Check if main ref has parent"
|
|
||||||
if ! ostree --repo="${DEPLOY_REPO}" show "${OSTREE_BRANCH}"; then
|
|
||||||
log_info "Main ref has no parent. No deltas will be generated."
|
|
||||||
else
|
|
||||||
log_info "Generate static delta from main ref's parent"
|
|
||||||
if ! ostree --repo="${DEPLOY_REPO}" static-delta generate "${OSTREE_BRANCH}"; then
|
|
||||||
log_struc_error "Error generating static delta from main ref's parent" status "$?"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
log_info "Check if main ref has grandparent"
|
|
||||||
if ! ostree --repo="${DEPLOY_REPO}" show "${OSTREE_BRANCH}"^^; then
|
|
||||||
log_info "Main ref has no grandparent. No grand-deltas will be generated."
|
|
||||||
else
|
|
||||||
log_info "Generate static delta from main ref's grandparent"
|
|
||||||
if ! ostree --repo="${DEPLOY_REPO}" static-delta generate --from="${OSTREE_BRANCH}"^^ --to="${OSTREE_BRANCH}"; then
|
|
||||||
log_struc_error "Error generating static delta from main ref's grandparent."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update summary
|
# Update summary
|
||||||
log_struc_info "Update summary file" deploy_repo "${DEPLOY_REPO}"
|
log_struc_info "Update summary file" deploy_repo "${DEPLOY_REPO}"
|
||||||
if ! ostree --repo="${DEPLOY_REPO}" summary -u; then
|
if ! ostree --repo="${DEPLOY_REPO}" summary -u; then
|
||||||
log_struc_error "Error updating summary" status "$?"
|
log_struc_error "Error updating summary" status "$?"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Deploy
|
# Deploy
|
||||||
log_struc_info "Deploy to web server" deploy_repo "${DEPLOY_REPO}" dest_repo "${DEST_REPO}"
|
log_struc_info "Deploy to web server" deploy_repo "${DEPLOY_REPO}" dest_repo "${DEST_REPO}"
|
||||||
if ! "$(pwd)/rsync-repos" --src "${DEPLOY_REPO}" --dest "${DEST_REPO}"; then
|
if ! "$(pwd)/rsync-repos" --src "${DEPLOY_REPO}" --dest "${DEST_REPO}"; then
|
||||||
log_struc_error "Error deploying to web server" status "$?"
|
log_struc_error "Error deploying to web server" status "$?"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user