Add touchpad hold-tap tool
This commit is contained in:
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
repo_root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
|
||||
topdir="$repo_root/rpmbuild"
|
||||
|
||||
mkdir -p "$topdir"/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
|
||||
install -m 0644 \
|
||||
"$repo_root/touchpad-hold-tap/90-touchpad-hold-tap.lua" \
|
||||
"$topdir/SOURCES/90-touchpad-hold-tap.lua"
|
||||
install -m 0644 "$repo_root/LICENSE" "$topdir/SOURCES/LICENSE"
|
||||
install -m 0644 \
|
||||
"$repo_root/touchpad-hold-tap/tests/test-touchpad-hold-tap.lua" \
|
||||
"$topdir/SOURCES/test-touchpad-hold-tap.lua"
|
||||
install -m 0644 "$repo_root/README.md" "$topdir/SOURCES/README.md"
|
||||
|
||||
rpmbuild \
|
||||
--define "_topdir $topdir" \
|
||||
-bb "$repo_root/touchpad-hold-tap/touchpad-hold-tap.spec"
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
usage() {
|
||||
printf 'Usage: GITEA_TOKEN=... %s PATH_TO_RPM FEDORA_RELEASE\n' "$0" >&2
|
||||
}
|
||||
|
||||
if (( $# != 2 )); then
|
||||
usage
|
||||
exit 2
|
||||
fi
|
||||
|
||||
rpm_path=$1
|
||||
fedora_release=$2
|
||||
|
||||
if [[ ! -f $rpm_path || $rpm_path != *.rpm ]]; then
|
||||
printf 'Error: %s is not an RPM file.\n' "$rpm_path" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [[ ! $fedora_release =~ ^[0-9]+$ ]]; then
|
||||
printf 'Error: Fedora release must be a number, such as 44.\n' >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [[ -z ${GITEA_TOKEN:-} ]]; then
|
||||
printf 'Error: set GITEA_TOKEN to a Gitea access token with package write permission.\n' >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
upload_url="https://git.ajpanton.se/api/packages/ajp_anton/rpm/fedora/${fedora_release}/upload"
|
||||
|
||||
curl \
|
||||
--fail-with-body \
|
||||
--show-error \
|
||||
--silent \
|
||||
--user "ajp_anton:${GITEA_TOKEN}" \
|
||||
--upload-file "$rpm_path" \
|
||||
"$upload_url"
|
||||
|
||||
printf 'Published %s for Fedora %s.\n' "$rpm_path" "$fedora_release"
|
||||
Reference in New Issue
Block a user