fix: rsync install check

chore: update logs
This commit is contained in:
2024-12-24 01:42:38 +02:00
parent d1f3de3d8c
commit 72002ebae8
3 changed files with 16 additions and 16 deletions

View File

@@ -83,38 +83,38 @@ func GetCurrentPlatform() appconfig.Platform {
func RunInstaller(config *appconfig.AppConfig, installer IInstaller) error {
info := installer.GetInfo()
name := *info.Name
logger.Debug("Checking if %s should run on %s", name, GetCurrentPlatform())
logger.Debug("Checking if %s (%s) should run on %s", name, info.Type, GetCurrentPlatform())
curOS := GetCurrentPlatform()
if !GetShouldRunOnOS(installer, curOS) {
logger.Debug("%s should not run on %s, skipping", name, curOS)
return nil
}
logger.Debug("Checking if %s is installed", name)
logger.Debug("Checking if %s (%s) is installed", name, info.Type)
err, installed := installer.CheckIsInstalled()
if err != nil {
return err
}
if installed {
logger.Debug("%s is already installed", name)
logger.Debug("%s (%s) is already installed", name, info.Type)
if config.CheckUpdates {
logger.Info("Checking if %s needs an update", name)
logger.Info("Checking updates for %s (%s)", name, info.Type)
err, needsUpdate := installer.CheckNeedsUpdate()
if err != nil {
return err
}
if needsUpdate {
logger.Info("%s has an update", name)
logger.Info("%s (%s) has an update", name, info.Type)
if info.PreUpdate != nil {
logger.Debug("Running pre-update command for %s", name)
logger.Debug("Running pre-update command for %s (%s)", name, info.Type)
err := utils.RunCmdPassThrough("sh", "-c", *info.PreUpdate)
if err != nil {
return err
}
}
logger.Debug("Running update for %s", name)
logger.Debug("Running update for %s (%s)", name, info.Type)
installer.Update()
if info.PostUpdate != nil {
logger.Debug("Running post-update command for %s", name)
logger.Debug("Running post-update command for %s (%s)", name, info.Type)
err := utils.RunCmdPassThrough("sh", "-c", *info.PostUpdate)
if err != nil {
return err
@@ -128,16 +128,16 @@ func RunInstaller(config *appconfig.AppConfig, installer IInstaller) error {
}
logger.Info("Installing %s (%s)", name, installer.GetInfo().Type)
if info.PreInstall != nil {
logger.Debug("Running pre-install command for %s", name)
logger.Debug("Running pre-install command for %s (%s)", name, info.Type)
err := utils.RunCmdPassThrough("sh", "-c", *info.PreInstall)
if err != nil {
return err
}
}
logger.Debug("Running installer for %s", name)
logger.Debug("Running installer for %s (%s)", name, info.Type)
err = installer.Install()
if info.PostInstall != nil {
logger.Debug("Running post-install command for %s", name)
logger.Debug("Running post-install command for %s (%s)", name, info.Type)
err := utils.RunCmdPassThrough("sh", "-c", *info.PostInstall)
if err != nil {
return err

View File

@@ -57,7 +57,7 @@ func (i *RsyncInstaller) CheckNeedsUpdate() (error, bool) {
// CheckIsInstalled implements IInstaller.
func (i *RsyncInstaller) CheckIsInstalled() (error, bool) {
return utils.RunCmdGetSuccess("which", i.GetBinName())
return nil, false
}
// GetInfo implements IInstaller.

View File

@@ -1,5 +1,5 @@
debug: true
check_updates: true
# debug: true
# check_updates: true
defaults:
type:
brew:
@@ -21,8 +21,8 @@ install:
- name: config
type: rsync
opts:
source: ~/.dotfiles/.config
destination: ~/.config
source: ~/.dotfiles/.config/
destination: ~/.config/
flags: --exclude lazygit.yml --exclude nvim --exclude .git --exclude .DS_Store
- name: treelike
type: brew