mirror of
https://github.com/actuallymentor/battery.git
synced 2026-02-03 14:03:24 +00:00
✨ Prettier setup
This commit is contained in:
22
setup.sh
22
setup.sh
@@ -2,12 +2,12 @@
|
||||
|
||||
# User welcome message
|
||||
echo -e "\n####################################################################"
|
||||
echo '👋 Welcome, this is the setup script for the battery CLI tool.'
|
||||
echo -e "Note: this script will ask for your password once or multiple times."
|
||||
echo '# 👋 Welcome, this is the setup script for the battery CLI tool.'
|
||||
echo -e "# Note: this script will ask for your password once or multiple times."
|
||||
echo -e "####################################################################\n\n"
|
||||
|
||||
# Ask for sudo once, in most systems this will cache the permissions for a bit
|
||||
sudo echo "Superuser permissions acquired."
|
||||
sudo echo "[ 1/8 ] Superuser permissions acquired."
|
||||
|
||||
# Get smc source and build it
|
||||
tempfolder=~/.battery-tmp
|
||||
@@ -15,31 +15,31 @@ binfolder=/usr/local/bin
|
||||
mkdir -p $tempfolder
|
||||
|
||||
smcfolder="$tempfolder/smc"
|
||||
echo "Cloning fan control version of smc"
|
||||
echo "[ 2/8 ] Cloning fan control version of smc"
|
||||
git clone --depth 1 https://github.com/hholtmann/smcFanControl.git $smcfolder &> /dev/null
|
||||
cd $smcfolder/smc-command
|
||||
echo "Making smc from source"
|
||||
echo "[ 3/8 ] Building smc from source"
|
||||
make &> /dev/null
|
||||
|
||||
# Move built file to bin folder
|
||||
echo "Move smc to executable folder"
|
||||
echo "[ 4/8 ] Move 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 "Cloning battery repository"
|
||||
echo "[ 5/8 ] Cloning battery repository"
|
||||
git clone --depth 1 https://github.com/actuallymentor/battery.git $bateryfolder &> /dev/null
|
||||
echo "Writing script to $binfolder/battery"
|
||||
echo "[ 6/8 ] 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 "Removing temp folder $tempfolder"
|
||||
echo "[ 7/8 ] Removing temp folder $tempfolder"
|
||||
rm -rf $tempfolder
|
||||
echo "Smc binary built"
|
||||
echo "[ 8/8 ] Removed temporary build files"
|
||||
|
||||
echo -e "\n🎉 Battery tool installed. Type \"battery\" for instructions."
|
||||
echo -e "\n🎉 Battery tool installed. Type \"battery\" for instructions.\n"
|
||||
|
||||
Reference in New Issue
Block a user