Skip to content

Commit

Permalink
Prevent unnecessary use of sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaGarg8 authored May 23, 2024
1 parent 3f66fc4 commit 519098b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/tools/firmware.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,24 @@ create_deb () {
cp ${verbose} /usr/share/firmware/wifi/C-4364__s-B2/${txcapblob} "usr/lib/firmware/brcm/brcmfmac4364b2-pcie.txcap_blob"
fi

cat <<- EOF | sudo tee DEBIAN/control >/dev/null
cat <<- EOF > DEBIAN/control
Package: apple-firmware
Version: ${ver}-1
Maintainer: Apple
Architecture: all
Description: Wi-Fi and Bluetooth firmware for T2 Macs
EOF

cat <<- EOF | sudo tee DEBIAN/postinst >/dev/null
cat <<- EOF > DEBIAN/postinst
modprobe -r brcmfmac_wcc || true
modprobe -r brcmfmac || true
modprobe brcmfmac || true
modprobe -r hci_bcm4377 || true
modprobe hci_bcm4377 || true
EOF

sudo chmod a+x DEBIAN/control
sudo chmod a+x DEBIAN/postinst
chmod a+x DEBIAN/control
chmod a+x DEBIAN/postinst

cd ${workarea}
if [[ ${verbose} = -v ]]
Expand All @@ -100,7 +100,7 @@ create_deb () {

cp ${verbose} apple-firmware_${ver}-1_all.deb $HOME/Downloads
echo -e "\nCleaning up"
sudo rm -r ${verbose} ${workarea}
rm -r ${verbose} ${workarea}

echo -e "\nDeb package apple-firmware_${ver}-1_all.deb has been saved to Downloads!"
echo "Copy it to Linux and install it by running the following in the Linux terminal:"
Expand Down Expand Up @@ -216,7 +216,7 @@ create_arch_pkg () {
fi

# Create the PKGBUILD
cat <<- EOF | sudo tee PKGBUILD >/dev/null
cat <<- EOF > PKGBUILD
pkgname=apple-firmware
pkgver=${ver}
pkgrel=1
Expand All @@ -238,7 +238,7 @@ create_arch_pkg () {
install=apple-firmware.install
EOF

cat <<- EOF | sudo tee apple-firmware.install >/dev/null
cat <<- EOF > apple-firmware.install
post_install() {
modprobe -r brcmfmac_wcc || true
modprobe -r brcmfmac || true
Expand Down Expand Up @@ -266,7 +266,7 @@ create_arch_pkg () {
# Copy to Downloads and cleanup
cp ${verbose} apple-firmware-${ver}-1-any.pkg.tar.zst $HOME/Downloads
echo -e "\nCleaning up"
sudo rm -r ${verbose} ${workarea}
rm -r ${verbose} ${workarea}

echo -e "\nArch package apple-firmware-${ver}-1-any.pkg.tar.zst has been saved to Downloads!"
echo "Copy it to Linux and install it by running the following in the Linux terminal:"
Expand Down

0 comments on commit 519098b

Please sign in to comment.