-
Notifications
You must be signed in to change notification settings - Fork 172
/
update.sh
32 lines (24 loc) · 807 Bytes
/
update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# Force-set path to include sbin
PATH="$PATH:/usr/sbin"
# Set environment variables
tempfolder=~/.battery-tmp
binfolder=/usr/local/bin
batteryfolder="$tempfolder/battery"
mkdir -p $batteryfolder
echo -e "🔋 Starting battery update\n"
# Write battery function as executable
echo "[ 1 ] Downloading latest battery version"
rm -rf $batteryfolder
mkdir -p $batteryfolder
curl -sS -o $batteryfolder/battery.sh https://raw.githubusercontent.com/actuallymentor/battery/main/battery.sh
echo "[ 2 ] Writing script to $binfolder/battery"
cp $batteryfolder/battery.sh $binfolder/battery
chown $USER $binfolder/battery
chmod 755 $binfolder/battery
chmod u+x $binfolder/battery
# Remove tempfiles
cd
rm -rf $tempfolder
echo "[ 3 ] Removed temporary folder"
echo -e "\n🎉 Battery tool updated.\n"