2024-01-04 13:08:32 -07:00
package packagemanager
2024-01-04 08:58:20 -07:00
2024-01-04 09:49:03 -07:00
// This package is responsible for handling our actual install logic. We could have probably gotten away with
// implementing this into the packagemanager package, but this seems like a better way
// because this provides a single interface for all our install functions
2024-01-04 08:58:20 -07:00
import (
2024-01-04 13:08:32 -07:00
"fmt"
2024-01-08 15:18:41 -07:00
"time"
2024-01-04 08:58:20 -07:00
"os"
"os/exec"
"os/user"
2024-01-07 17:30:30 -07:00
"strings"
2024-01-04 08:58:20 -07:00
"path/filepath"
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
"pixelridgesoftworks.com/AllPac/pkg/logger"
2024-01-04 08:58:20 -07:00
)
2024-01-08 14:30:51 -07:00
// installs a package using Pacman and logs the installation
2024-01-04 13:08:32 -07:00
func InstallPackagePacman ( packageName string ) error {
2024-01-08 14:30:51 -07:00
cmd := exec . Command ( "sudo" , "pacman" , "-Syu" , "--noconfirm" , packageName )
2024-01-04 13:08:32 -07:00
if output , err := cmd . CombinedOutput ( ) ; err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error installing package with Pacman: %s, %v" , output , err )
2024-01-04 13:08:32 -07:00
return fmt . Errorf ( "error installing package with Pacman: %s, %v" , output , err )
2024-01-04 09:49:03 -07:00
}
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
version , err := GetPacmanPackageVersion ( packageName )
2024-01-04 09:49:03 -07:00
if err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "An error has occured:" , err )
2024-01-04 09:49:03 -07:00
return err
}
2024-01-04 13:08:32 -07:00
if err := LogInstallation ( packageName , "pacman" , version ) ; err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error logging installation: %v" , err )
2024-01-04 09:49:03 -07:00
return fmt . Errorf ( "error logging installation: %v" , err )
2024-01-04 08:58:20 -07:00
}
return nil
}
2024-01-08 14:30:51 -07:00
// installs a package using Snap and logs the installation
2024-01-04 08:58:20 -07:00
func InstallPackageSnap ( packageName string ) error {
cmd := exec . Command ( "sudo" , "snap" , "install" , packageName )
2024-01-07 17:30:30 -07:00
output , err := cmd . CombinedOutput ( )
if err != nil {
outputStr := string ( output )
logger . Errorf ( "error installing package with Snap: %s, %v" , outputStr , err )
// Check if the error is due to the need for classic confinement
if strings . Contains ( outputStr , "using classic" ) {
fmt . Println ( "This package requires installation in classic mode, which may perform arbitrary system changes outside of the security sandbox. Do you want to proceed? (yes/no)" )
var response string
fmt . Scanln ( & response )
if strings . ToLower ( response ) == "yes" {
// Retry installation with --classic flag
classicCmd := exec . Command ( "sudo" , "snap" , "install" , "--classic" , packageName )
if classicOutput , classicErr := classicCmd . CombinedOutput ( ) ; classicErr != nil {
logger . Errorf ( "error installing package with Snap in classic mode: %s, %v" , classicOutput , classicErr )
return fmt . Errorf ( "error installing package with Snap in classic mode: %s, %v" , classicOutput , classicErr )
}
} else {
return fmt . Errorf ( "installation aborted by user" )
}
} else {
return fmt . Errorf ( "error installing package with Snap: %s, %v" , outputStr , err )
}
2024-01-04 08:58:20 -07:00
}
2024-01-04 13:08:32 -07:00
version , err := GetVersionFromSnap ( packageName )
if err != nil {
2024-01-07 17:30:30 -07:00
logger . Errorf ( "An error has occurred:" , err )
2024-01-04 13:08:32 -07:00
return err
}
if err := LogInstallation ( packageName , "snap" , version ) ; err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error logging installation: %v" , err )
2024-01-04 09:49:03 -07:00
return fmt . Errorf ( "error logging installation: %v" , err )
}
2024-01-04 08:58:20 -07:00
return nil
}
2024-01-08 14:30:51 -07:00
// installs a package using Flatpak and logs the installation
2024-01-04 08:58:20 -07:00
func InstallPackageFlatpak ( packageName string ) error {
cmd := exec . Command ( "flatpak" , "install" , "-y" , packageName )
if output , err := cmd . CombinedOutput ( ) ; err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error installing package with Flatpak: %s, %v" , output , err )
2024-01-04 08:58:20 -07:00
return fmt . Errorf ( "error installing package with Flatpak: %s, %v" , output , err )
}
2024-01-04 13:08:32 -07:00
version , err := GetVersionFromFlatpak ( packageName )
if err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "An error has occured:" , err )
2024-01-04 13:08:32 -07:00
return err
}
if err := LogInstallation ( packageName , "flatpak" , version ) ; err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error logging installation: %v" , err )
2024-01-04 09:49:03 -07:00
return fmt . Errorf ( "error logging installation: %v" , err )
2024-01-04 08:58:20 -07:00
}
return nil
}
2024-01-08 14:30:51 -07:00
// clones the given AUR repository and installs it
2024-01-04 13:08:32 -07:00
func CloneAndInstallFromAUR ( repoURL string , skipConfirmation bool ) ( string , error ) {
2024-01-08 14:30:51 -07:00
// System update
if ! skipConfirmation && ! confirmAction ( "Do you want to update the system before proceeding? (skipping this step may result in partial updates, and break your system)" ) {
logger . Warnf ( "user aborted the system update" )
return "" , fmt . Errorf ( "user aborted the system update" )
2024-01-04 13:08:32 -07:00
}
2024-01-08 14:30:51 -07:00
cmdUpdate := exec . Command ( "sudo" , "pacman" , "-Syu" , "--noconfirm" )
if output , err := cmdUpdate . CombinedOutput ( ) ; err != nil {
logger . Errorf ( "error updating system: %s, %v" , output , err )
return "" , fmt . Errorf ( "error updating system: %s, %v" , output , err )
}
2024-01-04 13:08:32 -07:00
// Confirm before proceeding with each step
if ! skipConfirmation && ! confirmAction ( "Do you want to download and build package from " + repoURL + "?" ) {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Warnf ( "user aborted the action" )
2024-01-04 13:08:32 -07:00
return "" , fmt . Errorf ( "user aborted the action" )
}
2024-01-08 15:18:41 -07:00
2024-01-04 08:58:20 -07:00
// Get the current user's home directory
usr , err := user . Current ( )
if err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error getting current user: %v" , err )
2024-01-04 13:08:32 -07:00
return "" , fmt . Errorf ( "error getting current user: %v" , err )
2024-01-04 08:58:20 -07:00
}
2024-01-08 15:18:41 -07:00
// Determine the name of the package from the repo URL
repoName := filepath . Base ( repoURL )
// Remove .git suffix
repoName = strings . TrimSuffix ( repoName , ".git" )
// Get the current date in YYYYMMDD format
currentDate := time . Now ( ) . Format ( "20060102" )
// Define the directory for this specific package clone
cloneDir := filepath . Join ( usr . HomeDir , ".allpac" , "cache" , repoName + "-" + currentDate )
// Ensure the clone directory exists
if err := os . MkdirAll ( cloneDir , 0755 ) ; err != nil {
logger . Errorf ( "error creating clone directory: %v" , err )
return "" , fmt . Errorf ( "error creating clone directory: %v" , err )
}
2024-01-04 08:58:20 -07:00
// Define the base directory for AllPac cache
baseDir := filepath . Join ( usr . HomeDir , ".allpac" , "cache" )
// Ensure the base directory exists
if err := os . MkdirAll ( baseDir , 0755 ) ; err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error creating base directory: %v" , err )
2024-01-04 13:08:32 -07:00
return "" , fmt . Errorf ( "error creating base directory: %v" , err )
2024-01-04 08:58:20 -07:00
}
// Clone the repository
2024-01-08 15:18:41 -07:00
cmdGitClone := exec . Command ( "git" , "clone" , repoURL , cloneDir )
2024-01-04 08:58:20 -07:00
if output , err := cmdGitClone . CombinedOutput ( ) ; err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error cloning AUR repo: %s, %v" , output , err )
2024-01-04 13:08:32 -07:00
return "" , fmt . Errorf ( "error cloning AUR repo: %s, %v" , output , err )
2024-01-04 08:58:20 -07:00
}
// Change directory to the cloned repository
2024-01-08 15:18:41 -07:00
if err := os . Chdir ( cloneDir ) ; err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error changing directory: %v" , err )
2024-01-04 13:08:32 -07:00
return "" , fmt . Errorf ( "error changing directory: %v" , err )
2024-01-04 08:58:20 -07:00
}
2024-01-08 15:24:05 -07:00
// Build the package using makepkg as the non-root user
2024-01-08 15:32:43 -07:00
cmdMakePkg := exec . Command ( "makepkg" , "-si" , "--noconfirm" )
2024-01-08 15:37:27 -07:00
cmdMakePkg . Env = [ ] string { "PATH=" + os . Getenv ( "PATH" ) }
2024-01-04 08:58:20 -07:00
if output , err := cmdMakePkg . CombinedOutput ( ) ; err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error building package with makepkg: %s, %v" , output , err )
2024-01-04 13:08:32 -07:00
return "" , fmt . Errorf ( "error building package with makepkg: %s, %v" , output , err )
2024-01-04 08:58:20 -07:00
}
2024-01-04 13:08:32 -07:00
// Extract the version from PKGBUILD
2024-01-08 15:18:41 -07:00
version , err := ExtractVersionFromPKGBUILD ( cloneDir )
2024-01-04 13:08:32 -07:00
if err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error extracting version from PKGBUILD: %v" , err )
2024-01-04 13:08:32 -07:00
return "" , fmt . Errorf ( "error extracting version from PKGBUILD: %v" , err )
2024-01-04 09:49:03 -07:00
}
2024-01-04 13:08:32 -07:00
// Confirm before installing
if ! skipConfirmation && ! confirmAction ( "Do you want to install the built package " + repoName + "?" ) {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Warnf ( "user aborted the installation" )
2024-01-04 13:08:32 -07:00
return "" , fmt . Errorf ( "user aborted the installation" )
}
if err := LogInstallation ( repoName , "aur" , version ) ; err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error logging installation" )
2024-01-04 13:08:32 -07:00
return "" , fmt . Errorf ( "error logging installation: %v" , err )
}
return version , nil
2024-01-04 09:49:03 -07:00
}
2024-01-08 14:30:51 -07:00
// installs Snap manually from the AUR
2024-01-04 09:49:03 -07:00
func InstallSnap ( ) error {
2024-01-04 13:08:32 -07:00
version , err := CloneAndInstallFromAUR ( "https://aur.archlinux.org/snapd.git" , true )
if err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error installing Snap: %v" , err )
2024-01-04 09:49:03 -07:00
return fmt . Errorf ( "error installing Snap: %v" , err )
}
2024-01-04 13:08:32 -07:00
if err := LogInstallation ( "snapd" , "aur" , version ) ; err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error logging installation" )
2024-01-04 09:49:03 -07:00
return fmt . Errorf ( "error logging installation: %v" , err )
}
return nil
}
2024-01-08 14:30:51 -07:00
// installs Git using Pacman
2024-01-04 09:49:03 -07:00
func InstallGit ( ) error {
if err := InstallPackagePacman ( "git" ) ; err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error installing Git: %v" , err )
2024-01-04 09:49:03 -07:00
return fmt . Errorf ( "error installing Git: %v" , err )
}
return nil
}
2024-01-08 14:30:51 -07:00
// installs the base-devel group using Pacman
2024-01-04 09:49:03 -07:00
func InstallBaseDevel ( ) error {
if err := InstallPackagePacman ( "base-devel" ) ; err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error installing base-devel: %v" , err )
2024-01-04 09:49:03 -07:00
return fmt . Errorf ( "error installing base-devel: %v" , err )
}
return nil
}
2024-01-08 14:30:51 -07:00
// installs the Flatpak package using Pacman
2024-01-04 09:49:03 -07:00
func InstallFlatpak ( ) error {
if err := InstallPackagePacman ( "flatpak" ) ; err != nil {
Major update 4
This should be the final code update before we start testing things.
I think all the code is now in place to have the program function, barring any bugs in my code.
So, with that said, here's the changelog:
global changes:
```
- implement logger.go across the whole program
```
changes to main.go:
```
- add an import for strings
- implement the roughed in handling functions
```
changes to logger.go:
```
- create this little helper package to just handle all our logging nice and gracefully
```
changes to all_updater.go:
```
- basically completely redone. Accomplishes the same thing, just in a different, more efficient way.
```
changes to aur.go:
```
- add a function to clear the AllPac build cache for aur
```
changes to install.go:
```
- removed a duplicate function, set install.go to call the right one
```
changes to pacman.go:
```
- removed GetVersionFromPacman function (it shouldn't be here, it should be in search.go)
```
changes to search.go:
```
- add functions for getting info from, and parsing output from Snap, Pacman, Flatpak, and aur
```
2024-01-04 19:17:43 -07:00
logger . Errorf ( "error installing flatpak: %v" , err )
2024-01-04 09:49:03 -07:00
return fmt . Errorf ( "error installing flatpak: %v" , err )
}
2024-01-04 08:58:20 -07:00
return nil
}