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() {
|
||||
mountpoint=$(stat -c '%m' $1)
|
||||
findmnt ${mountpoint} --noheadings --output OPTIONS | grep -q -E "\bro\b"
|
||||
if [ "$(get_system)" = "OpenBSD" ]; then
|
||||
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() {
|
||||
mountpoint=$(stat -c '%m' $1)
|
||||
mount -o remount,rw ${mountpoint}
|
||||
if [ "$(get_system)" = "OpenBSD" ]; then
|
||||
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() {
|
||||
mountpoint=$(stat -c '%m' $1)
|
||||
mount -o remount,ro ${mountpoint} 2>/dev/null
|
||||
if [ "$(get_system)" = "OpenBSD" ]; then
|
||||
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() {
|
||||
|
|
Loading…
Reference in New Issue