Skip to content

Commit

Permalink
Remove root privileges (Fix #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
ish-hcc committed Jul 3, 2024
1 parent 116589d commit 697d589
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ windows: lint swag ## Build the binary file for Windows
@echo Build finished!

run: ## Run the built binary
@sudo killall ${MODULE_NAME} | true
@killall ${MODULE_NAME} | true
@git diff > .diff_current
@STATUS=`diff .diff_last_build .diff_current 2>&1 > /dev/null; echo $$?` && \
GIT_HASH_MINE=`git rev-parse HEAD` && \
Expand All @@ -116,7 +116,7 @@ run: ## Run the built binary
if [[ $$kernel_name == "CYGWIN"* ]] || [[ $$kernel_name == "MINGW"* ]]; then \
./cmd/${MODULE_NAME}/${MODULE_NAME}.exe & \
else \
./cmd/${MODULE_NAME}/${MODULE_NAME} || echo "Trying with sudo..." && sudo ./cmd/${MODULE_NAME}/${MODULE_NAME} & \
./cmd/${MODULE_NAME}/${MODULE_NAME} & \
fi

run_docker: ## Run the built binary within Docker
Expand All @@ -131,7 +131,7 @@ run_docker: ## Run the built binary within Docker
@docker compose up -d

stop: ## Stop the built binary
@sudo killall ${MODULE_NAME} | true
@killall ${MODULE_NAME} | true

stop_docker: ## Stop the Docker container
@docker compose down
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Software Migration framework (codename: cm-grasshopper) is going to support:

3. Run with privileges
```shell
sudo ./cm-grasshopper
./cm-grasshopper
```
#### Download source code

Expand Down
8 changes: 1 addition & 7 deletions cmd/cm-grasshopper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/cloud-barista/cm-grasshopper/pkg/api/rest/controller"
"github.com/cloud-barista/cm-grasshopper/pkg/api/rest/server"
"github.com/jollaman999/utils/logger"
"github.com/jollaman999/utils/syscheck"
"log"
"os"
"os/signal"
Expand All @@ -17,12 +16,7 @@ import (
)

func init() {
err := syscheck.CheckRoot()
if err != nil {
log.Fatalln(err)
}

err = config.PrepareConfigs()
err := config.PrepareConfigs()
if err != nil {
log.Fatalln(err)
}
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/opencontainers/selinux v1.11.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/sftp v1.13.6 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ github.com/melbahja/goph v1.4.0 h1:z0PgDbBFe66lRYl3v5dGb9aFgPy0kotuQ37QOwSQFqs=
github.com/melbahja/goph v1.4.0/go.mod h1:uG+VfK2Dlhk+O32zFrRlc3kYKTlV6+BtvPWd/kK7U68=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaLpt7tQ7oU=
github.com/opencontainers/selinux v1.11.0/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/sftp v1.13.5/go.mod h1:wHDZ0IZX6JcBYRK1TH9bcVq8G7TLpVHYIGJRFnmPfxg=
Expand Down

0 comments on commit 697d589

Please sign in to comment.