mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
sys-apps/asahi-scripts: add 20240822
Signed-off-by: James Calligeros <jcalligeros99@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
committed by
Sam James
parent
b61b5fa9f4
commit
41807551ba
@@ -1 +1,2 @@
|
||||
DIST asahi-scripts-20231219.1.tar.gz 10696 BLAKE2B 1a3103f093fa87f33f7bdc64340dbd61705ac88832b1a9a2cb015ae8ff7ccfc138b91d0f38505dcdb916ccef03a0f788dd2bbaac66fc32118ce8acb536791bdd SHA512 ab4462bd8b98558f57a1edb4ac9fb21535e6a2b8396f6774a3ea1160ad2de4f64ffb65a93d08e6112ea2d90050a1a368fd32d8a6e5b0d7a545961c57ac9d0639
|
||||
DIST asahi-scripts-20240822.tar.gz 12264 BLAKE2B 945bd549a768beb86b69bbdeae088df7d687a534d7003e62574349e40fcb84f37306e96aade89d2fd45882add0d1b31e99b647f38debce4f6fb9185ec848d2a8 SHA512 6b99abe8df63b928285d6af54ba745bf9ae7a53f3208c77b90158fa076d34feb091275343039b61320fc043b6021170ad63f0e6df933e6a0a3fbfe146f78caf5
|
||||
|
||||
41
sys-apps/asahi-scripts/asahi-scripts-20240822.ebuild
Normal file
41
sys-apps/asahi-scripts/asahi-scripts-20240822.ebuild
Normal file
@@ -0,0 +1,41 @@
|
||||
# Copyright 2022 James Calligeros <jcalligeros99@gmail.com>
|
||||
# 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."
|
||||
}
|
||||
2
sys-apps/asahi-scripts/files/99-update-m1n1.install
Normal file
2
sys-apps/asahi-scripts/files/99-update-m1n1.install
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
update-m1n1
|
||||
@@ -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 $?
|
||||
}
|
||||
1
sys-apps/asahi-scripts/files/update-m1n1.gentoo.conf
Normal file
1
sys-apps/asahi-scripts/files/update-m1n1.gentoo.conf
Normal file
@@ -0,0 +1 @@
|
||||
DTBS=$(/bin/ls -d /boot/dtbs/* | sort -rV | head -1)/apple/*.dtb
|
||||
Reference in New Issue
Block a user