mirror of
https://codeberg.org/wonky/udev-usb-sync.git
synced 2024-09-19 15:30:35 +02:00
fix kernel minor check
This commit is contained in:
parent
1fe2ddca75
commit
e1ec0b47c3
3 changed files with 12 additions and 27 deletions
19
.SRCINFO
19
.SRCINFO
|
@ -1,19 +0,0 @@
|
|||
pkgbase = udev-usb-sync
|
||||
pkgdesc = Fine tune write cache and impose buffer limits when USB storage device is plugged
|
||||
pkgver = 0.9
|
||||
pkgrel = 3
|
||||
url = https://codeberg.org/wonky/udev-usb-sync
|
||||
install = udev-usb-sync.install
|
||||
arch = any
|
||||
license = MIT
|
||||
depends = hdparm
|
||||
depends = bc
|
||||
backup = etc/udev-usb-sync/udev-usb-sync.conf
|
||||
source = 99-usb-sync.rules
|
||||
source = udev-usb-sync
|
||||
source = udev-usb-sync.conf
|
||||
sha256sums = fde345c047bbb3fb51cb2a66b6106a883a413638b760e0e8087c692a30f87514
|
||||
sha256sums = bdc35135e6f8074890a911a501ca4fb3e6a7888963b51c3a1edb98c23bb62ec2
|
||||
sha256sums = ec26baede73e94f9cfab77cd5aa6e0ffebcc413ff657a4e98eae6c9e2145655e
|
||||
|
||||
pkgname = udev-usb-sync
|
4
PKGBUILD
4
PKGBUILD
|
@ -1,6 +1,6 @@
|
|||
# Maintainer: root.nix.dk
|
||||
pkgname='udev-usb-sync'
|
||||
pkgver=0.10
|
||||
pkgver=0.11
|
||||
pkgrel=1
|
||||
pkgdesc='Fine tune write cache and impose buffer limits when USB storage device is plugged'
|
||||
arch=('any')
|
||||
|
@ -11,7 +11,7 @@ backup=("etc/${pkgname}/${pkgname}.conf")
|
|||
install="${pkgname}.install"
|
||||
source=('99-usb-sync.rules' 'udev-usb-sync' 'udev-usb-sync.conf')
|
||||
sha256sums=('fde345c047bbb3fb51cb2a66b6106a883a413638b760e0e8087c692a30f87514'
|
||||
'bdc35135e6f8074890a911a501ca4fb3e6a7888963b51c3a1edb98c23bb62ec2'
|
||||
'49f7c0617c986c52d009ea76afb22af2c57d6655b285ddc0aea81fb2ba4c44a0'
|
||||
'ec26baede73e94f9cfab77cd5aa6e0ffebcc413ff657a4e98eae6c9e2145655e')
|
||||
|
||||
package() {
|
||||
|
|
|
@ -47,16 +47,20 @@ KERNEL_MINOR_VERSION=$(uname -r | awk -F'.' '{print $2}')
|
|||
# disable write cache for device if possible
|
||||
[[ -n $(which hdparm) ]] && $(which hdparm) -W 0 /dev/$BLOCKDEVICE > /dev/null
|
||||
|
||||
if [[ $KERNEL_MAJOR_VERSION -le 6 ]]; then
|
||||
# the following rules is introduced with kernel 2.6
|
||||
# https://docs.kernel.org/admin-guide/abi-testing.html#abi-sys-class-bdi-bdi-max-ratio
|
||||
# 1% of available RAM -> 8046522kB -> 80.465kB -> 80MB
|
||||
echo 1 > /sys/block/$BLOCKDEVICE/bdi/max_ratio
|
||||
if [[ $KERNEL_MAJOR_VERSION -le 5 ]]; then
|
||||
# the following rules is introduced with kernel 2.6
|
||||
# https://docs.kernel.org/admin-guide/abi-testing.html#abi-sys-class-bdi-bdi-max-ratio
|
||||
# 1% of available RAM -> 8046522kB -> 80.465kB -> 80MB
|
||||
echo 1 > /sys/block/$BLOCKDEVICE/bdi/max_ratio
|
||||
|
||||
elif [[ $KERNEL_MAJOR_VERSION -ge 6 ]] && [[ $KERNEL_MINOR_VERSION -le 2 ]]; then
|
||||
# 1% of available RAM -> 8046522kB -> 80.465kB -> 80MB
|
||||
echo 1 > /sys/block/$BLOCKDEVICE/bdi/max_ratio
|
||||
|
||||
elif [[ $KERNEL_MAJOR_VERSION -ge 6 ]] && [[ $KERNEL_MINOR_VERSION -ge 2 ]]; then
|
||||
# the following rules is introduced with kernel 6.2
|
||||
# https://docs.kernel.org/admin-guide/abi-testing.html#abi-sys-class-bdi-bdi-strict-limit
|
||||
# https://docs.kernel.org/admin-guide/abi-testing.html#abi-sys-class-bdi-bdi-max-bytes
|
||||
|
||||
# Turning strictlimit on has no visible effect if max_ratio is equal to 100%.
|
||||
echo 50 > /sys/block/$BLOCKDEVICE/bdi/max_ratio
|
||||
# apply strict limit
|
||||
|
|
Loading…
Reference in a new issue