Skip to content

Commit

Permalink
Small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-vannini committed Jun 29, 2017
1 parent 94a41c9 commit d6f29ed
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,19 @@ The [original code for the Pi Switch](https://www.pi-supply.com/pi-supply-switch

## Raspbian shows under-voltage warnings
The problem can be solved by using shorter, thicker USB cables. With Pi Switch we are now shipping 30cm 22AWG USB cables which solve the problem entirely.

## How do I know if the service is running properly?
Run the following command
```bash
systemctl status piswitch.service
```
which should return something like
```
● piswitch.service - Starts softshut for Pi Switch
Loaded: loaded (/etc/systemd/system/piswitch.service; enabled)
Active: active (running) since Thu 2017-06-29 09:56:13 UTC; 6min ago
Main PID: 427 (python)
CGroup: /system.slice/piswitch.service
└─427 python /opt/piswitch/softshut.py
```
22 changes: 16 additions & 6 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,30 @@ fi
if [ ! $? = 0 ]; then
exit 1
else
sudo apt-get install git whiptail #Installs packages which might be missing
apt-get install git whiptail #Installs packages which might be missing

PiSupplySwitchDir="Pi-Supply-Switch"
if [ -d "$PiSupplySwitchDir" ]; then
whiptail --title "Installation aborted" --msgbox "$PiSupplySwitchDir already exists, please remove it and restart the installation" 8 78
exit
whiptail --title "Installation aborted" --msgbox "$PiSupplySwitchDir already exists, please remove it and restart the installation" 8 78
exit
else
git clone https://github.com/PiSupply/Pi-Supply-Switch.git
fi

git clone https://github.com/PiSupply/Pi-Supply-Switch.git
mkdir /opt/piswitch

cp $PiSupplySwitchDir/softshut.py /opt/piswitch
if [ ! -f /opt/piswitch/softshut.py ]; then
whiptail --title "Installation aborted" --msgbox "There was a problem writing the softshut.py file" 8 78
exit
fi
cp $PiSupplySwitchDir/piswitch.service /etc/systemd/system
if [ ! -f /etc/systemd/system/piswitch.service ]; then
whiptail --title "Installation aborted" --msgbox "There was a problem writing the piswitch.service file" 8 78
exit
fi

systemctl enable /etc/systemd/system/piswitch.service
systemctl start piswitch.service
whiptail --title "Installation complete" --msgbox "Pi Switch installation complete. Please reboot your Raspberry Pi now." 8 78
whiptail --title "Installation complete" --msgbox "Pi Switch installation complete. The system will power off." 8 78
poweroff
fi
3 changes: 1 addition & 2 deletions uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ else
rm /opt/piswitch -d
rm /etc/systemd/system/piswitch.service

whiptail --title "Uninstall complete" --msgbox "Pi Switch uninstall complete. You are safe to remove the folder Pi-Supply-Switch." 8 78
whiptail --title "Uninstall complete" --msgbox "Pi Switch uninstall complete.\nYou are safe to remove the folder Pi-Supply-Switch." 8 78
fi

0 comments on commit d6f29ed

Please sign in to comment.