diff --git a/package/fuse/package b/package/fuse/package new file mode 100755 index 000000000..ca9a183fe --- /dev/null +++ b/package/fuse/package @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +# Copyright (c) 2020 The Toltec Contributors +# SPDX-License-Identifier: MIT + +archs=(rm1 rm2) +pkgnames=(fuse) +pkgdesc="FUSE (Filesystem in Userspace) Kernel Module" +url=https://github.com/libfuse/libfuse +pkgver=1.0.0-1 +timestamp=2021-04-06T22:16Z +section=utils +maintainer="plan5 <30434574+plan5@users.noreply.github.com>" +license=GPL-2.0-only +makedepends=(build:bc build:lzop build:git) +flags=(nostrip) + +_kernelrepo=https://github.com/remarkable/linux +_kernelrev=1774e2a6a091fdc081324e966d3db0aa9df75c0b +_defconfig=arch/arm/configs/zero-gravitas_defconfig + +image=base:v1.3.2 + +build() { + mkdir pkg + git init linux + ( + cd linux + git fetch --depth=1 "$_kernelrepo" "$_kernelrev" + git checkout -f "$_kernelrev" + make mrproper + touch .scmversion + cp "$_defconfig" .config + echo "CONFIG_FUSE_FS=m" >> .config + make olddefconfig + make fs/fuse/fuse.ko + make modules_prepare + ) + + KERNELRELEASE=$(cat linux/include/config/kernel.release) + export MOD_INSTALL_PATH="pkg/$KERNELRELEASE" + install -D -m 644 linux/fs/fuse/fuse.ko \ + "$MOD_INSTALL_PATH/kernel/fs/fuse/fuse.ko" +} + +package() { + if [[ $arch = rm1 ]]; then + mkdir -p "$pkgdir/lib/modules" + cp -r "$srcdir/pkg"/* "$pkgdir/lib/modules" + fi +} + +configure() { + if [[ $arch = rm1 ]]; then + depmod -a + fi +} + +postremove() { + if [[ $arch = rm1 ]]; then + echo 'Fuse (Kernel Module) has been removed.' + echo 'The kernel module will remain loaded until you reboot, or you can attempt' + echo 'to manually remove it by running "modprobe -r fuse".' + depmod -a + fi +} + +postupgrade() { + if [[ $arch = rm1 ]]; then + echo 'Fuse (Kernel Module) has been upgraded.' + echo 'The old kernel module will remain loaded until you reboot, or you can' + echo 'attempt to manually remove it by running "modprobe -r fuse".' + fi +}