From cbbedd1b0e793c2b39e5eb402da5821ed08b1a28 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Tue, 28 Jul 2026 17:24:38 +0300 Subject: [PATCH] Initial commit --- .gitignore | 3 +++ check-version.sh | 9 +++++++++ info.yml | 42 ++++++++++++++++++++++++++++++++++++++++ recipe.sh | 43 +++++++++++++++++++++++++++++++++++++++++ source-files/tlp-pd.esv | 4 ++++ source-files/tlp.esv | 5 +++++ 6 files changed, 106 insertions(+) create mode 100644 .gitignore create mode 100644 check-version.sh create mode 100644 info.yml create mode 100644 recipe.sh create mode 100644 source-files/tlp-pd.esv create mode 100644 source-files/tlp.esv diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9d96df7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Ignore BPM archives and signatures +*.bpm +*.bpm.sig diff --git a/check-version.sh b/check-version.sh new file mode 100644 index 0000000..44ecfa8 --- /dev/null +++ b/check-version.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Github repository +REPO="linrunner/TLP" + +# Get tag name using Github Rest API +TAG_NAME=$(curl -s -L -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/"$REPO"/releases/latest | jq -r '.tag_name') + +echo "$TAG_NAME" diff --git a/info.yml b/info.yml new file mode 100644 index 0000000..907875f --- /dev/null +++ b/info.yml @@ -0,0 +1,42 @@ +name: tlp +description: Optimize Linux laptop battery life +version: 1.10.2 +revision: 1 +url: https://linrunner.de/en/tlp/tlp.html +license: GPL-2.0-or-later +architecture: any +output_architecture: any +type: source +optional_depends: + - ethtol:For disabling Wake On Lan + - smartmontools:For displaying S.M.A.R.T data +downloads: + - url: https://github.com/linrunner/TLP/archive/refs/tags/${BPM_PKG_VERSION}.tar.gz + extract_to: ${BPM_SOURCE} + extract_strip_components: 1 + checksum: a0b8bd8193d96853d2876c552b3b2bdf46bd1258fffc9ac598acc67eb73b56d5 +split_packages: + - name: tlp + keep: + - etc/tlp.conf + depends: + - bash + - hdparm + - iw + - pciutils + - perl + - util-linux + - usbutils + - name: tlp-pd + description: Optimize Linux laptop battery life - Power Profiles Daemon + depends: + - glib + - python3 + - python-dbus + - python-pygobject + - python-shtab + - tlp + conflicts: + - power-profiles-daemon + provides: + - power-profiles-daemon diff --git a/recipe.sh b/recipe.sh new file mode 100644 index 0000000..379413c --- /dev/null +++ b/recipe.sh @@ -0,0 +1,43 @@ +# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package +# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE +# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package_tlp() { + cd "$BPM_SOURCE" + + export TLP_NO_INIT=1 + export TLP_SBIN=/usr/sbin + export TLP_WITH_ELOGIND=1 + export TLP_WITH_SYSTEMD=0 + + make DESTDIR="$BPM_OUTPUT" install-tlp install-man-tlp + + # Install esvm service + install -Dm644 "$BPM_WORKDIR"/tlp.esv "$BPM_OUTPUT"/etc/esvm/services/tlp.esv + + # Install package license + install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/tlp/LICENSE +} + +package_tlp-pd() { + cd "$BPM_SOURCE" + + make DESTDIR="$BPM_OUTPUT" install-pd install-man-pd + + # Fix path to 'tlp' binary in 'tlp-pd' + sed -i 's|"tlp", f"{profile}"|"/usr/sbin/tlp", f"{profile}"|g' "$BPM_OUTPUT"/usr/sbin/tlp-pd + + # Set Exec field in dbus services to tlp-pd + sed -i 's|^Exec=.*|Exec=/usr/sbin/tlp-pd|' \ + "$BPM_OUTPUT"/usr/share/dbus-1/system-services/org.freedesktop.UPower.PowerProfiles.service \ + "$BPM_OUTPUT"/usr/share/dbus-1/system-services/net.hadess.PowerProfiles.service + + # Install esvm service + install -Dm644 "$BPM_WORKDIR"/tlp-pd.esv "$BPM_OUTPUT"/etc/esvm/services/tlp-pd.esv + + # Install package license + install -d "$BPM_OUTPUT"/usr/share/licenses + ln -sf "$BPM_OUTPUT"/usr/share/licenses/tlp "$BPM_OUTPUT"/usr/share/licenses/tlp-pd +} diff --git a/source-files/tlp-pd.esv b/source-files/tlp-pd.esv new file mode 100644 index 0000000..2920a6d --- /dev/null +++ b/source-files/tlp-pd.esv @@ -0,0 +1,4 @@ +name: tlp-pd +description: Start the TLP Power Profiles Daemon +type: background +start_cmd: tlp-pd diff --git a/source-files/tlp.esv b/source-files/tlp.esv new file mode 100644 index 0000000..71e50c6 --- /dev/null +++ b/source-files/tlp.esv @@ -0,0 +1,5 @@ +name: tlp +description: Enable the TLP daemon +type: simple +start_cmd: tlp init start +stop_cmd: tlp init stop