summaryrefslogtreecommitdiff
path: root/sys-apps/asahi-scripts
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-11-18 03:03:03 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-11-18 03:03:03 +0000
commitf9f6fa91738181ebe9aca71b75d157d8b5df5335 (patch)
tree556cf671790196d83709b89133064a855f1879f2 /sys-apps/asahi-scripts
parent3455c0a5153ae27d7c6c16ecd35fa3dec33f3dda (diff)
gentoo auto-resync : 18:11:2024 - 03:03:03
Diffstat (limited to 'sys-apps/asahi-scripts')
-rw-r--r--sys-apps/asahi-scripts/Manifest7
-rw-r--r--sys-apps/asahi-scripts/asahi-scripts-20231219.1.ebuild46
-rw-r--r--sys-apps/asahi-scripts/asahi-scripts-20240822.ebuild41
-rw-r--r--sys-apps/asahi-scripts/files/99-update-m1n1.install2
-rw-r--r--sys-apps/asahi-scripts/files/asahi-scripts-macsmc-battery.openrc51
-rw-r--r--sys-apps/asahi-scripts/files/update-m1n1.gentoo.conf1
6 files changed, 100 insertions, 48 deletions
diff --git a/sys-apps/asahi-scripts/Manifest b/sys-apps/asahi-scripts/Manifest
index 82fb8d394c3c..f44441a6a21b 100644
--- a/sys-apps/asahi-scripts/Manifest
+++ b/sys-apps/asahi-scripts/Manifest
@@ -1,5 +1,8 @@
+AUX 99-update-m1n1.install 24 BLAKE2B c3548572a4ead5e10bd5ca3f23bbdb63937ff3d276cef655f119c62918dabb1a86cf2bfca3f28a8fe8177307572e038eaea9820b236426f00486b7366bc6c202 SHA512 dba5d419bcc99bf7118d1b519631473e727bc09a35ce4a3225ff36815327f470ee5c02537f6e631a1d4efbecf295e9f0428a5facda53a86466c349ea22d6a470
+AUX asahi-scripts-macsmc-battery.openrc 986 BLAKE2B 53b18f055374213a44cd34172e1bcb317359a9a983ff83b3f1747e05edab6f084df2085db07ea600538db577781c74de782e74aadf305cbebde6b185ce1559eb SHA512 47863769caf9a5e3666afbb717cd35419f6794607d70a88b37d370ab4fee92eb2c5bf1b383a63d0d5dadfd331f98a429c754713e191cfc36ee7074fd6827c452
AUX makefile.patch 175 BLAKE2B e1858dec75b6d5b285c689ea2ce5187dbbda54b3cb3f72f3df29db7dc6133f57c5a361cdb493f0fe4ea624cda5e997f102840708111ef1b3aa682c92c1610342 SHA512 805d04d990698e1bdff54433ce4eeca0e45bc4a5cde1f3b539dabe2ee48f9dda49ff1a75e4ddc08e4f335ca99a5216d41fd0232f9771732996689446614a4ffc
AUX update-m1n1-dtbs.patch 399 BLAKE2B 610da1ca6ba4cc0d465b9c998a6a5a47931db6d0660539eabe2e6b4e73cf2fc235bccb2b30305415a8c33f5f2553e77869cfa34448e49b9c29eb2a3a99ca46f4 SHA512 3ad9fbf771a2d26b60f496c433f45495ace0d60317934221fe829a74c8621d7e13d85d3f26085aab2a44c00dc2ab8e91afbb222eba8c4d1c8526f681a4096304
-DIST asahi-scripts-20231219.1.tar.gz 10696 BLAKE2B 1a3103f093fa87f33f7bdc64340dbd61705ac88832b1a9a2cb015ae8ff7ccfc138b91d0f38505dcdb916ccef03a0f788dd2bbaac66fc32118ce8acb536791bdd SHA512 ab4462bd8b98558f57a1edb4ac9fb21535e6a2b8396f6774a3ea1160ad2de4f64ffb65a93d08e6112ea2d90050a1a368fd32d8a6e5b0d7a545961c57ac9d0639
-EBUILD asahi-scripts-20231219.1.ebuild 1276 BLAKE2B 8a7f1cc306006466bcd584a391981c05f6dea6772f2092457188532b36d9b5b82af3bcd7c85153220a3224aff66a953586d49b58d89d7e91239fa237f3ec715b SHA512 d8b99769245151ab4c1fda94e5e26819a06e36ec6ad9eebcfef355a22a10fb18f26648f505a4acd56dea9a3d28c875ea7d0ff231588790926f00e013195243c4
+AUX update-m1n1.gentoo.conf 65 BLAKE2B aeb047568d28328b4df20948abff57716af0c0fb148346f29e7efdc262b2fb19c9fd68207e927d1c8353dff7a8683d3b9836c773a772b934f130b352c90edce4 SHA512 4e31e30506d3bba4f54ead46252e27642b66bb40b0d5c1af7ed8a5c92bfdb687bdcc2a1d793ab54d1324af0fb50e918d012f678c454f3a33c79756865412eb65
+DIST asahi-scripts-20240822.tar.gz 12264 BLAKE2B 945bd549a768beb86b69bbdeae088df7d687a534d7003e62574349e40fcb84f37306e96aade89d2fd45882add0d1b31e99b647f38debce4f6fb9185ec848d2a8 SHA512 6b99abe8df63b928285d6af54ba745bf9ae7a53f3208c77b90158fa076d34feb091275343039b61320fc043b6021170ad63f0e6df933e6a0a3fbfe146f78caf5
+EBUILD asahi-scripts-20240822.ebuild 1168 BLAKE2B 07fa341cc6c5de94cdb44374d9cfc0caa34efb8c7715fa794f9c79a6787732280642afeafeb0d27cec646eb74297daf00afcfba4ac5c5d6aef64b466d1a8dbe9 SHA512 b4611b361c0e8818ce6a5b1bc51d67807d6d5fef87f4442eff5d0dd5991a76e802317655e3fc5e1310e5f3e8fcd6a16e6b2d310491b74224ad6b04eeeb862623
MISC metadata.xml 423 BLAKE2B 4bfaa21a10fe7fd713795044151c993a1ac6bec3d266ee60ff2713e8856d19a85d3bea0806ed7f3382aa58fe7388732478ce518668f131637a8758233829adbc SHA512 1fde5b23da68b00da65f6f3c7ed2510247b6e05828d3b5b66a48e01ee8b7e6565d7b39778da42a3059ed15a5af13c4f732eb8c70cc9d30b7e617c80913956a33
diff --git a/sys-apps/asahi-scripts/asahi-scripts-20231219.1.ebuild b/sys-apps/asahi-scripts/asahi-scripts-20231219.1.ebuild
deleted file mode 100644
index 4e4b1fe2eda2..000000000000
--- a/sys-apps/asahi-scripts/asahi-scripts-20231219.1.ebuild
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="8"
-
-DESCRIPTION="Apple Silicon support scripts"
-HOMEPAGE="https://asahilinux.org/"
-SRC_URI="https://github.com/AsahiLinux/${PN}/archive/refs/tags/${PV}.tar.gz -> ${PN}-${PV}.tar.gz"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="~arm64"
-
-PATCHES=(
- "${FILESDIR}/makefile.patch"
- "${FILESDIR}/update-m1n1-dtbs.patch"
-)
-
-src_install() {
- default
- emake DESTDIR="${D}" SYS_PREFIX="" install-dracut
-}
-
-pkg_postinst() {
- if [[ ! -e ${ROOT}/usr/lib/asahi-boot ]]; then
- ewarn "These scripts are intended for use on Apple Silicon"
- ewarn "machines with the Asahi tooling installed! Please"
- ewarn "install sys-boot/m1n1, sys-boot/u-boot and"
- ewarn "sys-firmware/asahi-firmware!"
- fi
-
- if [[ -e ${ROOT}/bin/update-m1n1 ]]; then
- ewarn "You need to remove /bin/update-m1n1."
- fi
-
- if [[ -e ${ROOT}/usr/local/share/asahi-scripts/functions.sh ]]; then
- ewarn "You have upgraded to a new version of ${PN}. Please"
- ewarn "remove /usr/local/share/asahi-scripts/,"
- ewarn " /usr/local/bin/update-m1n1, and"
- ewarn "/usr/local/bin/update-vendor-firmware."
- fi
-
- if [[ -e ${ROOT}/etc/dracut.conf.d/10-apple.conf ]]; then
- ewarn "Please remove /etc/dracut.conf.d/10-apple.conf"
- fi
-}
diff --git a/sys-apps/asahi-scripts/asahi-scripts-20240822.ebuild b/sys-apps/asahi-scripts/asahi-scripts-20240822.ebuild
new file mode 100644
index 000000000000..f30bf81d26cf
--- /dev/null
+++ b/sys-apps/asahi-scripts/asahi-scripts-20240822.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="8"
+
+DESCRIPTION="Apple Silicon support scripts"
+HOMEPAGE="https://asahilinux.org/"
+SRC_URI="https://github.com/AsahiLinux/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="arm64"
+
+RDEPEND="
+ virtual/udev
+"
+
+src_install() {
+ emake DESTDIR="${D}" PREFIX="/usr" SYS_PREFIX="" install-dracut
+ emake DESTDIR="${D}" PREFIX="/usr" install-macsmc-battery
+
+ newinitd "${FILESDIR}/${PN}-macsmc-battery.openrc" "macsmc-battery"
+
+ # install gentoo sys config
+ insinto /etc/default
+ newins "${FILESDIR}"/update-m1n1.gentoo.conf update-m1n1
+ exeinto /usr/lib/kernel/install.d/
+ doexe "${FILESDIR}/99-update-m1n1.install"
+}
+
+pkg_postinst() {
+ if [[ ! -e ${ROOT}/usr/lib/asahi-boot ]]; then
+ ewarn "These scripts are intended for use on Apple Silicon"
+ ewarn "machines with the Asahi tooling installed! Please"
+ ewarn "install sys-boot/m1n1, sys-boot/u-boot and"
+ ewarn "sys-firmware/asahi-firmware!"
+ fi
+
+ elog "Asahi scripts have been installed to /usr/. For more"
+ elog "information on how to use them, please visit the Wiki."
+}
diff --git a/sys-apps/asahi-scripts/files/99-update-m1n1.install b/sys-apps/asahi-scripts/files/99-update-m1n1.install
new file mode 100644
index 000000000000..ceab30398908
--- /dev/null
+++ b/sys-apps/asahi-scripts/files/99-update-m1n1.install
@@ -0,0 +1,2 @@
+#!/bin/bash
+update-m1n1
diff --git a/sys-apps/asahi-scripts/files/asahi-scripts-macsmc-battery.openrc b/sys-apps/asahi-scripts/files/asahi-scripts-macsmc-battery.openrc
new file mode 100644
index 000000000000..19e8363116fd
--- /dev/null
+++ b/sys-apps/asahi-scripts/files/asahi-scripts-macsmc-battery.openrc
@@ -0,0 +1,51 @@
+#!/sbin/openrc-run
+# Save and restore the SMC's charge end threshold
+
+extra_commands="save restore"
+
+depend() {
+ need udev
+}
+
+has_battery() {
+ if [ ! -e /sys/class/power_supply/macsmc-battery ]; then
+ eerror "macsmc-battery was not found!"
+ return 2
+ fi
+
+ return 0
+}
+
+restore() {
+ ebegin "Restoring macsmc-battery saved charge end threshold"
+
+ has_battery || return $?
+
+ if [ ! -e /etc/udev/macsmc-battery.conf ]; then
+ ewarn "No saved charge end threshold found! Saving current value..."
+ save
+ return $?
+ fi
+
+ sed -e 's/CHARGE_CONTROL_END_THRESHOLD=//' /etc/udev/macsmc-battery.conf > /sys/class/power_supply/macsmc-battery/charge_control_end_threshold
+ return 0
+}
+
+save() {
+ ebegin "Saving current macsmc-battery charge end threshold"
+
+ has_battery || return $?
+
+ sed -e 's/^/CHARGE_CONTROL_END_THRESHOLD=/' /sys/class/power_supply/macsmc-battery/charge_control_end_threshold > /etc/udev/macsmc-battery.conf
+ return 0
+}
+
+start() {
+ restore
+ eend $?
+}
+
+stop() {
+ save
+ eend $?
+}
diff --git a/sys-apps/asahi-scripts/files/update-m1n1.gentoo.conf b/sys-apps/asahi-scripts/files/update-m1n1.gentoo.conf
new file mode 100644
index 000000000000..64fecd746974
--- /dev/null
+++ b/sys-apps/asahi-scripts/files/update-m1n1.gentoo.conf
@@ -0,0 +1 @@
+DTBS=$(/bin/ls -d /boot/dtbs/* | sort -rV | head -1)/apple/*.dtb