Make evocommit fully compatible with OpenBSD
continuous-integration/drone/push Build was killed Details

This commit is contained in:
Jérémy Dubois 2022-04-07 10:18:08 +02:00
parent e71201ab46
commit 5b2fecb49c
2 changed files with 11 additions and 4 deletions

View File

@ -35,6 +35,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
* redis: Remount /usr with RW before adding nagios plugin
* postfix: Do not send mails through milters a second time after amavis (in packmail)
* etc-git : Remount /usr in rw for git gc in in /usr/share/scripts/
* etc-git: Make evocommit fully compatible with OpenBSD
### Removed

View File

@ -2,7 +2,7 @@
set -u
VERSION="21.10"
VERSION="22.04"
show_version() {
cat <<END
@ -63,6 +63,7 @@ remount_repository_readwrite() {
if [ "$(get_system)" = "OpenBSD" ]; then
partition=$(stat -f '%Sd' $1)
mount -u -w /dev/${partition} 2>/dev/null
syslog "Re-mount ${mountpoint} as read-write to commit in repository $1"
else
mountpoint=$(stat -c '%m' $1)
mount -o remount,rw ${mountpoint}
@ -73,6 +74,7 @@ remount_repository_readonly() {
if [ "$(get_system)" = "OpenBSD" ]; then
partition=$(stat -f '%Sd' $1)
mount -u -r /dev/${partition} 2>/dev/null
syslog "Re-mount ${mountpoint} as read-only after commit to repository $1"
else
mountpoint=$(stat -c '%m' $1)
mount -o remount,ro ${mountpoint} 2>/dev/null
@ -92,8 +94,12 @@ main() {
rc=0
lock="${GIT_DIR}/index.lock"
if [ -f "${lock}" ]; then
limit=$(date +"%s" -d "now - 1 hour")
updated_at=$(stat -c "%Y" "${lock}")
limit=$(($(date +"%s") - (1 * 60 * 60)))
if [ "$(get_system)" = "OpenBSD" ]; then
updated_at=$(stat -f "%m" "${lock}")
else
updated_at=$(stat -c "%Y" "${lock}")
fi
if [ "$updated_at" -lt "$limit" ]; then
rm -f "${lock}"
fi
@ -262,4 +268,4 @@ if [ -d "${GIT_DIR}" ]; then
else
echo "There is no Git repository in '${REPOSITORY}'" >&2
exit 1
fi
fi