mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
Capitalize the first letter of all log messages throughout the codebase to improve readability and consistency in logging output. Key improvements: - All log messages now start with capital letters - Consistent formatting across all logging statements - Improved readability for debugging and monitoring - Enhanced user experience with better formatted messages Files updated: - CLI commands and service management - Internal client information discovery - Network operations and configuration - DNS resolver and proxy operations - Platform-specific implementations This completes the final phase of the logging improvement project, ensuring all log messages follow consistent capitalization standards for better readability and professional appearance.
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
//go:build unix
|
|
|
|
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"os/exec"
|
|
"runtime"
|
|
"syscall"
|
|
|
|
"github.com/Control-D-Inc/ctrld"
|
|
)
|
|
|
|
// selfUninstall performs self-uninstallation on Unix platforms
|
|
func selfUninstall(p *prog, logger *ctrld.Logger) {
|
|
if runtime.GOOS == "linux" {
|
|
selfUninstallLinux(p, logger)
|
|
}
|
|
|
|
bin, err := os.Executable()
|
|
if err != nil {
|
|
logger.Fatal().Err(err).Msg("Could not determine executable")
|
|
}
|
|
args := []string{"uninstall"}
|
|
if deactivationPinSet() {
|
|
args = append(args, fmt.Sprintf("--pin=%d", cdDeactivationPin.Load()))
|
|
}
|
|
cmd := exec.Command(bin, args...)
|
|
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
|
if err := cmd.Start(); err != nil {
|
|
logger.Fatal().Err(err).Msg("Could not start self uninstall command")
|
|
}
|
|
cmd.Stdout = os.Stdout
|
|
cmd.Stderr = os.Stderr
|
|
logger.Warn().Msgf("Service was uninstalled because device %q does not exist", cdUID)
|
|
_ = cmd.Wait()
|
|
os.Exit(0)
|
|
}
|
|
|
|
// selfUninstallLinux performs self-uninstallation on Linux platforms
|
|
func selfUninstallLinux(p *prog, logger *ctrld.Logger) {
|
|
if uninstallInvalidCdUID(p, logger, true) {
|
|
logger.Warn().Msgf("Service was uninstalled because device %q does not exist", cdUID)
|
|
os.Exit(0)
|
|
}
|
|
}
|