Play MP3 with results

NOTE: i915 needs to be blacklisted to avoid a ~60 second delay
      before the audio devices become available
This commit is contained in:
2Shirt 2021-05-21 00:26:38 -06:00
parent 522795c4c6
commit 2b2136f701
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
10 changed files with 24 additions and 3 deletions

View file

@ -8,3 +8,7 @@ This will build a minimal environment that does the following:
* Checks if there are any gpu/gfx variables present and if so prompts a NVRAM reset.
* If those variables are not present then it adds one to disable the discrete GPU.
## Credit ##
* Audio files were created using [Wideo Text-to-speech](https://wideo.co/text-to-speech/)

View file

@ -0,0 +1 @@
options snd-hda-intel model=intel-mac-auto

View file

@ -13,6 +13,15 @@ YELLOW='\033[33m'
ORANGE='\033[31;1m'
BLUE='\033[34m'
# Play MP3
function play_mp3() {
mpg123 "mp3/$1" >/dev/null 2>&1
}
# Set volume
amixer -q set Master 80% unmute >/dev/null 2>&1
amixer -q set PCM 80% unmute >/dev/null 2>&1
# Check for current variables
for prefix in gfx gpu; do
for var in /sys/firmware/efi/efivars/${prefix}*; do
@ -27,23 +36,28 @@ done
echo ""
if [[ ! -e "/sys/firmware/efi/efivars" ]]; then
# Probably booted legacy
play_mp3 "EFIVARS not found.mp3"
echo -e "${RED}ERROR:${CLEAR} EFIVARS not found"
elif cmp "$SOURCE" "$DEST" >/dev/null 2>&1; then
# EFI var matches desired state
play_mp3 "Discrete GPU already disabled.mp3"
echo -e "${GREEN}Discrete GPU already disabled${CLEAR}"
elif [[ "$needs_nvram_reset" == "yes" ]]; then
# One or more gfx/gpu EFI vars detected
play_mp3 "Please reset the NVRAM.mp3"
echo -e "${RED}ERROR:${CLEAR} Detected the above EFIVARS"
echo -e "Please reboot and reset the NVRAM"
echo -e "Please reset the NVRAM"
else
# No gfx/gpu EFI vars detected so we can apply the fix
cp "$SOURCE" "$DEST"
chattr +i "$DEST"
sync
umount /sys/firmware/efi/efivars
echo -e "${GREEN}Discrete GPU successfully disabled${CLEAR}"
mount -t efivarfs efivarfs /sys/firmware/efi/efivars
play_mp3 "Discrete GPU successfully disabled.mp3"
echo -e "${GREEN}Discrete GPU successfully disabled${CLEAR}"
fi
echo ""
play_mp3 "Press Enter to poweroff the system.mp3"
read -p "Press Enter to poweroff the system... " -r unusedvar
poweroff

Binary file not shown.

Binary file not shown.

View file

@ -4,4 +4,4 @@
title Mac dGPU Disable Tool
linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux
initrd /%INSTALL_DIR%/boot/x86_64/initramfs-linux.img
options archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% nomodeset
options archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% nomodeset module_blacklist=i915

View file

@ -1,4 +1,6 @@
alsa-utils
base
linux
mkinitcpio
mkinitcpio-archiso
mpg123