Add more commands to PATH
This commit is contained in:
7
btpl.sh
7
btpl.sh
@@ -1,2 +1,9 @@
|
|||||||
#/bin/sh
|
#/bin/sh
|
||||||
|
if [ $# \< 2 ]
|
||||||
|
then
|
||||||
python3 ~/.bluetooth-proximity-locking/btpl.py [bluetooth address] > /dev/null &
|
python3 ~/.bluetooth-proximity-locking/btpl.py [bluetooth address] > /dev/null &
|
||||||
|
elif [ "$1" = "-r" ] || [ "$1" = "--run" ]
|
||||||
|
python3 ~/.bluetooth-proximity-locking/btpl.py [bluetooth address] > /dev/null &
|
||||||
|
elif [ "$1" = "-s" ] || [ "$1" = "--stop" ]
|
||||||
|
pkill ~/.bluetooth-proximity-locking/btpl.py
|
||||||
|
fi
|
||||||
|
|||||||
3
config
3
config
@@ -57,7 +57,8 @@ chmod +x btpl.sh reconfigure
|
|||||||
mkdir ~/.bluetooth-proximity-locking > /dev/null 2>&1
|
mkdir ~/.bluetooth-proximity-locking > /dev/null 2>&1
|
||||||
mkdir bin > /dev/null 2>&1
|
mkdir bin > /dev/null 2>&1
|
||||||
mv btpl.sh bin/btpl > /dev/null 2>&1
|
mv btpl.sh bin/btpl > /dev/null 2>&1
|
||||||
# add command 'btpl' to PATH
|
mv reconfigure bin/btpl-reconfig > /dev/null 2>&1
|
||||||
|
# add commands 'btpl' and 'btpl-reconfig' to PATH
|
||||||
if ! grep -Fq 'export PATH=$PATH":$HOME/.bluetooth-proximity-locking/bin"' ~/.profile
|
if ! grep -Fq 'export PATH=$PATH":$HOME/.bluetooth-proximity-locking/bin"' ~/.profile
|
||||||
then
|
then
|
||||||
echo 'export PATH=$PATH":$HOME/.bluetooth-proximity-locking/bin"' >> ~/.profile
|
echo 'export PATH=$PATH":$HOME/.bluetooth-proximity-locking/bin"' >> ~/.profile
|
||||||
|
|||||||
17
reconfigure
17
reconfigure
@@ -13,43 +13,48 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# set user-specific config options, if arguments aren't "x"
|
# set user-specific config options, if arguments aren't "x"
|
||||||
|
if [ "$2" != "x" ]
|
||||||
|
then
|
||||||
sed -i "s/\[bluetooth address\]/$1/g" ~/.bluetooth-proximity-locking/btpl.sh
|
sed -i "s/\[bluetooth address\]/$1/g" ~/.bluetooth-proximity-locking/btpl.sh
|
||||||
echo -e "\033[1;32m[OK]\033[0m Bluetooth address set"
|
echo -e "\033[1;32m[OK]\033[0m Bluetooth address set"
|
||||||
|
else
|
||||||
|
echo -e "\033[1;32m[OK]\033[0m Bluetooth address left as before"
|
||||||
|
fi
|
||||||
if [ "$2" != "x" ]
|
if [ "$2" != "x" ]
|
||||||
then
|
then
|
||||||
sed -i "s/scanPeriod = 2.5/scanPeriod = $2/g" ~/.bluetooth-proximity-locking/btpl.py
|
sed -i "s/scanPeriod = 2.5/scanPeriod = $2/g" ~/.bluetooth-proximity-locking/btpl.py
|
||||||
echo -e "\033[1;32m[OK]\033[0m Scan period set"
|
echo -e "\033[1;32m[OK]\033[0m Scan period set"
|
||||||
else
|
else
|
||||||
echo -e "\033[1;32m[OK]\033[0m Scan period left as default"
|
echo -e "\033[1;32m[OK]\033[0m Scan period left as before"
|
||||||
fi
|
fi
|
||||||
if [ "$3" != "x" ]
|
if [ "$3" != "x" ]
|
||||||
then
|
then
|
||||||
sed -i "s/leftRange = \"gnome-screensaver-command -l\"/leftRange = $3/g" ~/.bluetooth-proximity-locking/btpl.py
|
sed -i "s/leftRange = \"gnome-screensaver-command -l\"/leftRange = $3/g" ~/.bluetooth-proximity-locking/btpl.py
|
||||||
echo -e "\033[1;32m[OK]\033[0m Left range command set"
|
echo -e "\033[1;32m[OK]\033[0m Left range command set"
|
||||||
else
|
else
|
||||||
echo -e "\033[1;32m[OK]\033[0m Left range command left as default"
|
echo -e "\033[1;32m[OK]\033[0m Left range command left as before"
|
||||||
fi
|
fi
|
||||||
if [ "$4" != "x" ]
|
if [ "$4" != "x" ]
|
||||||
then
|
then
|
||||||
sed -i "s/enteredRange = \"gnome-screensaver-command -d\"/enteredRange = $4/g" ~/.bluetooth-proximity-locking/btpl.py
|
sed -i "s/enteredRange = \"gnome-screensaver-command -d\"/enteredRange = $4/g" ~/.bluetooth-proximity-locking/btpl.py
|
||||||
echo -e "\033[1;32m[OK]\033[0m Entered range command set"
|
echo -e "\033[1;32m[OK]\033[0m Entered range command set"
|
||||||
else
|
else
|
||||||
echo -e "\033[1;32m[OK]\033[0m Entered range command left as default"
|
echo -e "\033[1;32m[OK]\033[0m Entered range command left as before"
|
||||||
fi
|
fi
|
||||||
if [ "$5" != "x" ]
|
if [ "$5" != "x" ]
|
||||||
then
|
then
|
||||||
sed -i "s/maxMissed = 3/maxMissed = $5/g" ~/.bluetooth-proximity-locking/btpl.py
|
sed -i "s/maxMissed = 3/maxMissed = $5/g" ~/.bluetooth-proximity-locking/btpl.py
|
||||||
echo -e "\033[1;32m[OK]\033[0m Maximum missed set"
|
echo -e "\033[1;32m[OK]\033[0m Maximum missed set"
|
||||||
else
|
else
|
||||||
echo -e "\033[1;32m[OK]\033[0m Maximum missed left as default"
|
echo -e "\033[1;32m[OK]\033[0m Maximum missed left as before"
|
||||||
fi
|
fi
|
||||||
if [ "$6" != "x" ]
|
if [ "$6" != "x" ]
|
||||||
then
|
then
|
||||||
sed -i "s/rangeLimit = 7/rangeLimit = $6/g" ~/.bluetooth-proximity-locking/btpl.py
|
sed -i "s/rangeLimit = 7/rangeLimit = $6/g" ~/.bluetooth-proximity-locking/btpl.py
|
||||||
echo -e "\033[1;32m[OK]\033[0m Range limit set"
|
echo -e "\033[1;32m[OK]\033[0m Range limit set"
|
||||||
else
|
else
|
||||||
echo -e "\033[1;32m[OK]\033[0m Range limit left as default"
|
echo -e "\033[1;32m[OK]\033[0m Range limit left as before"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# display final success message
|
# display final success message
|
||||||
echo -e "\033[1;32m[OK]\033[0m Bluetooth Proximity Locking configured successfully"
|
echo -e "\033[1;32m[OK]\033[0m Bluetooth Proximity Locking reconfigured successfully"
|
||||||
|
|||||||
Reference in New Issue
Block a user