Introduce an OS condition to handle OpenBSD
Amended functions are the following: is_repository_readonly() remount_repository_readwrite() remount_repository_readonly()
This commit is contained in:
parent
63c83ae1ee
commit
bf6cf1bf00
|
@ -169,16 +169,31 @@ print_session_data() {
|
||||||
}
|
}
|
||||||
|
|
||||||
is_repository_readonly() {
|
is_repository_readonly() {
|
||||||
mountpoint=$(stat -c '%m' $1)
|
if [ "$(get_system)" = "OpenBSD" ]; then
|
||||||
findmnt ${mountpoint} --noheadings --output OPTIONS | grep -q -E "\bro\b"
|
partition=$(stat -f '%Sd' $1)
|
||||||
|
mount | grep ${partition} | grep -q "read-only"
|
||||||
|
else
|
||||||
|
mountpoint=$(stat -c '%m' $1)
|
||||||
|
findmnt ${mountpoint} --noheadings --output OPTIONS | grep -q -E "\bro\b"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
remount_repository_readwrite() {
|
remount_repository_readwrite() {
|
||||||
mountpoint=$(stat -c '%m' $1)
|
if [ "$(get_system)" = "OpenBSD" ]; then
|
||||||
mount -o remount,rw ${mountpoint}
|
partition=$(stat -f '%Sd' $1)
|
||||||
|
mount -u -w /dev/${partition} 2>/dev/null
|
||||||
|
else
|
||||||
|
mountpoint=$(stat -c '%m' $1)
|
||||||
|
mount -o remount,rw ${mountpoint}
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
remount_repository_readonly() {
|
remount_repository_readonly() {
|
||||||
mountpoint=$(stat -c '%m' $1)
|
if [ "$(get_system)" = "OpenBSD" ]; then
|
||||||
mount -o remount,ro ${mountpoint} 2>/dev/null
|
partition=$(stat -f '%Sd' $1)
|
||||||
|
mount -u -r /dev/${partition} 2>/dev/null
|
||||||
|
else
|
||||||
|
mountpoint=$(stat -c '%m' $1)
|
||||||
|
mount -o remount,ro ${mountpoint} 2>/dev/null
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
hook_commit() {
|
hook_commit() {
|
||||||
|
|
Loading…
Reference in a new issue