Browse Source

Add fedora packages

Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
Dorian Stoll 5 years ago
parent
commit
361a970eda

+ 2 - 0
pkg/fedora/.gitignore

@@ -0,0 +1,2 @@
+.build/
+out/

+ 1 - 0
pkg/fedora/kernel-surface/.gitignore

@@ -0,0 +1 @@
+surface.key

+ 87 - 0
pkg/fedora/kernel-surface/0001-Add-secureboot-pre-signing-to-the-kernel.patch

@@ -0,0 +1,87 @@
+From 4d40b8001ac67866e49659211163ebcc0b17dd73 Mon Sep 17 00:00:00 2001
+From: Dorian Stoll <dorian.stoll@tmsp.io>
+Date: Sun, 22 Sep 2019 22:44:16 +0200
+Subject: [PATCH] Add secureboot pre-signing to the kernel
+
+If it detects a secure boot certificate at `keys/MOK.key` and `keys/MOK.cer`,
+the kernel Makefile will automatically sign the vmlinux / bzImage file that
+gets generated, and that is then used in packaging.
+
+By integrating it into the kernel build system directly, it is fully integrated
+with targets like `make deb-pkg` (opposed to `make all`, sign, `make bindeb-pkg`)
+and it gets added to every tree by the same mechanism that is used to apply the
+other surface patches anyways.
+
+Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
+---
+ .gitignore             |  3 +++
+ arch/x86/Makefile      |  1 +
+ scripts/sign_kernel.sh | 30 ++++++++++++++++++++++++++++++
+ 3 files changed, 34 insertions(+)
+ create mode 100755 scripts/sign_kernel.sh
+
+diff --git a/.gitignore b/.gitignore
+index 2030c7a4d2f8..f0705ecd9340 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -132,6 +132,9 @@ signing_key.priv
+ signing_key.x509
+ x509.genkey
+ 
++# Secureboot certificate
++/keys/
++
+ # Kconfig presets
+ /all.config
+ /alldef.config
+diff --git a/arch/x86/Makefile b/arch/x86/Makefile
+index 94df0868804b..2c7b7829f0c2 100644
+--- a/arch/x86/Makefile
++++ b/arch/x86/Makefile
+@@ -284,6 +284,7 @@ endif
+ 	$(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE)
+ 	$(Q)mkdir -p $(objtree)/arch/$(UTS_MACHINE)/boot
+ 	$(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/$(UTS_MACHINE)/boot/$@
++	$(Q)$(srctree)/scripts/sign_kernel.sh $(objtree)/arch/$(UTS_MACHINE)/boot/$@
+ 
+ $(BOOT_TARGETS): vmlinux
+ 	$(Q)$(MAKE) $(build)=$(boot) $@
+diff --git a/scripts/sign_kernel.sh b/scripts/sign_kernel.sh
+new file mode 100755
+index 000000000000..d2526a279254
+--- /dev/null
++++ b/scripts/sign_kernel.sh
+@@ -0,0 +1,30 @@
++#!/bin/sh
++# SPDX-License-Identifier: GPL-2.0
++
++# The path to the compiled kernel image is passed as the first argument
++BUILDDIR=$(dirname $(dirname $0))
++VMLINUX=$1
++
++# Keys are stored in a toplevel directory called keys
++# The following files need to be there:
++#     * MOK.priv  (private key)
++#     * MOK.pem   (public key)
++#
++# If the files don't exist, this script will do nothing.
++if [ ! -f "$BUILDDIR/keys/MOK.key" ]; then
++    exit 0
++fi
++if [ ! -f "$BUILDDIR/keys/MOK.crt" ]; then
++    exit 0
++fi
++
++# Both required certificates were found. Check if sbsign is installed.
++echo "Keys for automatic secureboot signing found."
++if [ ! -x "$(command -v sbsign)" ]; then
++    echo "ERROR: sbsign not found!"
++    exit -2
++fi
++
++# Sign the kernel
++sbsign --key $BUILDDIR/keys/MOK.key --cert $BUILDDIR/keys/MOK.crt \
++    --output $VMLINUX $VMLINUX
+-- 
+2.23.0
+

+ 57 - 0
pkg/fedora/kernel-surface/0002-drm-i915-Mark-contents-as-dirty-on-a-write-fault.patch

@@ -0,0 +1,57 @@
+From 4a362c03025050f830f3afb107ec62d44f0299b0 Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris@chris-wilson.co.uk>
+Date: Fri, 20 Sep 2019 13:18:21 +0100
+Subject: [PATCH] drm/i915: Mark contents as dirty on a write fault
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+commit b925708f28c2b7a3a362d709bd7f77bc75c1daac upstream.
+
+Since dropping the set-to-gtt-domain in commit a679f58d0510 ("drm/i915:
+Flush pages on acquisition"), we no longer mark the contents as dirty on
+a write fault. This has the issue of us then not marking the pages as
+dirty on releasing the buffer, which means the contents are not written
+out to the swap device (should we ever pick that buffer as a victim).
+Notably, this is visible in the dumb buffer interface used for cursors.
+Having updated the cursor contents via mmap, and swapped away, if the
+shrinker should evict the old cursor, upon next reuse, the cursor would
+be invisible.
+
+E.g. echo 80 > /proc/sys/kernel/sysrq ; echo f > /proc/sysrq-trigger
+
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111541
+Fixes: a679f58d0510 ("drm/i915: Flush pages on acquisition")
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Cc: Matthew Auld <matthew.william.auld@gmail.com>
+Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
+Cc: <stable@vger.kernel.org> # v5.2+
+Reviewed-by: Matthew Auld <matthew.william.auld@gmail.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20190920121821.7223-1-chris@chris-wilson.co.uk
+(cherry picked from commit 5028851cdfdf78dc22eacbc44a0ab0b3f599ee4a)
+Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/i915_legacy/i915_gem.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/i915_legacy/i915_gem.c b/drivers/gpu/drm/i915_legacy/i915_gem.c
+index ad01c92aaf74..3c4e41a837b5 100644
+--- a/drivers/gpu/drm/i915_legacy/i915_gem.c
++++ b/drivers/gpu/drm/i915_legacy/i915_gem.c
+@@ -1908,7 +1908,11 @@ vm_fault_t i915_gem_fault(struct vm_fault *vmf)
+ 		list_add(&obj->userfault_link, &dev_priv->mm.userfault_list);
+ 	GEM_BUG_ON(!obj->userfault_count);
+ 
+-	i915_vma_set_ggtt_write(vma);
++	if (write) {
++		GEM_BUG_ON(!i915_gem_object_has_pinned_pages(obj));
++		i915_vma_set_ggtt_write(vma);
++		obj->mm.dirty = true;
++	}
+ 
+ err_fence:
+ 	i915_vma_unpin_fence(vma);
+-- 
+2.23.0
+

+ 336 - 0
pkg/fedora/kernel-surface/kernel-surface.spec

@@ -0,0 +1,336 @@
+#
+# Definitions to configure the kernel we want to build
+#
+
+%global kernel_tag_fc31 kernel-5.3.18-300.fc31
+%global kernel_tag_fc30 kernel-5.3.18-200.fc30
+
+%global kernel_release_fc31 2
+%global kernel_release_fc30 2
+
+%global fedora_title_fc31 31 (Thirty One)
+%global fedora_title_fc30 30 (Thirty)
+
+%global ls_patches_commit b931b147da670fd9507391d41e56d34953ae687b
+%global ls_configs_commit f3cdfc4fca8f60221d8fea4396b2486bced295b5
+
+%global sb_crt surface.crt
+%global sb_key surface.key
+
+#
+# Definitions that get automatically generated from the ones above
+#
+
+%global fedora_ver %(echo %{?dist} | cut -d'.' -f2)
+
+%global kernel_tag %{kernel_tag_%{fedora_ver}}
+%global kernel_release %{kernel_release_%{fedora_ver}}
+%global fedora_title %{fedora_title_%{fedora_ver}}
+
+%global kernel_version %(echo %{kernel_tag} | cut -d'-' -f2)
+%global kernel_patches %(echo %{kernel_version} | cut -d'.' -f1-2)
+
+%global kernel_localversion %{kernel_release}.surface%{?dist}.%{_target_cpu}
+%global kernel_config kernel-%{kernel_version}-%{_target_cpu}.config
+%global kernel_name %{kernel_version}-%{kernel_localversion}
+
+%global fedora_source https://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git
+%global surface_source https://raw.githubusercontent.com/linux-surface/linux-surface/%{ls_patches_commit}/patches
+%global config_source https://raw.githubusercontent.com/linux-surface/kernel-configs/%{ls_configs_commit}
+
+%global kernel_modpath %{buildroot}/lib/modules/%{kernel_name}
+
+#
+# Actual specfile starts here
+#
+
+Name:       kernel-surface
+Summary:    The Linux Kernel with patches for Microsoft Surface
+Version:    %{kernel_version}
+Release:    %{kernel_release}%{?dist}
+License:    GPLv2
+URL:        https://github.com/linux-surface/linux-surface
+
+Requires(pre): coreutils, systemd >= 203-2, /usr/bin/kernel-install
+Requires(pre): dracut >= 027
+Requires(pre): linux-firmware >= 20150904-56.git6ebf5d57
+Requires(preun): systemd >= 200
+
+BuildRequires: openssl openssl-devel
+BuildRequires: kmod, patch, bash, tar, git-core, sbsigntools
+BuildRequires: bzip2, xz, findutils, gzip, m4, perl-interpreter,
+BuildRequires: perl-Carp, perl-devel, perl-generators, make, diffutils,
+BuildRequires: gawk, gcc, binutils, redhat-rpm-config, hmaccalc, bison
+BuildRequires: flex, net-tools, hostname, bc, elfutils-devel
+
+# Used to mangle unversioned shebangs to be Python 3
+BuildRequires: python3-devel
+
+Conflicts: xfsprogs < 4.3.0-1
+Conflicts: xorg-x11-drv-vmmouse < 13.0.99
+BuildConflicts: rhbuildsys(DiskFree) < 500Mb
+
+Source0:    %{fedora_source}/snapshot/fedora-%{kernel_tag}.tar.gz
+Source1:    %{config_source}/%{kernel_patches}/surface.config
+
+Source2:    %{sb_crt}
+Source3:    %{sb_key}
+
+Source100:  mod-sign.sh
+Source101:  parallel_xz.sh
+
+Patch0:     %{surface_source}/%{kernel_patches}/0001-surface-acpi.patch
+Patch1:     %{surface_source}/%{kernel_patches}/0002-buttons.patch
+Patch2:     %{surface_source}/%{kernel_patches}/0003-hid.patch
+Patch3:     %{surface_source}/%{kernel_patches}/0004-surface3-power.patch
+Patch4:     %{surface_source}/%{kernel_patches}/0005-surface-lte.patch
+Patch5:     %{surface_source}/%{kernel_patches}/0006-wifi.patch
+Patch6:     %{surface_source}/%{kernel_patches}/0007-legacy-i915.patch
+Patch7:     %{surface_source}/%{kernel_patches}/0008-ipts.patch
+Patch8:     %{surface_source}/%{kernel_patches}/0009-ioremap_uc.patch
+Patch9:     %{surface_source}/%{kernel_patches}/0010-surface3-spi-dma.patch
+
+Patch100:   0001-Add-secureboot-pre-signing-to-the-kernel.patch
+Patch101:   0002-drm-i915-Mark-contents-as-dirty-on-a-write-fault.patch
+
+ExclusiveArch: x86_64
+
+%global debug_package %{nil}
+%global _binary_payload w3T.xzdio
+
+%description
+The Linux Kernel, the operating system core itself, with support for
+Microsoft Surface.
+
+%package devel
+Summary: Development package for building kernel modules for kernel-surface
+AutoReqProv: no
+
+%description devel
+This package provides kernel headers and makefiles sufficient to build modules
+against the kernel-surface package.
+
+%prep
+%autosetup -S git -n fedora-%{kernel_tag}
+
+scripts/kconfig/merge_config.sh         \
+	fedora/configs/%{kernel_config} \
+	%{SOURCE1}
+
+echo $((%{kernel_release} - 1)) > .version
+
+# Copy secureboot certificates if they are available
+if [ -f "%{SOURCE2}" ] && [ -f "%{SOURCE3}" ]; then
+	mkdir -p keys
+	cp %{SOURCE2} keys/MOK.crt
+	cp %{SOURCE3} keys/MOK.key
+fi
+
+# This Prevents scripts/setlocalversion from mucking with our version numbers.
+touch .scmversion
+
+# Mangle /usr/bin/python shebangs to /usr/bin/python3
+# Mangle all Python shebangs to be Python 3 explicitly
+# -p preserves timestamps
+# -n prevents creating ~backup files
+# -i specifies the interpreter for the shebang
+# This fixes errors such as
+# *** ERROR: ambiguous python shebang in /usr/bin/kvm_stat: #!/usr/bin/python. Change it to python3 (or python2) explicitly.
+# We patch all sources below for which we got a report/error.
+pathfix.py -i "%{__python3} %{py3_shbang_opts}" -p -n \
+	tools/kvm/kvm_stat/kvm_stat \
+	scripts/show_delta \
+	scripts/diffconfig \
+	scripts/bloat-o-meter \
+	tools/perf/tests/attr.py \
+	tools/perf/scripts/python/stat-cpi.py \
+	tools/perf/scripts/python/sched-migration.py \
+	Documentation \
+	scripts/gen_compile_commands.py
+
+%build
+make %{?_smp_mflags} all LOCALVERSION=-%{kernel_localversion} ARCH=%{_target_cpu}
+
+%define __modsign_install_post \
+  %{SOURCE100} certs/signing_key.pem certs/signing_key.x509 %{kernel_modpath} \
+  find %{kernel_modpath} -type f -name '*.ko' | %{SOURCE101} %{?_smp_mflags}; \
+%{nil}
+
+#
+# Disgusting hack alert! We need to ensure we sign modules *after* all
+# invocations of strip occur.
+#
+%define __spec_install_post \
+  %{?__debug_package:%{__debug_install_post}}\
+  %{__arch_install_post}\
+  %{__os_install_post}\
+  %{__modsign_install_post}
+
+%install
+mkdir -p %{buildroot}/boot
+
+# Install modules
+make %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install KERNELRELEASE=%{kernel_name}
+
+# Install vmlinuz
+image_name=$(make -s image_name)
+install -m 755 $image_name %{buildroot}/boot/vmlinuz-%{kernel_name}
+install -m 755 $image_name %{kernel_modpath}/vmlinuz
+
+# Install System.map and .config
+install -m 644 System.map %{kernel_modpath}/System.map
+install -m 644 System.map %{buildroot}/boot/System.map-%{kernel_name}
+install -m 644 .config %{kernel_modpath}/config
+install -m 644 .config %{buildroot}/boot/config-%{kernel_name}
+
+# hmac sign the kernel for FIPS
+sha512hmac %{buildroot}/boot/vmlinuz-%{kernel_name} | sed -e "s,%{buildroot},," > %{kernel_modpath}/.vmlinuz.hmac
+cp %{kernel_modpath}/.vmlinuz.hmac %{buildroot}/boot/.vmlinuz-%{kernel_name}.hmac
+
+# mark modules executable so that strip-to-file can strip them
+find %{kernel_modpath} -name "*.ko" -type f | xargs --no-run-if-empty chmod u+x
+
+# Setup directories for -devel files
+rm -f %{kernel_modpath}/build
+rm -f %{kernel_modpath}/source
+mkdir -p %{kernel_modpath}/build
+pushd %{kernel_modpath}
+	ln -s build source
+popd
+
+# first copy everything
+cp --parents $(find  -type f -name "Makefile*" -o -name "Kconfig*") %{kernel_modpath}/build
+cp Module.symvers %{kernel_modpath}/build
+cp System.map %{kernel_modpath}/build
+if [ -s Module.markers ]; then
+	cp Module.markers %{kernel_modpath}/build
+fi
+
+# then drop all but the needed Makefiles/Kconfig files
+rm -rf %{kernel_modpath}/build/Documentation
+rm -rf %{kernel_modpath}/build/scripts
+rm -rf %{kernel_modpath}/build/include
+cp .config %{kernel_modpath}/build
+cp -a scripts %{kernel_modpath}/build
+rm -rf %{kernel_modpath}/build/scripts/tracing
+rm -f %{kernel_modpath}/build/scripts/spdxcheck.py
+
+if [ -f tools/objtool/objtool ]; then
+	cp -a tools/objtool/objtool %{kernel_modpath}/build/tools/objtool/ || :
+
+	# these are a few files associated with objtool
+	cp -a --parents tools/build/Build.include %{kernel_modpath}/build/
+	cp -a --parents tools/build/Build %{kernel_modpath}/build/
+	cp -a --parents tools/build/fixdep.c %{kernel_modpath}/build/
+	cp -a --parents tools/scripts/utilities.mak %{kernel_modpath}/build/
+
+	# also more than necessary but it's not that many more files
+	cp -a --parents tools/objtool/* %{kernel_modpath}/build/
+	cp -a --parents tools/lib/str_error_r.c %{kernel_modpath}/build/
+	cp -a --parents tools/lib/string.c %{kernel_modpath}/build/
+	cp -a --parents tools/lib/subcmd/* %{kernel_modpath}/build/
+fi
+
+if [ -d arch/x86/scripts ]; then
+	cp -a arch/x86/scripts %{kernel_modpath}/build/arch/x86/ || :
+fi
+
+if [ -f arch/x86/*lds ]; then
+	cp -a arch/x86/*lds %{kernel_modpath}/build/arch/x86/ || :
+fi
+
+if [ -f arch/x86/kernel/module.lds ]; then
+	cp -a --parents arch/x86/kernel/module.lds %{kernel_modpath}/build/
+fi
+
+rm -f %{kernel_modpath}/build/scripts/*.o
+rm -f %{kernel_modpath}/build/scripts/*/*.o
+
+if [ -d arch/x86/include ]; then
+	cp -a --parents arch/x86/include %{kernel_modpath}/build/
+fi
+
+cp -a include %{kernel_modpath}/build/include
+
+# files for 'make prepare' to succeed with kernel-devel
+cp -a --parents arch/x86/entry/syscalls/syscall_32.tbl %{kernel_modpath}/build/
+cp -a --parents arch/x86/entry/syscalls/syscalltbl.sh %{kernel_modpath}/build/
+cp -a --parents arch/x86/entry/syscalls/syscallhdr.sh %{kernel_modpath}/build/
+cp -a --parents arch/x86/entry/syscalls/syscall_64.tbl %{kernel_modpath}/build/
+cp -a --parents arch/x86/tools/relocs_32.c %{kernel_modpath}/build/
+cp -a --parents arch/x86/tools/relocs_64.c %{kernel_modpath}/build/
+cp -a --parents arch/x86/tools/relocs.c %{kernel_modpath}/build/
+cp -a --parents arch/x86/tools/relocs_common.c %{kernel_modpath}/build/
+cp -a --parents arch/x86/tools/relocs.h %{kernel_modpath}/build/
+
+# Yes this is more includes than we probably need. Feel free to sort out
+# dependencies if you so choose.
+cp -a --parents tools/include/* %{kernel_modpath}/build/
+cp -a --parents arch/x86/purgatory/purgatory.c %{kernel_modpath}/build/
+cp -a --parents arch/x86/purgatory/stack.S %{kernel_modpath}/build/
+cp -a --parents arch/x86/purgatory/setup-x86_64.S %{kernel_modpath}/build/
+cp -a --parents arch/x86/purgatory/entry64.S %{kernel_modpath}/build/
+cp -a --parents arch/x86/boot/string.h %{kernel_modpath}/build/
+cp -a --parents arch/x86/boot/string.c %{kernel_modpath}/build/
+cp -a --parents arch/x86/boot/ctype.h %{kernel_modpath}/build/
+
+# Make sure the Makefile and version.h have a matching timestamp so that
+# external modules can be built
+touch -r %{kernel_modpath}/build/Makefile %{kernel_modpath}/build/include/generated/uapi/linux/version.h
+
+# Copy .config to include/config/auto.conf so "make prepare" is unnecessary.
+cp %{kernel_modpath}/build/.config %{kernel_modpath}/build/include/config/auto.conf
+
+mkdir -p %{buildroot}/usr/src/kernels
+mv %{kernel_modpath}/build %{buildroot}/usr/src/kernels/%{kernel_name}
+
+# This is going to create a broken link during the build, but we don't use
+# it after this point.  We need the link to actually point to something
+# when kernel-devel is installed, and a relative link doesn't work across
+# the F17 UsrMove feature.
+ln -sf /usr/src/kernels/%{kernel_name} %{kernel_modpath}/build
+
+# prune junk from kernel-devel
+find %{buildroot}/usr/src/kernels -name ".*.cmd" -delete
+
+# remove files that will be auto generated by depmod at rpm -i time
+pushd %{kernel_modpath}
+	rm -f modules.{alias*,builtin.bin,dep*,*map,symbols*,devname,softdep}
+popd
+
+# build a BLS config for this kernel
+cat >%{kernel_modpath}/bls.conf <<EOF
+title Fedora (%{kernel_name}) %{fedora_title}
+version %{kernel_name}
+linux /vmlinuz-%{kernel_name}
+initrd /initramfs-%{kernel_name}.img
+options \$kernelopts
+grub_users \$grub_users
+grub_arg --unrestricted
+grub_class kernel
+EOF
+
+%clean
+rm -rf %{buildroot}
+
+%post
+/bin/kernel-install add %{kernel_name} /lib/modules/%{kernel_name}/vmlinuz || exit $?
+
+%preun
+/bin/kernel-install remove %{kernel_name} /lib/modules/%{kernel_name}/vmlinuz || exit $?
+
+%files
+%defattr (-, root, root)
+/lib/modules/%{kernel_name}
+%ghost /boot/vmlinuz-%{kernel_name}
+%ghost /boot/config-%{kernel_name}
+%ghost /boot/System.map-%{kernel_name}
+%ghost /boot/.vmlinuz-%{kernel_name}.hmac
+
+%files devel
+%defattr (-, root, root)
+/usr/src/kernels/%{kernel_name}
+
+%changelog
+* Thu Jan 09 2020 Dorian Stoll <dorian.stoll@tmsp.io>
+- Initial version

+ 36 - 0
pkg/fedora/kernel-surface/mod-sign.sh

@@ -0,0 +1,36 @@
+#! /bin/bash
+
+# The modules_sign target checks for corresponding .o files for every .ko that
+# is signed. This doesn't work for package builds which re-use the same build
+# directory for every flavour, and the .config may change between flavours.
+# So instead of using this script to just sign lib/modules/$KernelVer/extra,
+# sign all .ko in the buildroot.
+
+# This essentially duplicates the 'modules_sign' Kbuild target and runs the
+# same commands for those modules.
+
+MODSECKEY=$1
+MODPUBKEY=$2
+
+moddir=$3
+
+modules=`find $moddir -name *.ko`
+
+for mod in $modules
+do
+    dir=`dirname $mod`
+    file=`basename $mod`
+
+    ./scripts/sign-file sha256 ${MODSECKEY} ${MODPUBKEY} ${dir}/${file}
+    rm -f ${dir}/${file}.{sig,dig}
+done
+
+RANDOMMOD=$(find $moddir -type f -name '*.ko' | sort -R | head -n 1)
+if [ "~Module signature appended~" != "$(tail -c 28 $RANDOMMOD)" ]; then
+    echo "*****************************"
+    echo "*** Modules are unsigned! ***"
+    echo "*****************************"
+    exit 1
+fi
+
+exit 0

+ 26 - 0
pkg/fedora/kernel-surface/parallel_xz.sh

@@ -0,0 +1,26 @@
+#!/bin/sh
+# Reads filenames on stdin, xz-compresses each in place.
+# Not optimal for "compress relatively few, large files" scenario!
+
+# How many xz's to run in parallel:
+procgroup=""
+while test "$#" != 0; do
+	# Get it from -jNUM
+	N="${1#-j}"
+	if test "$N" = "$1"; then
+		# Not -j<something> - warn and ignore
+		echo "parallel_xz: warning: unrecognized argument: '$1'"
+	else
+		procgroup="$N"
+	fi
+	shift
+done
+
+# If told to use only one cpu:
+test "$procgroup" || exec xargs -r xz
+test "$procgroup" = 1 && exec xargs -r xz
+
+# xz has some startup cost. If files are really small,
+# this cost might be significant. To combat this,
+# process several files (in sequence) by each xz process via -n 16:
+exec xargs -r -n 16 -P $procgroup xz

+ 26 - 0
pkg/fedora/kernel-surface/surface.crt

@@ -0,0 +1,26 @@
+-----BEGIN CERTIFICATE-----
+MIIEWTCCA0GgAwIBAgIUXswTRJ9wc3c/U0VZ/zn4gZEQP9AwDQYJKoZIhvcNAQEL
+BQAwgZMxCzAJBgNVBAYTAkRFMRQwEgYDVQQIDAtCcmFuZGVuYnVyZzEQMA4GA1UE
+BwwHUG90c2RhbTEVMBMGA1UECgwMRG9yaWFuIFN0b2xsMSAwHgYDVQQDDBdTZWN1
+cmUgQm9vdCBTaWduaW5nIEtleTEjMCEGCSqGSIb3DQEJARYUZG9yaWFuLnN0b2xs
+QHRtc3AuaW8wIBcNMTkwNDIzMjI0NjM4WhgPMjExOTAzMzAyMjQ2MzhaMIGTMQsw
+CQYDVQQGEwJERTEUMBIGA1UECAwLQnJhbmRlbmJ1cmcxEDAOBgNVBAcMB1BvdHNk
+YW0xFTATBgNVBAoMDERvcmlhbiBTdG9sbDEgMB4GA1UEAwwXU2VjdXJlIEJvb3Qg
+U2lnbmluZyBLZXkxIzAhBgkqhkiG9w0BCQEWFGRvcmlhbi5zdG9sbEB0bXNwLmlv
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv6RzT8ewIgYtLd8YQA56
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22GmlHmIcwFcpVakc88gz+NcZ6Yvl5q3
+ZrB0tV/9hWLCoHC5cmdl9s6vsfZFKCmwm0otBkuUM/hK17AVaNqxCiNHVzh+x+gd
+VHpm/qzAuALH151CN+0U6G/4LtQxU9YUydQ1Xzb6pNuBP8ckA8FFics3QNSrvXvM
+aPFUyOGwx5Vp3d4EMp+YCWVwGnFY5vsUsImJU122eBTCVugB3iz3Vr/4brbSZlft
+Fs4JeJ+Ju9zQLsDYpeD3cVMbzKtxwdv9jHfofkl6muN0j+jBJPef1uzXrff1IGTx
+Y8peLxpFfu32N6EnhZZRRxX5V0p/gud546/nb+uiOYeT/Cms0bAUXTu519TEVoSR
+p6MGjQ9F6KBugy4FfYMOJ4wmMMvxzh0dZj7xDjPD7tPogo/ZOpQkf9QlupmqO//4
+s5Tm9vGSvWREo0lfVtR36v2raIyDjwUz05gkxxvv5A3Spy0KOdEOwMAmFGSIJUWH
+TY4Nme0=
+=XFHW
+-----END PGP MESSAGE-----

+ 29 - 0
pkg/fedora/libwacom-surface/0001-update-meson.patch

@@ -0,0 +1,29 @@
+From 83e9351691f762b82d92a9939ed84798eda3086f Mon Sep 17 00:00:00 2001
+From: Dorian Stoll <dorian.stoll@tmsp.io>
+Date: Fri, 27 Sep 2019 15:34:51 +0200
+Subject: [PATCH] update meson
+
+---
+ meson.build | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/meson.build b/meson.build
+index 28b46ed..9470e95 100644
+--- a/meson.build
++++ b/meson.build
+@@ -306,6 +306,12 @@ data_files = [
+ 	'data/one-by-wacom-s-p.tablet',
+ 	'data/one-by-wacom-s-p2.tablet',
+ 	'data/serial-wacf004.tablet',
++	'data/surface-book.tablet',
++	'data/surface-book2-13.tablet',
++	'data/surface-book2-15.tablet',
++	'data/surface-pro4.tablet',
++	'data/surface-pro5.tablet',
++	'data/surface-pro6.tablet',
+ 	'data/xp-pen-star03.tablet',
+ ]
+ 
+-- 
+2.23.0
+

+ 350 - 0
pkg/fedora/libwacom-surface/libwacom-surface.spec

@@ -0,0 +1,350 @@
+Name:           libwacom-surface
+Version:        1.2
+Release:        1%{?dist}
+Summary:        Tablet Information Client Library
+Requires:       %{name}-data
+Provides:       libwacom
+Conflicts:      libwacom
+
+%global surface_source https://raw.githubusercontent.com/linux-surface/libwacom-surface-patches
+
+License:        MIT
+URL:            https://github.com/linuxwacom/libwacom
+Source:         https://github.com/linuxwacom/libwacom/releases/download/libwacom-%{version}/libwacom-%{version}.tar.bz2
+
+Patch0:         %{surface_source}/v%{version}/0001-Add-support-for-Intel-Management-Engine-bus.patch
+Patch1:         %{surface_source}/v%{version}/0002-data-Add-Microsoft-Surface-Book-2-13.5.patch
+Patch2:         %{surface_source}/v%{version}/0003-data-Add-Microsoft-Surface-Pro-5.patch
+Patch3:         %{surface_source}/v%{version}/0004-data-Add-Microsoft-Surface-Book-2-15.patch
+Patch4:         %{surface_source}/v%{version}/0005-data-Add-Microsoft-Surface-Pro-6.patch
+Patch5:         %{surface_source}/v%{version}/0006-data-Add-Microsoft-Surface-Pro-4.patch
+Patch6:         %{surface_source}/v%{version}/0007-data-Add-Microsoft-Surface-Book.patch
+Patch7:         0001-update-meson.patch
+
+BuildRequires:  meson gcc
+BuildRequires:  glib2-devel libgudev1-devel
+BuildRequires:  systemd systemd-devel
+BuildRequires:  git
+BuildRequires:  libxml2-devel
+
+%global debug_package %{nil}
+
+Requires: %{name}-data = %{version}-%{release}
+
+%description
+%{name} is a library that provides information about Wacom tablets and
+tools. This information can then be used by drivers or applications to tweak
+the UI or general settings to match the physical tablet.
+
+%package devel
+Summary:        Tablet Information Client Library Development Package
+Requires:       %{name} = %{version}-%{release}
+Requires:       pkgconfig
+Provides:       libwacom-devel
+Conflicts:      libwacom-devel
+
+%description devel
+Tablet information client library development package.
+
+%package data
+Summary:        Tablet Information Client Library Data Files
+BuildArch:      noarch
+Provides:       libwacom-data
+Conflicts:      libwacom-data
+
+%description data
+Tablet information client library data files.
+
+%prep
+%autosetup -S git -n libwacom-%{version}
+
+%build
+%meson -Dtests=true -Ddocumentation=disabled
+%meson_build
+
+%install
+%meson_install
+install -d ${RPM_BUILD_ROOT}/%{_udevrulesdir}
+# auto-generate the udev rule from the database entries
+%_vpath_builddir/generate-udev-rules > ${RPM_BUILD_ROOT}/%{_udevrulesdir}/65-libwacom.rules
+
+%check
+%meson_test
+
+%ldconfig_scriptlets
+
+%files
+%license COPYING
+%doc README.md
+%{_libdir}/libwacom.so.*
+%{_bindir}/libwacom-list-local-devices
+%{_mandir}/man1/libwacom-list-local-devices.1*
+
+%files devel
+%dir %{_includedir}/libwacom-1.0/
+%dir %{_includedir}/libwacom-1.0/libwacom
+%{_includedir}/libwacom-1.0/libwacom/libwacom.h
+%{_libdir}/libwacom.so
+%{_libdir}/pkgconfig/libwacom.pc
+
+%files data
+%doc COPYING
+%{_udevrulesdir}/65-libwacom.rules
+%dir %{_datadir}/libwacom
+%{_datadir}/libwacom/*.tablet
+%{_datadir}/libwacom/*.stylus
+%dir %{_datadir}/libwacom/layouts
+%{_datadir}/libwacom/layouts/*.svg
+
+%changelog
+* Mon Dec 23 2019 Peter Hutterer <peter.hutterer@redhat.com> 1.2-2
+- Disable documentation explicitly. Fedora uses --auto-features=enabled
+  during the build.
+
+* Mon Dec 23 2019 Peter Hutterer <peter.hutterer@redhat.com> 1.2-1
+- libwacom 1.2
+
+* Thu Nov 07 2019 Peter Hutterer <peter.hutterer@redhat.com> 1.1-2
+- Require a libwacom-data package of the same version
+
+* Mon Sep 16 2019 Peter Hutterer <peter.hutterer@redhat.com> 1.1-1
+- libwacom 1.1
+
+* Mon Aug 26 2019 Peter Hutterer <peter.hutterer@redhat.com> 1.0-1
+- libwacom 1.0
+
+* Thu Aug 08 2019 Peter Hutterer <peter.hutterer@redhat.com> 0.99.901-1
+- libwacom 1.0rc1
+- switch to meson
+
+* Fri Apr 12 2019 Peter Hutterer <peter.hutterer@redhat.com> 0.33-1
+- libwacom 0.33
+
+* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.32-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
+
+* Mon Nov 12 2018 Peter Hutterer <peter.hutterer@redhat.com> 0.32-2
+- Move the udev rule to the noarch libwacom-data package (#1648743)
+
+* Mon Nov 05 2018 Peter Hutterer <peter.hutterer@redhat.com> 0.32-1
+- libwacom 0.32
+
+* Thu Aug 09 2018 Peter Hutterer <peter.hutterer@redhat.com> 0.31-1
+- libwacom 0.31
+
+* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.30-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
+
+* Fri May 18 2018 Peter Hutterer <peter.hutterer@redhat.com> 0.30-1
+- libwacom 0.30
+
+* Wed Mar 07 2018 Peter Hutterer <peter.hutterer@redhat.com>
+- Switch URLs to github
+
+* Mon Mar 05 2018 Peter Hutterer <peter.hutterer@redhat.com> 0.29-1
+- libwacom 0.29
+
+* Tue Feb 13 2018 Peter Hutterer <peter.hutterer@redhat.com> 0.28-3
+- Fix PairedID entry causing a debug message in the udev rules
+
+* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.28-2
+- Escape macros in %%changelog
+
+* Thu Feb 08 2018 Peter Hutterer <peter.hutterer@redhat.com> 0.28-1
+- libwacom 0.28
+- use autosetup
+
+* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.26-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
+
+* Sat Feb 03 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.26-3
+- Switch to %%ldconfig_scriptlets
+
+* Tue Oct 17 2017 Peter Hutterer <peter.hutterer@redhat.com> 0.26-2
+- run make check as part of the build (#1502637)
+
+*  Fri Aug 25 2017 Peter Hutterer <peter.hutterer@redhat.com> 0.26-1
+- libwacom 0.26
+
+* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.25-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
+
+* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.25-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
+
+* Thu May 11 2017 Peter Hutterer <peter.hutterer@redhat.com> 0.25-1
+- libwacom 0.25
+
+* Wed Feb 15 2017 Peter Hutterer <peter.hutterer@redhat.com> 0.24-1
+- libwacom 0.24
+
+* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.23-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
+
+* Fri Jan 20 2017 Peter Hutterer <peter.hutterer@redhat.com> 0.23-2
+- Upload the sources too...
+
+* Fri Jan 20 2017 Peter Hutterer <peter.hutterer@redhat.com> 0.23-1
+- libwacom 0.23
+
+* Fri Nov 11 2016 Peter Hutterer <peter.hutterer@redhat.com> 0.22-2
+- Add Lenovo X1 Yoga data file (#1389849)
+
+* Wed Jul 20 2016 Peter Hutterer <peter.hutterer@redhat.com> 0.22-1
+- libwacom 0.22
+
+* Fri Jun 17 2016 Peter Hutterer <peter.hutterer@redhat.com> 0.21-1
+- libwacom 0.21
+
+* Wed Jun 08 2016 Peter Hutterer <peter.hutterer@redhat.com> 0.20-1
+- libwacom 0.20
+
+* Tue Apr 26 2016 Peter Hutterer <peter.hutterer@redhat.com> 0.19-1
+- libwacom 0.19
+
+* Fri Apr 01 2016 Peter Hutterer <peter.hutterer@redhat.com> 0.18-2
+- Add a custom quirk for HUION Consumer Control devices (#1314955)
+
+* Fri Apr 01 2016 Peter Hutterer <peter.hutterer@redhat.com> 0.18-1
+- libwacom 0.18
+
+* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.17-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
+
+* Mon Dec 07 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.17-1
+- libwacom 0.17
+
+* Fri Nov 13 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.16-1
+- libwacom 0.16
+
+* Sun Jul 12 2015 Peter Robinson <pbrobinson@fedoraproject.org> 0.15-3
+- fix %%{_udevrulesdir} harder
+
+* Sat Jul 11 2015 Peter Robinson <pbrobinson@fedoraproject.org> 0.15-2
+- Use %%{_udevrulesdir} so rule.d doesn't inadvertantly end up in /
+- Use %%license
+
+* Wed Jul 08 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.15-1
+- libwacom 0.15
+
+* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.13-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
+
+* Tue Apr 21 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.13-2
+- Don't label touchscreens as touchpads (#1208685)
+
+* Mon Apr 20 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.13-1
+- libwacom 0.13
+
+* Tue Mar 10 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.12-1
+- libwacom 0.12
+
+* Thu Nov 06 2014 Peter Hutterer <peter.hutterer@redhat.com> 0.11-1
+- libwacom 0.11
+
+* Wed Aug 20 2014 Peter Hutterer <peter.hutterer@redhat.com> 0.10-1
+- libwacom 0.10
+
+* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
+
+* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
+
+* Thu Mar 20 2014 Peter Hutterer <peter.hutterer@redhat.com> 0.9-2
+- Generate the rules file from the database
+
+* Tue Mar 04 2014 Peter Hutterer <peter.hutterer@redhat.com> 0.9-1
+- libwacom 0.9
+
+* Mon Jan 20 2014 Peter Hutterer <peter.hutterer@redhat.com> - 0.8-2
+- Update rules file to current database
+
+* Mon Oct 07 2013 Peter Hutterer <peter.hutterer@redhat.com> 0.8-1
+- libwacom 0.8
+
+* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.1-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
+
+* Thu Jul 11 2013 Peter Hutterer <peter.hutterer@redhat.com> 0.7.1-3
+- Disable silent rules
+
+* Wed May 01 2013 Peter Hutterer <peter.hutterer@redhat.com> 0.7.1-2
+- Use stdout, not stdin for printing
+
+* Tue Apr 16 2013 Peter Hutterer <peter.hutterer@redhat.com> 0.7.1-1
+- libwacom 0.7.1
+
+* Fri Feb 22 2013 Peter Hutterer <peter.hutterer@redhat.com> 0.7-3
+- Install into correct udev rules directory (#913723)
+
+* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
+
+* Thu Dec 20 2012 Peter Hutterer <peter.hutterer@redhat.com> 0.7-1
+- libwacom 0.7
+
+* Fri Nov 09 2012 Peter Hutterer <peter.hutterer@redhat.com> 0.6.1-1
+- libwacom 0.6.1
+- update udev.rules files for new tablet descriptions
+
+* Fri Aug 17 2012 Peter Hutterer <peter.hutterer@redhat.com> 0.6-5
+- remove %%defattr, not necessary anymore
+
+* Mon Jul 30 2012 Peter Hutterer <peter.hutterer@redhat.com> 0.6-4
+- ... and install the rules in %%libdir
+
+* Mon Jul 30 2012 Peter Hutterer <peter.hutterer@redhat.com> 0.6-3
+- udev rules can go into %%libdir now
+
+* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
+
+* Tue Jul 03 2012 Peter Hutterer <peter.hutterer@redhat.com> 0.6-1
+- libwacom 0.6
+
+* Tue May 08 2012 Peter Hutterer <peter.hutterer@redhat.com> 0.5-3
+- Fix crash with WACf* serial devices (if not inputattach'd) (#819191)
+
+* Thu May 03 2012 Peter Hutterer <peter.hutterer@redhat.com> 0.5-2
+- Fix gnome-control-center crash for Bamboo Pen & Touch
+- Generic styli needs to have erasers, default to two tools.
+
+* Wed May 02 2012 Peter Hutterer <peter.hutterer@redhat.com> 0.5-1
+- Update to 0.5
+- Fix sources again - as long as Source0 points to sourceforge this is a bz2
+
+* Tue Mar 27 2012 Matthias Clasen <mclasen@redhat.com> 0.4-1
+- Update to 0.4
+
+* Thu Mar 22 2012 Peter Hutterer <peter.hutterer@redhat.com> 0.3-6
+- Fix udev rules generator patch to apply ENV{ID_INPUT_TOUCHPAD} correctly
+  (#803314)
+
+* Thu Mar 08 2012 Olivier Fourdan <ofourdan@redhat.com> 0.3-5
+- Mark data subpackage as noarch and make it a requirement for libwacom
+- Use generated udev rule file to list only known devices from libwacom
+  database
+
+* Tue Mar 06 2012 Peter Hutterer <peter.hutterer@redhat.com> 0.3-4
+- libwacom-0.3-add-list-devices.patch: add API to list devices
+- libwacom-0.3-add-udev-generator.patch: add a udev rules generater tool
+- libwacom-0.3-add-bamboo-one.patch: add Bamboo One definition
+
+* Tue Feb 21 2012 Olivier Fourdan <ofourdan@redhat.com> - 0.3-2
+- Add udev rules to identify Wacom as tablets for libwacom
+
+* Tue Feb 21 2012 Peter Hutterer <peter.hutterer@redhat.com>
+- Source file is .bz2, not .xz
+
+* Tue Feb  7 2012 Matthias Clasen <mclasen@redhat.com> - 0.3-1
+- Update to 0.3
+
+* Tue Jan 17 2012 Matthias Clasen <mclasen@redhat.com> - 0.2-1
+- Update to 0.2
+
+* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
+
+* Mon Dec 19 2011 Peter Hutterer <peter.hutterer@redhat.com> 0.1-1
+- Initial import (#768800)

+ 117 - 0
pkg/fedora/makerpm

@@ -0,0 +1,117 @@
+#!/bin/sh
+
+# Default to using the first specfile in the current directory
+SPEC="*.spec"
+OPTS="-ba"
+
+SIGN=0
+KEY=""
+
+BUILD=".build"
+RPMS="out"
+
+usage() {
+	echo "Usage: $0 [OPTION]..."
+	echo "Wrapper for rpmbuild that is easier to use."
+	echo
+	echo "Options:"
+	echo "    -h    This help message"
+	echo "    -f    The specfile to build from"
+	echo "    -c    Clean the build artifacts"
+	echo "    -s    Sign the produced RPM packages"
+	echo "    -k    The GPG key to use for signing"
+	exit
+}
+
+clean() {
+	rm -rf $BUILD
+	rm -rf $RPMS
+	exit
+}
+
+while getopts ":hcsf:k:" args; do
+	case "$args" in
+	f)
+		SPEC=$OPTARG
+		;;
+	s)
+		SIGN=1
+		;;
+	k)
+		KEY=$OPTARG
+		;;
+	c)
+		clean
+		;;
+	h)
+		usage
+		;;
+	esac
+done
+shift $((OPTIND-1))
+
+if [ ! "$@" = "" ]; then
+	OPTS="$@"
+fi
+
+# Check if the specfile exists
+if [ "$(ls -f $SPEC | wc -l)" = "0" ]; then
+	echo "ERROR: No specfile found. Specify it with the -s option."
+	exit -2
+fi
+
+# Check if there are too many specfiles
+if [ ! "$(ls -f $SPEC | wc -l)" = "1" ]; then
+	echo "ERROR: Ambiguous matches for specfile. Please specify a single" \
+		"file through the -s option."
+	exit -7
+fi
+
+# Get the directory of the specfile
+SPEC=$(ls -f $SPEC)
+DIR=$(readlink -f $(dirname $SPEC))
+
+if [ ! -d "$DIR/$BUILD" ]; then
+	mkdir "$DIR/$BUILD"
+fi
+
+FILES=$(find $DIR -maxdepth 1);
+for file in $FILES; do
+	[ "$file" = "$DIR" ] && continue
+	[ "$file" = "$DIR/$BUILD" ] && continue
+	[ "$file" = "$DIR/$RPMS" ] && continue
+
+	cp -r "$file" "$DIR/$BUILD"
+done
+
+spectool                                   \
+	--define "_sourcedir $DIR/$BUILD"  \
+	--define "_builddir $DIR/$BUILD"   \
+	--define "_srcrpmdir $DIR/$RPMS"   \
+	--define "_rpmdir $DIR/$RPMS"      \
+	--define "_specdir $DIR"           \
+	--get-files --all                  \
+	--directory $DIR/$BUILD $SPEC
+
+echo
+
+rpmbuild                                   \
+	--define "_sourcedir $DIR/$BUILD"  \
+	--define "_builddir $DIR/$BUILD"   \
+	--define "_srcrpmdir $DIR/$RPMS"   \
+	--define "_rpmdir $DIR/$RPMS"      \
+	--define "_specdir $DIR"           \
+	$OPTS $SPEC
+
+if [ ! "$SIGN" = "1" ]; then
+	exit
+fi
+
+for file in $(find out/ -name '*.rpm'); do
+	echo "Signing $file"
+	if [ "$KEY" = "" ]; then
+		rpm --resign $file 2>&1 > /dev/null
+	else
+		rpm --resign $file --define "_gpg_name $KEY" 2>&1 > /dev/null
+	fi
+done

+ 55 - 0
pkg/fedora/surface-control/surface-control.spec

@@ -0,0 +1,55 @@
+Name:       surface-control
+Version:    0.2.5
+Release:    1%{?dist}
+Summary:    Control various aspects of Microsoft Surface devices from the shell
+
+License:    MIT
+URL:        https://github.com/linux-surface/surface-control
+Source:     %{url}/archive/v%{version}.zip
+
+Requires:       dbus libgcc
+BuildRequires:  rust cargo
+
+%global debug_package %{nil}
+
+%description
+Control various aspects of Microsoft Surface devices on Linux from the shell.
+Aims to provide a unified front-end to the various sysfs-attributes and special
+devices.
+
+%prep
+%autosetup -n %{name}-%{version}
+
+%build
+export CARGO_TARGET_DIR="$PWD/target"
+export CARGO_INCREMENTAL=0
+
+cargo build --release --locked
+strip --strip-all "target/release/surface"
+
+%install
+rm -rf %{buildroot}
+install -D -m755 "target/release/surface" "%{buildroot}/usr/bin/surface"
+install -D -m644 "target/surface.bash" "%{buildroot}/usr/share/bash-completion/completions/surface"
+install -D -m644 "target/_surface" "%{buildroot}/usr/share/zsh/site-functions/_surface"
+install -D -m644 "target/surface.fish" "%{buildroot}/usr/share/fish/completions/surface.fish"
+
+%files
+%license LICENSE
+/usr/bin/surface
+/usr/share/bash-completion/completions/surface
+/usr/share/zsh/site-functions/_surface
+/usr/share/fish/completions/surface.fish
+
+%changelog
+* Sun Dec 01 2019 Dorian Stoll <dorian.stoll@tmsp.io>
+- Update to version 0.2.5
+
+* Fri Sep 27 2019 Dorian Stoll <dorian.stoll@tmsp.io>
+- Update packaging
+
+* Sat Sep 14 2019 Dorian Stoll <dorian.stoll@tmsp.io>
+- Update to 0.2.4
+
+* Fri May 17 2019 Dorian Stoll <dorian.stoll@tmsp.io>
+- Initial version

+ 80 - 0
pkg/fedora/surface-dtx-daemon/surface-dtx-daemon.spec

@@ -0,0 +1,80 @@
+Name:       surface-dtx-daemon
+Version:    0.1.4
+Release:    1%{?dist}
+Summary:    Surface Detachment System (DTX) Daemon
+
+License:    MIT
+URL:        https://github.com/linux-surface/surface-dtx-daemon
+Source:     %{url}/archive/v%{version}.zip
+
+Requires:       dbus libgcc
+BuildRequires:  rust cargo dbus-devel
+
+%global debug_package %{nil}
+
+%description
+Linux User-Space Detachment System (DTX) Daemon for the Surface ACPI Driver
+(and Surface Books). Currently only the Surface Book 2 is supported, due to
+lack of driver-support on the Surface Book 1. This may change in the future.
+
+%prep
+%autosetup -n %{name}-%{version}
+
+%build
+export CARGO_TARGET_DIR="$PWD/target"
+export CARGO_INCREMENTAL=0
+
+cargo build --release --locked
+strip --strip-all "target/release/surface-dtx-daemon"
+strip --strip-all "target/release/surface-dtx-userd"
+
+%install
+rm -rf %{buildroot}
+
+# binary files
+install -D -m755 "target/release/surface-dtx-daemon" "%{buildroot}/usr/bin/surface-dtx-daemon"
+install -D -m755 "target/release/surface-dtx-userd" "%{buildroot}/usr/bin/surface-dtx-userd"
+
+# application files
+install -D -m644 "etc/dtx/surface-dtx-daemon.conf" "%{buildroot}/etc/surface-dtx/surface-dtx-daemon.conf"
+install -D -m644 "etc/dtx/surface-dtx-userd.conf" "%{buildroot}/etc/surface-dtx/surface-dtx-userd.conf"
+install -D -m755 "etc/dtx/attach.sh" "%{buildroot}/etc/surface-dtx/attach.sh"
+install -D -m755 "etc/dtx/detach.sh" "%{buildroot}/etc/surface-dtx/detach.sh"
+install -D -m644 "etc/systemd/surface-dtx-daemon.service" "%{buildroot}/usr/lib/systemd/system/surface-dtx-daemon.service"
+install -D -m644 "etc/systemd/surface-dtx-userd.service" "%{buildroot}/usr/lib/systemd/user/surface-dtx-userd.service"
+install -D -m644 "etc/dbus/org.surface.dtx.conf" "%{buildroot}/etc/dbus-1/system.d/org.surface.dtx.conf"
+install -D -m644 "etc/udev/40-surface_dtx.rules" "%{buildroot}/etc/udev/rules.d/40-surface_dtx.rules"
+
+# completion files
+install -D -m644 "target/surface-dtx-daemon.bash" "%{buildroot}/usr/share/bash-completion/completions/surface-dtx-daemon"
+install -D -m644 "target/surface-dtx-userd.bash" "%{buildroot}/usr/share/bash-completion/completions/surface-dtx-userd"
+install -D -m644 "target/_surface-dtx-daemon" "%{buildroot}/usr/share/zsh/site-functions/_surface-dtx-daemon"
+install -D -m644 "target/_surface-dtx-userd" "%{buildroot}/usr/share/zsh/site-functions/_surface-dtx-userd"
+install -D -m644 "target/surface-dtx-daemon.fish" "%{buildroot}/usr/share/fish/completions/surface-dtx-daemon.fish"
+install -D -m644 "target/surface-dtx-userd.fish" "%{buildroot}/usr/share/fish/completions/surface-dtx-userd.fish"
+
+%files
+%license LICENSE
+%config /etc/dbus-1/system.d/org.surface.dtx.conf
+%config /etc/udev/rules.d/40-surface_dtx.rules
+%config(noreplace) /etc/surface-dtx/*
+/usr/bin/surface-dtx-daemon
+/usr/bin/surface-dtx-userd
+/usr/lib/systemd/system/surface-dtx-daemon.service
+/usr/lib/systemd/user/surface-dtx-userd.service
+/usr/share/bash-completion/completions/surface-dtx-daemon
+/usr/share/bash-completion/completions/surface-dtx-userd
+/usr/share/zsh/site-functions/_surface-dtx-daemon
+/usr/share/zsh/site-functions/_surface-dtx-userd
+/usr/share/fish/completions/surface-dtx-daemon.fish
+/usr/share/fish/completions/surface-dtx-userd.fish
+
+%changelog
+* Fri Sep 27 2019 Dorian Stoll <dorian.stoll@tmsp.io>
+- Update packaging
+
+* Sat Sep 14 2019 Dorian Stoll <dorian.stoll@tmsp.io>
+- Update to 0.1.4
+
+* Fri May 17 2019 Dorian Stoll <dorian.stoll@tmsp.io>
+- Initial version

+ 35 - 0
pkg/fedora/surface-firmware/surface-firmware.spec

@@ -0,0 +1,35 @@
+Name:       surface-firmware
+Version:    20191004
+Release:    1%{?dist}
+Summary:    Firmware for Microsoft Surface devices
+
+%global commit a6c6b97da238af28dfb5fea4cd71c69f61d8d24e
+
+License:    proprietary
+BuildArch:  noarch
+URL:        https://github.com/linux-surface/linux-surface
+Source:     %{url}/archive/%{commit}.zip
+
+%description
+This package provides firmware files required Microsoft Surface devices.
+
+%prep
+%autosetup -n linux-surface-%{commit}
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/lib
+cp -r firmware %{buildroot}/usr/lib
+
+%files
+/usr/lib/firmware/intel/ipts
+
+%changelog
+* Wed Oct 02 2019 Dorian Stoll <dorian.stoll@tmsp.io>
+- Actually fix the HID descriptor on Surface Laptop instead of replacing it
+
+* Wed Oct 02 2019 Dorian Stoll <dorian.stoll@tmsp.io>
+- Update firmware to fix touch input for Surface Laptop
+
+* Fri Sep 27 2019 Dorian Stoll <dorian.stoll@tmsp.io>
+- Initial version

+ 119 - 0
pkg/fedora/surface-secureboot/surface-secureboot.spec

@@ -0,0 +1,119 @@
+Name:       surface-secureboot
+Version:    20190927
+Release:    1%{?dist}
+Summary:    The secureboot certificate for linux-surface
+
+%global sb_cert surface.cer
+%global sb_password surface
+%global sb_cert_dir /usr/share/surface-secureboot
+
+License:    proprietary
+BuildArch:  noarch
+URL:        https://github.com/linux-surface/linux-surface
+Source:     %{sb_cert}
+
+Requires:   mokutil
+
+%description
+This package installs the secureboot certificate that is used to sign the
+kernel from the linux-surface kernel package. When you reboot for the first
+time, it will ask you to enroll the MOK certificate. Please check if the key
+is correct, and then confirm the import by entering "%{sb_password}".
+
+%prep
+%setup -q -c -T
+
+%install
+rm -rf %{buildroot}
+install -dm 755 %{buildroot}%{sb_cert_dir}
+install -pm 644 %{SOURCE0} %{buildroot}%{sb_cert_dir}
+
+%pre
+
+# Upgrading
+if [ "$1" = "2" ]; then
+	cp %{sb_cert_dir}/%{sb_cert} %{sb_cert_dir}/%{sb_cert}.bak
+	cmp --silent %{sb_cert_dir}/%{sb_cert} %{sb_cert_dir}/%{sb_cert}.bak
+	echo $?
+fi
+
+%post
+
+# First installation
+if [ ! -f "%{sb_cert_dir}/%{sb_cert}.bak" ]; then
+	echo ""
+	echo "The secure-boot certificate has been installed to:"
+	echo ""
+	echo "	%{sb_cert_dir}/%{sb_cert}"
+	echo ""
+	echo "It will now be automatically enrolled for you and guarded with the password:"
+	echo ""
+	echo "	%{sb_password}"
+	echo ""
+
+	HASHFILE=$(mktemp)
+	mokutil --generate-hash=%{sb_password} > $HASHFILE
+	mokutil --hash-file $HASHFILE --import %{sb_cert_dir}/%{sb_cert}
+
+	echo "To finish the enrollment process you need to reboot, where you will then be"
+	echo "asked to enroll the certificate. During the import, you will be prompted for"
+	echo "the password mentioned above. Please make sure that you are indeed adding"
+	echo "the right key and confirm by entering '%{sb_password}'."
+	echo ""
+	echo "Note that you can always manage your secure-boot keys, including the one"
+	echo "just enrolled, from inside Linux via the 'mokutil' tool."
+	echo ""
+elif ! cmp --silent %{sb_cert_dir}/%{sb_cert} %{sb_cert_dir}/%{sb_cert}.bak; then
+	echo ""
+	echo "Updating secure boot certificate. The old key will be revoked and a new key"
+	echo "will be installed. You will need to reboot your system, where you will then"
+	echo "be asked to delete the old and import the new key. In both cases, make sure"
+	echo "this is the right key and confirm with the password '%{sb_password}'."
+	echo ""
+
+	HASHFILE=$(mktemp)
+	mokutil --generate-hash=%{sb_password} > $HASHFILE
+	mokutil --hash-file $HASHFILE --import %{sb_cert_dir}/%{sb_cert}
+	mokutil --hash-file $HASHFILE --delete %{sb_cert_dir}/%{sb_cert}.bak
+	rm -f %{sb_cert_dir}/%{sb_cert}.bak
+else
+	rm -f %{sb_cert_dir}/%{sb_cert}.bak
+fi
+
+%preun
+
+# Last version is being removed
+if [ "$1" = "0" ]; then
+	echo ""
+	echo "The following secure-boot certificate will be uninstalled and revoked from:"
+	echo "your system"
+	echo ""
+	echo "	%{sb_cert_dir}/%{sb_cert}"
+	echo ""
+
+	HASHFILE=$(mktemp)
+	mokutil --generate-hash=%{sb_password} > $HASHFILE
+	mokutil --hash-file $HASHFILE --delete %{sb_cert_dir}/%{sb_cert}
+
+	echo "The key will be revoked on the next start of your system. You will then"
+	echo "again asked for the password. Enter '%{sb_password}' to confirm."
+	echo ""
+	echo "Kernels signed with the corresponding private key will still not be allowed"
+	echo "to boot after this. Note that you can always manage your secure-boot keys"
+	echo "via the 'mokutil' tool. Please refer to 'man mokutil' for more information."
+	echo ""
+fi
+
+
+%files
+%{sb_cert_dir}/%{sb_cert}
+
+%changelog
+* Fri Sep 27 2019 Dorian Stoll <dorian.stoll@tmsp.io>
+- Update to match qzed's version for Arch
+
+* Fri Sep 27 2019 Dorian Stoll <dorian.stoll@tmsp.io>
+- Update packaging
+
+* Thu Apr 25 2019 Dorian Stoll <dorian.stoll@tmsp.io>
+- Initial version

BIN
pkg/fedora/surface-secureboot/surface.cer