Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiesun committed Jan 27, 2024
2 parents 9a9a5e9 + d928fdb commit 6394622
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ __debug_bin
/toughradius.yml
/tmp/
/log_info.log
__debug_bin*
__debug_bin*
.log
10 changes: 5 additions & 5 deletions assets/buildinfo.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
BuildVersion=latest v8.0.4 2024-01-18 15:23:34
BuildVersion=latest v8.0.4 2024-01-27 21:39:08
ReleaseVersion=v8.0.4
BuildTime=2024-01-18 15:23:34
BuildTime=2024-01-27 21:39:08
BuildName=toughradius
CommitID=48ea29e6eddf11ce25e586beee529f51e5b5e85f
CommitDate=Wed, 10 Jan 2024 01:01:19 +0800
CommitID=b67f7f938db96309ea71963e43aab88b2cc0c4d3
CommitDate=Sat, 27 Jan 2024 21:37:48 +0800
CommitUser=jamiesun.net@gmail.com
CommitSubject=2024-01-10 01:01:08 : readme
CommitSubject=add installer.sh
6 changes: 3 additions & 3 deletions docs/documents/installer.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Download the software distribution from [Releases Page](https://github.com/talki
> If you have some development skills, you can compile your own version
```
curl https://github.com/talkincode/toughradius/releases/download/v8.0.4/toughradius_x86-64 -O /tmp/toughradius
curl https://github.com/talkincode/toughradius/releases/download/v8.0.6/toughradius_amd64 -O /tmp/toughradius
chmod +x /tmp/toughradius && /tmp/toughradius -install
Expand All @@ -39,10 +39,10 @@ Before proceeding, make sure that you have created the database and that the dat
Modifying configuration file [/etc/toughradius.yml](Configuration.md)


> The following installation method will download and build the latest toughradius version (Support for v8.0.4 and later)
> The following installation method will download and build the latest toughradius version
```bash
go install github.com/talkincode/toughradius/v8@v8.0.4
go install github.com/talkincode/toughradius/v8@latest

toughradius -install
```
Expand Down
37 changes: 37 additions & 0 deletions installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# Check if Golang is installed
if command -v go &> /dev/null
then
# Check that the installed version of Golang is at least 1.21
GO_VERSION=$(go version | cut -d " " -f3)
MIN_VERSION="go1.21"

if [[ "$GO_VERSION" < "$MIN_VERSION" ]]
then
echo "Detected Go version $GO_VERSION. Upgrading to Go 1.21.6..."
wget https://go.dev/dl/go1.21.6.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.21.6.linux-amd64.tar.gz
else
echo "Detected Go version $GO_VERSION. No upgrade needed."
fi
else
echo "Go is not installed. Installing Go 1.21.6..."
wget https://go.dev/dl/go1.21.6.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.21.6.linux-amd64.tar.gz
fi

# SET GOROOT AND GOPATH
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

# Installation ToughRADIUS
echo "Installing ToughRADIUS..."
go install github.com/talkincode/toughradius/v8@latest

# Execute the ToughRADIUS installation command
echo "Running ToughRADIUS install command..."
toughradius -install

echo "ToughRADIUS installation completed."
5 changes: 4 additions & 1 deletion installer/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ func InitConfig(config *config.AppConfig) error {

func Install() error {
if !common.FileExists("/etc/toughradius.yml") {
_ = InitConfig(config.DefaultAppConfig)
err := InitConfig(config.DefaultAppConfig)
if err != nil {
return err
}
}
// Get the absolute path of the currently executing file
file, _ := exec.LookPath(os.Args[0])
Expand Down

0 comments on commit 6394622

Please sign in to comment.