Skip to content

Commit

Permalink
Revert "Run firmware script with sudo"
Browse files Browse the repository at this point in the history
This reverts commit 9a2832b.
  • Loading branch information
sharpenedblade committed Feb 19, 2024
1 parent 1bb2aba commit 91bc11f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions docs/guides/wifi-bluetooth.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ You have two options here. You can follow either of the two, its purely based on
sudo umount /dev/nvme0n1p1
sudo mkdir -p /tmp/apple-wifi-efi
sudo mount /dev/nvme0n1p1 /tmp/apple-wifi-efi
sudo /tmp/apple-wifi-efi/firmware.sh
bash /tmp/apple-wifi-efi/firmware.sh
```

#### For those who don’t know how to run a script
Expand All @@ -55,7 +55,7 @@ If you don’t know how to run a script, follow these instructions.
2. Open the terminal and run :-

``` bash
sudo ~/Downloads/firmware.sh
bash ~/Downloads/firmware.sh
```

3. Then boot into Linux and place the same script in the **Downloads** folder over there or simply run the commands the script asked you to run in Linux when you executed it in macOS.
Expand Down
40 changes: 20 additions & 20 deletions docs/tools/firmware.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ case "$os" in
identifier=$(system_profiler SPHardwareDataType | grep "Model Identifier" | cut -d ":" -f 2 | xargs)
echo "Mounting the EFI partition"
EFILABEL=$(diskutil info disk0s1 | grep "Volume Name" | cut -d ":" -f 2 | xargs)
diskutil mount disk0s1
sudo diskutil mount disk0s1
echo "Getting Wi-Fi and Bluetooth firmware"
if [[ ${1-default} = -v ]]
then
Expand All @@ -47,9 +47,9 @@ case "$os" in
echo "Copying this script to the ESP"
cp "$0" "/Volumes/${EFILABEL}/firmware.sh"|| (echo -e "\nFailed to copy script.\nPlease copy the script manually to the EFI partition using Finder\n" && echo && read -p "Press enter after you have copied" && echo)
echo "Unmounting the EFI partition"
diskutil unmount "/Volumes/${EFILABEL}/"
sudo diskutil unmount "/Volumes/${EFILABEL}/"
echo
echo -e "Run the following commands or run this script itself in Linux now to set up Wi-Fi:\n\n mkdir -p /tmp/apple-wifi-efi\n mount /dev/nvme0n1p1 /tmp/apple-wifi-efi\n /tmp/apple-wifi-efi/firmware.sh\n"
echo -e "Run the following commands or run this script itself in Linux now to set up Wi-Fi:\n\n sudo mkdir -p /tmp/apple-wifi-efi\n sudo mount /dev/nvme0n1p1 /tmp/apple-wifi-efi\n /tmp/apple-wifi-efi/firmware.sh\n"
;;
(Linux)
echo "Detected Linux"
Expand All @@ -59,15 +59,15 @@ case "$os" in
echo "Installing Wi-Fi and Bluetooth firmware"
if [[ ${1-default} = -v ]]
then
mount -v /dev/nvme0n1p1 $mountpoint
tar --warning=no-unknown-keyword -xvC $workdir -f $mountpoint/firmware.tar.gz
sudo mount -v /dev/nvme0n1p1 $mountpoint
sudo tar --warning=no-unknown-keyword -xvC $workdir -f $mountpoint/firmware.tar.gz
python3 $0 $workdir $workdir/firmware-renamed.tar
tar -xvC /lib/firmware -f $workdir/firmware-renamed.tar
sudo tar -xvC /lib/firmware -f $workdir/firmware-renamed.tar
else
mount /dev/nvme0n1p1 $mountpoint
tar --warning=no-unknown-keyword -xC $workdir -f $mountpoint/firmware.tar.gz
sudo mount /dev/nvme0n1p1 $mountpoint
sudo tar --warning=no-unknown-keyword -xC $workdir -f $mountpoint/firmware.tar.gz
python3 $0 $workdir $workdir/firmware-renamed.tar &> /dev/null
tar -xC /lib/firmware -f $workdir/firmware-renamed.tar
sudo tar -xC /lib/firmware -f $workdir/firmware-renamed.tar
fi
echo "Installing extra firmware"
for file in "$mountpoint/brcmfmac4364b2-pcie.txt" \
Expand All @@ -77,9 +77,9 @@ case "$os" in
then
if [[ ${1-default} = -v ]]
then
cp -v $file /lib/firmware/brcm
sudo cp -v $file /lib/firmware/brcm
else
cp $file /lib/firmware/brcm
sudo cp $file /lib/firmware/brcm
fi
fi
done
Expand All @@ -96,20 +96,20 @@ case "$os" in
do
if [ -f "$file" ]
then
rm $file
sudo rm $file
fi
done
fi

umount $mountpoint
rm -r $workdir/*
rmdir $mountpoint
sudo umount $mountpoint
sudo rm -r $workdir/*
sudo rmdir $mountpoint
echo "Reloading Wi-Fi drivers"
modprobe -r brcmfmac_wcc
modprobe -r brcmfmac
modprobe brcmfmac
modprobe -r hci_bcm4377
modprobe hci_bcm4377
sudo modprobe -r brcmfmac_wcc
sudo modprobe -r brcmfmac
sudo modprobe brcmfmac
sudo modprobe -r hci_bcm4377
sudo modprobe hci_bcm4377
echo "Done!"
;;
(*)
Expand Down

0 comments on commit 91bc11f

Please sign in to comment.