mirror of
https://github.com/actuallymentor/battery.git
synced 2026-02-03 05:53:24 +00:00
37 lines
1.1 KiB
Bash
37 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
# Get smc source and build it
|
|
tempfolder=~/.battery-tmp
|
|
binfolder=/usr/local/bin
|
|
mkdir -p $tempfolder
|
|
|
|
smcfolder="$tempfolder/smc"
|
|
echo -e "\nCloning fan control version of smc"
|
|
git clone --depth 1 https://github.com/hholtmann/smcFanControl.git $smcfolder &> /dev/null
|
|
cd $smcfolder/smc-command
|
|
echo -e "\nMaking smc from source"
|
|
make &> /dev/null
|
|
|
|
# Move built file to bin folder
|
|
echo -e "\nMove smc to executable folder"
|
|
sudo mkdir -p $binfolder
|
|
sudo mv $smcfolder/smc-command/smc $binfolder
|
|
sudo chmod u+x $binfolder/smc
|
|
|
|
# Write battery function as executable
|
|
bateryfolder="$tempfolder/battery"
|
|
echo -e "\nCloning battery repository"
|
|
git clone --depth 1 https://github.com/actuallymentor/battery.git $bateryfolder &> /dev/null
|
|
echo "Writing script to $binfolder/battery"
|
|
sudo cp $bateryfolder/battery.sh $binfolder/battery
|
|
sudo chmod 755 $binfolder/battery
|
|
sudo chmod u+x $binfolder/battery
|
|
|
|
# Remove tempfiles
|
|
cd ../..
|
|
echo -e "\nRemoving temp folder $tempfolder"
|
|
rm -rf $tempfolder
|
|
echo -e "\nSmc binary built"
|
|
|
|
echo -e "\n🎉 Battery tool installed. Type \"battery\" for instructions."
|