Merge pull request #1293 from openoms/go-uninstall

add Go uninstall option
This commit is contained in:
Christian Rotzoll 2020-06-26 13:35:07 +02:00 committed by GitHub
commit e4a987f402
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 99 additions and 65 deletions

View file

@ -1,5 +1,22 @@
#!/bin/bash #!/bin/bash
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "config script to install Go"
echo "bonus.go.sh [on|off]"
exit 1
fi
source /mnt/hdd/raspiblitz.conf
# add default value to raspi config if needed
if ! grep -Eq "^golang=" /mnt/hdd/raspiblitz.conf; then
echo "golang=off" >> /mnt/hdd/raspiblitz.conf
fi
# switch on
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
# set version, check: https://github.com/golang/go/releases # set version, check: https://github.com/golang/go/releases
goVersion="1.13.3" goVersion="1.13.3"
@ -71,6 +88,23 @@ if [ ${correctGoVersion} -eq 0 ]; then
echo "" echo ""
fi fi
# setting value in raspi blitz config
sudo sed -i "s/^golang=.*/golang=on/g" /mnt/hdd/raspiblitz.conf
echo "" echo ""
echo "Installed $(go version)" echo "Installed $(go version)"
echo "" echo ""
exit 0
fi
# switch off
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
# setting value in raspiblitz config
sudo sed -i "s/^golang=.*/golang=off/g" /mnt/hdd/raspiblitz.conf
echo "*** REMOVING GO ***"
sudo rm -rf /usr/local/go
echo "OK Go removed."
exit 0
fi
echo "FAIL - Unknown Parameter $1"
exit 1

View file

@ -33,7 +33,7 @@ isInstalled=$(lndconnect -h 2>/dev/null | grep "nocert" -c)
if [ $isInstalled -eq 0 ] || [ "$1" == "update" ]; then if [ $isInstalled -eq 0 ] || [ "$1" == "update" ]; then
echo "# Installing lndconnect.." echo "# Installing lndconnect.."
# make sure Go is installed # make sure Go is installed
/home/admin/config.scripts/bonus.go.sh /home/admin/config.scripts/bonus.go.sh on
# get Go vars # get Go vars
source /etc/profile source /etc/profile
# Install latest lndconnect from source: # Install latest lndconnect from source:

View file

@ -33,7 +33,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
isInstalled=$(sudo ls /etc/systemd/system/loopd.service 2>/dev/null | grep -c 'loopd.service') isInstalled=$(sudo ls /etc/systemd/system/loopd.service 2>/dev/null | grep -c 'loopd.service')
if [ ${isInstalled} -eq 0 ]; then if [ ${isInstalled} -eq 0 ]; then
/home/admin/config.scripts/bonus.go.sh /home/admin/config.scripts/bonus.go.sh on
# get Go vars # get Go vars
source /etc/profile source /etc/profile

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# command info # command info
if [ "$1" = "-h" ] || [ "$1" = "-help" ]; then if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "small config script to install NodeJs" echo "small config script to install NodeJs"
echo "bonus.nodejs.sh [on|off]" echo "bonus.nodejs.sh [on|off]"
exit 1 exit 1