Commit 4575b9e8 authored by Janek Bevendorff's avatar Janek Bevendorff

Automatically pull and commit changes

parent 14f4fcba
......@@ -63,6 +63,30 @@ cleanup() {
rmdir "$1"
}
# Usage: update_repository BASE_DIR
pull_repository() {
if [ ! -d "${1}/.git" ]; then
logError "CryFS directory is not a Git repository!"
exit 1
fi
logInfo "Updating Git repository..."
if ! (cd "$1" && git pull); then
logError "Git update failed!"
exit 1
fi
}
# Usage: commit_changes BASE_DIR
commit_changes() {
logInfo "Committing changes to Git..."
if ! (cd "$1" && git add -A && git commit -m "-"); then
logError "Committing changes failed!"
fi
logInfo "Changes committed. Please push the repository now (git push)."
}
# Usage: mount_cryfs BASE_DIR MOUNT_DIR
mount_cryfs() {
if [ ! -d "$1" ]; then
......@@ -242,6 +266,8 @@ issue() {
exit 1;
fi
pull_repository "${FLAGS_cryfs_dir}"
MOUNT_DIR="${FLAGS_cryfs_dir}_mount.${RANDOM}"
mount_cryfs "$FLAGS_cryfs_dir" "$MOUNT_DIR"
......@@ -320,6 +346,7 @@ issue() {
generate_crl "$CONF" "$CRL" "$ROOT_KEY" "$ROOT_CERT"
cleanup "$MOUNT_DIR"
commit_changes "${FLAGS_cryfs_dir}"
}
......@@ -341,6 +368,8 @@ revoke() {
exit 1;
fi
pull_repository "${FLAGS_cryfs_dir}"
MOUNT_DIR="${FLAGS_cryfs_dir}_mount.${RANDOM}"
mount_cryfs "$FLAGS_cryfs_dir" "$MOUNT_DIR"
......@@ -377,6 +406,7 @@ revoke() {
generate_crl "$CONF" "$CRL" "$ROOT_KEY" "$ROOT_CERT"
cleanup "$MOUNT_DIR"
commit_changes "${FLAGS_cryfs_dir}"
}
# ===========================================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment