Browse Source

Removed dead/old code.

Steve Thielemann 4 days ago
parent
commit
57fa847a62
1 changed files with 5 additions and 38 deletions
  1. 5 38
      aptgrade.go

+ 5 - 38
aptgrade.go

@@ -14,6 +14,8 @@ import (
 /*
 NOTES:
 
+* apt detected it wasn't connected to a TTY, so it said on stderr,
+  WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
 * All packages are up to date.  <- This isn't seen when using `apt-get update`, only apt.
 * We don't see the warning about "apt does not have a stable CLI interface." when using apt-get.
 * I can't seem to reproduce the output error (where apt is reading the database and showing
@@ -28,8 +30,6 @@ type CheckResult struct {
 	AutoRemove bool // Use 'apt autoremove' to remove it.
 }
 
-const DEBUG_OUTPUT = false
-
 // Check the output for CheckResult conditions.
 func check_lines(r io.Reader, output chan CheckResult) {
 	scanner := bufio.NewScanner(r)
@@ -58,12 +58,6 @@ func check_lines(r io.Reader, output chan CheckResult) {
 	output <- result
 }
 
-/*
-apt detected it wasn't connected to a TTY, so it said on stderr:
-
-WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
-*/
-
 // Run the given command, showing output, checking output.
 func run_check_command(command []string, debug_output bool) (CheckResult, error) {
 	var result CheckResult
@@ -132,38 +126,11 @@ func run_check_command(command []string, debug_output bool) (CheckResult, error)
 	return value, err
 }
 
-/*
-// Run the given command, showing output.
-func run_command(command []string) error {
-	fmt.Println(strings.Repeat("=", 64))
-	fmt.Println(command)
-	cmd := exec.Command(command[0], command[1:]...)
-	// Connections
-	cmd.Stdout = os.Stdout
-	cmd.Stderr = os.Stderr
-	cmd.Stdin = os.Stdin
-
-	// cmd.Env = append(os.Environ(), "DEBIAN_FRONTEND=noninteractive")
-
-	cmd.SysProcAttr = &syscall.SysProcAttr{}
-	cmd.SysProcAttr.Credential = &syscall.Credential{Uid: 0, Gid: 0}
-	err := cmd.Run()
-	fmt.Println(strings.Repeat("=", 50))
-	if err != nil {
-		fmt.Println("Did you forget to:")
-		fmt.Println("  sudo chown root:root aptgrade")
-		fmt.Println("  sudo chmod a+s aptgrade")
-		fmt.Println("Command failed:", err)
-	}
-	return err
-}
-*/
-
-// const APT_CMD = "/usr/bin/apt"
-const APT_CMD = "/usr/bin/apt-get"
+// const APT = "/usr/bin/apt"
+const APT = "/usr/bin/apt-get"
 
 func main() {
-	const APT = APT_CMD
+	// const APT = APT_CMD
 	var show bool
 	flag.BoolVar(&show, "show", false, "Show run results.")