This commit is contained in:
2025-04-15 01:32:02 +03:00
parent fe3acf5b85
commit 240ee852c8
12 changed files with 201 additions and 131 deletions

View File

@ -160,8 +160,8 @@ func (b *AppBuilder) WithManager() *AppBuilder {
return b
}
mgr := manager.Detect()
if mgr == nil {
b.deps.Manager = manager.Detect()
if b.deps.Manager == nil {
b.err = cliutils.FormatCliExit(gotext.Get("Unable to detect a supported package manager on the system"), nil)
}

View File

@ -19,6 +19,7 @@ package logger
import (
"io"
"log"
"strings"
chLog "github.com/charmbracelet/log"
"github.com/hashicorp/go-hclog"
@ -55,7 +56,18 @@ func (a *HCLoggerAdapter) Log(level hclog.Level, msg string, args ...interface{}
filteredArgs = append(filteredArgs, args[i], args[i+1])
}
}
a.logger.l.Log(hclogLevelTochLog(level), msg, filteredArgs...)
/*
* Start ugly hacks
*/
var chLogLevel chLog.Level
if msg == "plugin process exited" || strings.HasPrefix(msg, "[DEBUG] plugin") {
chLogLevel = chLog.DebugLevel
} else {
chLogLevel = hclogLevelTochLog(level)
}
a.logger.l.Log(chLogLevel, msg, filteredArgs...)
}
func (a *HCLoggerAdapter) Trace(msg string, args ...interface{}) {

View File

@ -46,15 +46,15 @@ msgstr ""
msgid "Nothing to build"
msgstr ""
#: build.go:199
#: build.go:201
msgid "Error building package"
msgstr ""
#: build.go:206
#: build.go:208
msgid "Error moving the package"
msgstr ""
#: build.go:210
#: build.go:212
msgid "Done"
msgstr ""
@ -158,31 +158,31 @@ msgstr ""
msgid "Command install expected at least 1 argument, got %d"
msgstr ""
#: install.go:63 install.go:172 install.go:222
msgid "Unable to detect a supported package manager on the system"
msgstr ""
#: install.go:88
#: install.go:86
msgid "Error pulling repositories"
msgstr ""
#: install.go:109
#: install.go:103
msgid "Error parsing os release"
msgstr ""
#: install.go:154
#: install.go:148
msgid "Remove an installed package"
msgstr ""
#: install.go:176
#: install.go:166 install.go:216
msgid "Unable to detect a supported package manager on the system"
msgstr ""
#: install.go:170
msgid "Error listing installed packages"
msgstr ""
#: install.go:217
#: install.go:211
msgid "Command remove expected at least 1 argument, got %d"
msgstr ""
#: install.go:230
#: install.go:224
msgid "Error removing packages"
msgstr ""
@ -311,15 +311,15 @@ msgstr ""
msgid "ERROR"
msgstr ""
#: internal/utils/cmd.go:87
#: internal/utils/cmd.go:79
msgid "Error dropping capabilities"
msgstr ""
#: internal/utils/cmd.go:94
#: internal/utils/cmd.go:86
msgid "You need to be root to perform this action"
msgstr ""
#: internal/utils/cmd.go:136
#: internal/utils/cmd.go:128
msgid "You need to be a %s member to perform this action"
msgstr ""
@ -507,18 +507,14 @@ msgstr ""
msgid "Error executing template"
msgstr ""
#: upgrade.go:48
#: upgrade.go:50
msgid "Upgrade all installed packages"
msgstr ""
#: upgrade.go:100
msgid "Error pulling repos"
msgstr ""
#: upgrade.go:106 upgrade.go:123
#: upgrade.go:99 upgrade.go:116
msgid "Error checking for updates"
msgstr ""
#: upgrade.go:126
#: upgrade.go:119
msgid "There is nothing to do."
msgstr ""

View File

@ -54,15 +54,15 @@ msgstr "Пакет не найден"
msgid "Nothing to build"
msgstr "Исполнение build()"
#: build.go:199
#: build.go:201
msgid "Error building package"
msgstr "Ошибка при сборке пакета"
#: build.go:206
#: build.go:208
msgid "Error moving the package"
msgstr "Ошибка при перемещении пакета"
#: build.go:210
#: build.go:212
msgid "Done"
msgstr "Сделано"
@ -171,31 +171,31 @@ msgstr "Установить новый пакет"
msgid "Command install expected at least 1 argument, got %d"
msgstr "Для команды install ожидался хотя бы 1 аргумент, получено %d"
#: install.go:63 install.go:172 install.go:222
msgid "Unable to detect a supported package manager on the system"
msgstr "Не удалось обнаружить поддерживаемый менеджер пакетов в системе"
#: install.go:88
#: install.go:86
msgid "Error pulling repositories"
msgstr "Ошибка при извлечении репозиториев"
#: install.go:109
#: install.go:103
msgid "Error parsing os release"
msgstr "Ошибка при разборе файла выпуска операционной системы"
#: install.go:154
#: install.go:148
msgid "Remove an installed package"
msgstr "Удалить установленный пакет"
#: install.go:176
#: install.go:166 install.go:216
msgid "Unable to detect a supported package manager on the system"
msgstr "Не удалось обнаружить поддерживаемый менеджер пакетов в системе"
#: install.go:170
msgid "Error listing installed packages"
msgstr "Ошибка при составлении списка установленных пакетов"
#: install.go:217
#: install.go:211
msgid "Command remove expected at least 1 argument, got %d"
msgstr "Для команды remove ожидался хотя бы 1 аргумент, получено %d"
#: install.go:230
#: install.go:224
msgid "Error removing packages"
msgstr "Ошибка при удалении пакетов"
@ -326,16 +326,16 @@ msgstr "%s %s загружается — %s/с\n"
msgid "ERROR"
msgstr "ОШИБКА"
#: internal/utils/cmd.go:87
#: internal/utils/cmd.go:79
#, fuzzy
msgid "Error dropping capabilities"
msgstr "Ошибка при открытии базы данных"
#: internal/utils/cmd.go:94
#: internal/utils/cmd.go:86
msgid "You need to be root to perform this action"
msgstr ""
#: internal/utils/cmd.go:136
#: internal/utils/cmd.go:128
msgid "You need to be a %s member to perform this action"
msgstr ""
@ -533,22 +533,21 @@ msgstr "Ошибка при разборе шаблона"
msgid "Error executing template"
msgstr "Ошибка при выполнении шаблона"
#: upgrade.go:48
#: upgrade.go:50
msgid "Upgrade all installed packages"
msgstr "Обновить все установленные пакеты"
#: upgrade.go:100
msgid "Error pulling repos"
msgstr "Ошибка при извлечении репозиториев"
#: upgrade.go:106 upgrade.go:123
#: upgrade.go:99 upgrade.go:116
msgid "Error checking for updates"
msgstr "Ошибка при проверке обновлений"
#: upgrade.go:126
#: upgrade.go:119
msgid "There is nothing to do."
msgstr "Здесь нечего делать."
#~ msgid "Error pulling repos"
#~ msgstr "Ошибка при извлечении репозиториев"
#, fuzzy
#~ msgid "Error getting current executable"
#~ msgstr "Ошибка при получении рабочего каталога"

View File

@ -70,15 +70,7 @@ func DropCapsToAlrUser() error {
if err != nil {
return err
}
newUid := syscall.Getuid()
if newUid != uid {
return errors.New("new uid don't matches requested")
}
newGid := syscall.Getgid()
if newGid != gid {
return errors.New("new gid don't matches requested")
}
return nil
return EnuseIsAlrUser()
}
func ExitIfCantDropCapsToAlrUser() cli.ExitCoder {