forked from Plemya-x/ALR
Compare commits
1 Commits
master
...
chore/refa
Author | SHA1 | Date | |
---|---|---|---|
356ea7fb9f |
@ -47,4 +47,4 @@ issues:
|
|||||||
# TODO: remove
|
# TODO: remove
|
||||||
- linters:
|
- linters:
|
||||||
- staticcheck
|
- staticcheck
|
||||||
text: "SA1019:"
|
text: "SA1019: interp.ExecHandler"
|
@ -11,7 +11,7 @@
|
|||||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
||||||
<text x="33.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
|
<text x="33.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
|
||||||
<text x="33.5" y="14">coverage</text>
|
<text x="33.5" y="14">coverage</text>
|
||||||
<text x="86" y="15" fill="#010101" fill-opacity=".3">20.8%</text>
|
<text x="86" y="15" fill="#010101" fill-opacity=".3">19.3%</text>
|
||||||
<text x="86" y="14">20.8%</text>
|
<text x="86" y="14">19.3%</text>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 926 B After Width: | Height: | Size: 926 B |
17
fix.go
17
fix.go
@ -27,7 +27,7 @@ import (
|
|||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
|
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/config"
|
"gitea.plemya-x.ru/Plemya-x/ALR/internal/config"
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/db"
|
database "gitea.plemya-x.ru/Plemya-x/ALR/internal/db"
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/pkg/repos"
|
"gitea.plemya-x.ru/Plemya-x/ALR/pkg/repos"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,9 +37,8 @@ func FixCmd() *cli.Command {
|
|||||||
Usage: gotext.Get("Attempt to fix problems with ALR"),
|
Usage: gotext.Get("Attempt to fix problems with ALR"),
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
ctx := c.Context
|
ctx := c.Context
|
||||||
|
cfg := config.New()
|
||||||
db.Close()
|
paths := cfg.GetPaths(ctx)
|
||||||
paths := config.GetPaths(ctx)
|
|
||||||
|
|
||||||
slog.Info(gotext.Get("Removing cache directory"))
|
slog.Info(gotext.Get("Removing cache directory"))
|
||||||
|
|
||||||
@ -57,7 +56,15 @@ func FixCmd() *cli.Command {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = repos.Pull(ctx, config.Config(ctx).Repos)
|
cfg = config.New()
|
||||||
|
db := database.New(cfg)
|
||||||
|
err = db.Init(ctx)
|
||||||
|
if err != nil {
|
||||||
|
slog.Error(gotext.Get("Error initialization database"), "err", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
rs := repos.New(cfg, db)
|
||||||
|
err = rs.Pull(ctx, cfg.Repos(ctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error(gotext.Get("Error pulling repos"), "err", err)
|
slog.Error(gotext.Get("Error pulling repos"), "err", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
32
info.go
32
info.go
@ -30,7 +30,7 @@ import (
|
|||||||
|
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/cliutils"
|
"gitea.plemya-x.ru/Plemya-x/ALR/internal/cliutils"
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/config"
|
"gitea.plemya-x.ru/Plemya-x/ALR/internal/config"
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/db"
|
database "gitea.plemya-x.ru/Plemya-x/ALR/internal/db"
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/overrides"
|
"gitea.plemya-x.ru/Plemya-x/ALR/internal/overrides"
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/pkg/distro"
|
"gitea.plemya-x.ru/Plemya-x/ALR/pkg/distro"
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/pkg/repos"
|
"gitea.plemya-x.ru/Plemya-x/ALR/pkg/repos"
|
||||||
@ -47,11 +47,39 @@ func InfoCmd() *cli.Command {
|
|||||||
Usage: gotext.Get("Show all information, not just for the current distro"),
|
Usage: gotext.Get("Show all information, not just for the current distro"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
BashComplete: func(c *cli.Context) {
|
||||||
|
ctx := c.Context
|
||||||
|
cfg := config.New()
|
||||||
|
db := database.New(cfg)
|
||||||
|
err := db.Init(ctx)
|
||||||
|
if err != nil {
|
||||||
|
slog.Error(gotext.Get("Error initialization database"), "err", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := db.GetPkgs(c.Context, "true")
|
||||||
|
if err != nil {
|
||||||
|
slog.Error(gotext.Get("Error getting packages"), "err", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
defer result.Close()
|
||||||
|
|
||||||
|
for result.Next() {
|
||||||
|
var pkg database.Package
|
||||||
|
err = result.StructScan(&pkg)
|
||||||
|
if err != nil {
|
||||||
|
slog.Error(gotext.Get("Error iterating over packages"), "err", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(pkg.Name)
|
||||||
|
}
|
||||||
|
},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
ctx := c.Context
|
ctx := c.Context
|
||||||
|
|
||||||
cfg := config.New()
|
cfg := config.New()
|
||||||
db := db.New(cfg)
|
db := database.New(cfg)
|
||||||
err := db.Init(ctx)
|
err := db.Init(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error(gotext.Get("Error initialization database"), "err", err)
|
slog.Error(gotext.Get("Error initialization database"), "err", err)
|
||||||
|
@ -152,6 +152,13 @@ func (c *ALRConfig) Repos(ctx context.Context) []types.Repo {
|
|||||||
return c.cfg.Repos
|
return c.cfg.Repos
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *ALRConfig) SetRepos(ctx context.Context, repos []types.Repo) {
|
||||||
|
c.cfgOnce.Do(func() {
|
||||||
|
c.Load(ctx)
|
||||||
|
})
|
||||||
|
c.cfg.Repos = repos
|
||||||
|
}
|
||||||
|
|
||||||
func (c *ALRConfig) IgnorePkgUpdates(ctx context.Context) []string {
|
func (c *ALRConfig) IgnorePkgUpdates(ctx context.Context) []string {
|
||||||
c.cfgOnce.Do(func() {
|
c.cfgOnce.Do(func() {
|
||||||
c.Load(ctx)
|
c.Load(ctx)
|
||||||
@ -172,3 +179,17 @@ func (c *ALRConfig) PagerStyle(ctx context.Context) string {
|
|||||||
})
|
})
|
||||||
return c.cfg.PagerStyle
|
return c.cfg.PagerStyle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *ALRConfig) AllowRunAsRoot(ctx context.Context) bool {
|
||||||
|
c.cfgOnce.Do(func() {
|
||||||
|
c.Load(ctx)
|
||||||
|
})
|
||||||
|
return c.cfg.Unsafe.AllowRunAsRoot
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ALRConfig) RootCmd(ctx context.Context) string {
|
||||||
|
c.cfgOnce.Do(func() {
|
||||||
|
c.Load(ctx)
|
||||||
|
})
|
||||||
|
return c.cfg.RootCmd
|
||||||
|
}
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
// ALR - Any Linux Repository
|
|
||||||
// Copyright (C) 2025 Евгений Храмов
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
package config
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Config returns a ALR configuration struct.
|
|
||||||
// The first time it's called, it'll load the config from a file.
|
|
||||||
// Subsequent calls will just return the same value.
|
|
||||||
//
|
|
||||||
// Deprecated: use struct method
|
|
||||||
func Config(ctx context.Context) *types.Config {
|
|
||||||
return GetInstance(ctx).cfg
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================
|
|
||||||
// FOR LEGACY ONLY
|
|
||||||
// =======================
|
|
||||||
|
|
||||||
var (
|
|
||||||
alrConfig *ALRConfig
|
|
||||||
alrConfigOnce sync.Once
|
|
||||||
)
|
|
||||||
|
|
||||||
// Deprecated: For legacy only
|
|
||||||
func GetInstance(ctx context.Context) *ALRConfig {
|
|
||||||
alrConfigOnce.Do(func() {
|
|
||||||
alrConfig = New()
|
|
||||||
alrConfig.Load(ctx)
|
|
||||||
})
|
|
||||||
|
|
||||||
return alrConfig
|
|
||||||
}
|
|
@ -19,10 +19,6 @@
|
|||||||
|
|
||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Paths contains various paths used by ALR
|
// Paths contains various paths used by ALR
|
||||||
type Paths struct {
|
type Paths struct {
|
||||||
ConfigDir string
|
ConfigDir string
|
||||||
@ -32,14 +28,3 @@ type Paths struct {
|
|||||||
PkgsDir string
|
PkgsDir string
|
||||||
DBPath string
|
DBPath string
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPaths returns a Paths struct.
|
|
||||||
// The first time it's called, it'll generate the struct
|
|
||||||
// using information from the system.
|
|
||||||
// Subsequent calls will return the same value.
|
|
||||||
//
|
|
||||||
// Deprecated: use struct API
|
|
||||||
func GetPaths(ctx context.Context) *Paths {
|
|
||||||
alrConfig := GetInstance(ctx)
|
|
||||||
return alrConfig.GetPaths(ctx)
|
|
||||||
}
|
|
||||||
|
@ -1,106 +0,0 @@
|
|||||||
// ALR - Any Linux Repository
|
|
||||||
// Copyright (C) 2025 Евгений Храмов
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
package db
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"log/slog"
|
|
||||||
"os"
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx"
|
|
||||||
"github.com/leonelquinteros/gotext"
|
|
||||||
|
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/config"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DB returns the ALR database.
|
|
||||||
// The first time it's called, it opens the SQLite database file.
|
|
||||||
// Subsequent calls return the same connection.
|
|
||||||
//
|
|
||||||
// Deprecated: use struct method
|
|
||||||
func DB(ctx context.Context) *sqlx.DB {
|
|
||||||
return GetInstance(ctx).GetConn()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close closes the database
|
|
||||||
//
|
|
||||||
// Deprecated: use struct method
|
|
||||||
func Close() error {
|
|
||||||
if database != nil {
|
|
||||||
return database.Close()
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsEmpty returns true if the database has no packages in it, otherwise it returns false.
|
|
||||||
//
|
|
||||||
// Deprecated: use struct method
|
|
||||||
func IsEmpty(ctx context.Context) bool {
|
|
||||||
return GetInstance(ctx).IsEmpty(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// InsertPackage adds a package to the database
|
|
||||||
//
|
|
||||||
// Deprecated: use struct method
|
|
||||||
func InsertPackage(ctx context.Context, pkg Package) error {
|
|
||||||
return GetInstance(ctx).InsertPackage(ctx, pkg)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPkgs returns a result containing packages that match the where conditions
|
|
||||||
//
|
|
||||||
// Deprecated: use struct method
|
|
||||||
func GetPkgs(ctx context.Context, where string, args ...any) (*sqlx.Rows, error) {
|
|
||||||
return GetInstance(ctx).GetPkgs(ctx, where, args...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPkg returns a single package that matches the where conditions
|
|
||||||
//
|
|
||||||
// Deprecated: use struct method
|
|
||||||
func GetPkg(ctx context.Context, where string, args ...any) (*Package, error) {
|
|
||||||
return GetInstance(ctx).GetPkg(ctx, where, args...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeletePkgs deletes all packages matching the where conditions
|
|
||||||
//
|
|
||||||
// Deprecated: use struct method
|
|
||||||
func DeletePkgs(ctx context.Context, where string, args ...any) error {
|
|
||||||
return GetInstance(ctx).DeletePkgs(ctx, where, args...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================
|
|
||||||
// FOR LEGACY ONLY
|
|
||||||
// =======================
|
|
||||||
|
|
||||||
var (
|
|
||||||
dbOnce sync.Once
|
|
||||||
database *Database
|
|
||||||
)
|
|
||||||
|
|
||||||
// Deprecated: For legacy only
|
|
||||||
func GetInstance(ctx context.Context) *Database {
|
|
||||||
dbOnce.Do(func() {
|
|
||||||
cfg := config.GetInstance(ctx)
|
|
||||||
database = New(cfg)
|
|
||||||
err := database.Init(ctx)
|
|
||||||
if err != nil {
|
|
||||||
slog.Error(gotext.Get("Error opening database"), "err", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return database
|
|
||||||
}
|
|
@ -32,14 +32,6 @@ import (
|
|||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/dlcache"
|
"gitea.plemya-x.ru/Plemya-x/ALR/internal/dlcache"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
dir, err := os.MkdirTemp("/tmp", "alr-dlcache-test.*")
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
config.GetPaths(context.Background()).RepoDir = dir
|
|
||||||
}
|
|
||||||
|
|
||||||
type TestALRConfig struct {
|
type TestALRConfig struct {
|
||||||
CacheDir string
|
CacheDir string
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ func init() {
|
|||||||
|
|
||||||
b2 := lipgloss.RoundedBorder()
|
b2 := lipgloss.RoundedBorder()
|
||||||
b2.Left = "\u2524"
|
b2.Left = "\u2524"
|
||||||
infoStyle = titleStyle.Copy().BorderStyle(b2)
|
infoStyle = titleStyle.BorderStyle(b2)
|
||||||
}
|
}
|
||||||
|
|
||||||
type Pager struct {
|
type Pager struct {
|
||||||
|
@ -22,10 +22,11 @@ package handlers
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NopReadDir(context.Context, string) ([]os.FileInfo, error) {
|
func NopReadDir(context.Context, string) ([]fs.DirEntry, error) {
|
||||||
return nil, os.ErrNotExist
|
return nil, os.ErrNotExist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,12 +31,12 @@ import (
|
|||||||
"mvdan.cc/sh/v3/interp"
|
"mvdan.cc/sh/v3/interp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RestrictedReadDir(allowedPrefixes ...string) interp.ReadDirHandlerFunc {
|
func RestrictedReadDir(allowedPrefixes ...string) interp.ReadDirHandlerFunc2 {
|
||||||
return func(ctx context.Context, s string) ([]fs.FileInfo, error) {
|
return func(ctx context.Context, s string) ([]fs.DirEntry, error) {
|
||||||
path := filepath.Clean(s)
|
path := filepath.Clean(s)
|
||||||
for _, allowedPrefix := range allowedPrefixes {
|
for _, allowedPrefix := range allowedPrefixes {
|
||||||
if strings.HasPrefix(path, allowedPrefix) {
|
if strings.HasPrefix(path, allowedPrefix) {
|
||||||
return interp.DefaultReadDirHandler()(ctx, s)
|
return interp.DefaultReadDirHandler2()(ctx, s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,27 +66,31 @@ msgstr ""
|
|||||||
msgid "Attempt to fix problems with ALR"
|
msgid "Attempt to fix problems with ALR"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: fix.go:44
|
#: fix.go:43
|
||||||
msgid "Removing cache directory"
|
msgid "Removing cache directory"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: fix.go:48
|
#: fix.go:47
|
||||||
msgid "Unable to remove cache directory"
|
msgid "Unable to remove cache directory"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: fix.go:52
|
#: fix.go:51
|
||||||
msgid "Rebuilding cache"
|
msgid "Rebuilding cache"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: fix.go:56
|
#: fix.go:55
|
||||||
msgid "Unable to create new cache directory"
|
msgid "Unable to create new cache directory"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: fix.go:62
|
#: fix.go:63
|
||||||
|
msgid "Error initialization database"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: fix.go:69
|
||||||
msgid "Error pulling repos"
|
msgid "Error pulling repos"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: fix.go:66
|
#: fix.go:73
|
||||||
msgid "Done"
|
msgid "Done"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -122,27 +126,31 @@ msgstr ""
|
|||||||
msgid "Show all information, not just for the current distro"
|
msgid "Show all information, not just for the current distro"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: info.go:57
|
#: info.go:62
|
||||||
msgid "Error initialization database"
|
msgid "Error getting packages"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: info.go:64
|
#: info.go:71
|
||||||
|
msgid "Error iterating over packages"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: info.go:92
|
||||||
msgid "Command info expected at least 1 argument, got %d"
|
msgid "Command info expected at least 1 argument, got %d"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: info.go:78
|
#: info.go:106
|
||||||
msgid "Error finding packages"
|
msgid "Error finding packages"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: info.go:94
|
#: info.go:122
|
||||||
msgid "Error parsing os-release file"
|
msgid "Error parsing os-release file"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: info.go:103
|
#: info.go:131
|
||||||
msgid "Error resolving overrides"
|
msgid "Error resolving overrides"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: info.go:112 info.go:118
|
#: info.go:140 info.go:146
|
||||||
msgid "Error encoding script variables"
|
msgid "Error encoding script variables"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -154,14 +162,6 @@ msgstr ""
|
|||||||
msgid "Command install expected at least 1 argument, got %d"
|
msgid "Command install expected at least 1 argument, got %d"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: install.go:124
|
|
||||||
msgid "Error getting packages"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: install.go:133
|
|
||||||
msgid "Error iterating over packages"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: install.go:146
|
#: install.go:146
|
||||||
msgid "Remove an installed package"
|
msgid "Remove an installed package"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -247,10 +247,6 @@ msgid ""
|
|||||||
"Database version does not exist. Run alr fix if something isn't working."
|
"Database version does not exist. Run alr fix if something isn't working."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: internal/db/db_legacy.go:101
|
|
||||||
msgid "Error opening database"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: internal/dl/dl.go:170
|
#: internal/dl/dl.go:170
|
||||||
msgid "Source can be updated, updating if required"
|
msgid "Source can be updated, updating if required"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -287,15 +283,15 @@ msgstr ""
|
|||||||
msgid "Error listing installed packages"
|
msgid "Error listing installed packages"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: main.go:45
|
#: main.go:44
|
||||||
msgid "Print the current ALR version and exit"
|
msgid "Print the current ALR version and exit"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: main.go:61
|
#: main.go:60
|
||||||
msgid "Arguments to be passed on to the package manager"
|
msgid "Arguments to be passed on to the package manager"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: main.go:67
|
#: main.go:66
|
||||||
msgid "Enable interactive questions and prompts"
|
msgid "Enable interactive questions and prompts"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -305,7 +301,7 @@ msgid ""
|
|||||||
"system"
|
"system"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: main.go:124
|
#: main.go:122
|
||||||
msgid "Error while running app"
|
msgid "Error while running app"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -329,49 +325,49 @@ msgstr ""
|
|||||||
msgid "Compressing package"
|
msgid "Compressing package"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:419
|
#: pkg/build/build.go:421
|
||||||
msgid ""
|
msgid ""
|
||||||
"Your system's CPU architecture doesn't match this package. Do you want to "
|
"Your system's CPU architecture doesn't match this package. Do you want to "
|
||||||
"build anyway?"
|
"build anyway?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:433
|
#: pkg/build/build.go:435
|
||||||
msgid "This package is already installed"
|
msgid "This package is already installed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:457
|
#: pkg/build/build.go:459
|
||||||
msgid "Installing build dependencies"
|
msgid "Installing build dependencies"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:498
|
#: pkg/build/build.go:500
|
||||||
msgid "Installing dependencies"
|
msgid "Installing dependencies"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:533
|
#: pkg/build/build.go:535
|
||||||
msgid "The checksums array must be the same length as sources"
|
msgid "The checksums array must be the same length as sources"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:584
|
#: pkg/build/build.go:586
|
||||||
msgid "Would you like to remove the build dependencies?"
|
msgid "Would you like to remove the build dependencies?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:647
|
#: pkg/build/build.go:649
|
||||||
msgid "Executing prepare()"
|
msgid "Executing prepare()"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:657
|
#: pkg/build/build.go:659
|
||||||
msgid "Executing build()"
|
msgid "Executing build()"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:687 pkg/build/build.go:707
|
#: pkg/build/build.go:689 pkg/build/build.go:709
|
||||||
msgid "Executing %s()"
|
msgid "Executing %s()"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:766
|
#: pkg/build/build.go:768
|
||||||
msgid "Error installing native packages"
|
msgid "Error installing native packages"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:790
|
#: pkg/build/build.go:792
|
||||||
msgid "Error installing package"
|
msgid "Error installing package"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -425,35 +421,35 @@ msgstr ""
|
|||||||
msgid "URL of the new repo"
|
msgid "URL of the new repo"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:79 repo.go:136
|
#: repo.go:82 repo.go:142
|
||||||
msgid "Error opening config file"
|
msgid "Error opening config file"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:85 repo.go:142
|
#: repo.go:88 repo.go:148
|
||||||
msgid "Error encoding config"
|
msgid "Error encoding config"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:103
|
#: repo.go:108
|
||||||
msgid "Remove an existing repository"
|
msgid "Remove an existing repository"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:110
|
#: repo.go:115
|
||||||
msgid "Name of the repo to be deleted"
|
msgid "Name of the repo to be deleted"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:128
|
#: repo.go:134
|
||||||
msgid "Repo does not exist"
|
msgid "Repo does not exist"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:148
|
#: repo.go:154
|
||||||
msgid "Error removing repo directory"
|
msgid "Error removing repo directory"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:154
|
#: repo.go:165
|
||||||
msgid "Error removing packages from database"
|
msgid "Error removing packages from database"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:166
|
#: repo.go:177
|
||||||
msgid "Pull all repositories that have changed"
|
msgid "Pull all repositories that have changed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -74,27 +74,31 @@ msgstr "Ошибка при перемещении пакета"
|
|||||||
msgid "Attempt to fix problems with ALR"
|
msgid "Attempt to fix problems with ALR"
|
||||||
msgstr "Попытка устранить проблемы с ALR"
|
msgstr "Попытка устранить проблемы с ALR"
|
||||||
|
|
||||||
#: fix.go:44
|
#: fix.go:43
|
||||||
msgid "Removing cache directory"
|
msgid "Removing cache directory"
|
||||||
msgstr "Удаление каталога кэша"
|
msgstr "Удаление каталога кэша"
|
||||||
|
|
||||||
#: fix.go:48
|
#: fix.go:47
|
||||||
msgid "Unable to remove cache directory"
|
msgid "Unable to remove cache directory"
|
||||||
msgstr "Не удалось удалить каталог кэша"
|
msgstr "Не удалось удалить каталог кэша"
|
||||||
|
|
||||||
#: fix.go:52
|
#: fix.go:51
|
||||||
msgid "Rebuilding cache"
|
msgid "Rebuilding cache"
|
||||||
msgstr "Восстановление кэша"
|
msgstr "Восстановление кэша"
|
||||||
|
|
||||||
#: fix.go:56
|
#: fix.go:55
|
||||||
msgid "Unable to create new cache directory"
|
msgid "Unable to create new cache directory"
|
||||||
msgstr "Не удалось создать новый каталог кэша"
|
msgstr "Не удалось создать новый каталог кэша"
|
||||||
|
|
||||||
#: fix.go:62
|
#: fix.go:63
|
||||||
|
msgid "Error initialization database"
|
||||||
|
msgstr "Ошибка инициализации базы данных"
|
||||||
|
|
||||||
|
#: fix.go:69
|
||||||
msgid "Error pulling repos"
|
msgid "Error pulling repos"
|
||||||
msgstr "Ошибка при извлечении репозиториев"
|
msgstr "Ошибка при извлечении репозиториев"
|
||||||
|
|
||||||
#: fix.go:66
|
#: fix.go:73
|
||||||
msgid "Done"
|
msgid "Done"
|
||||||
msgstr "Сделано"
|
msgstr "Сделано"
|
||||||
|
|
||||||
@ -130,27 +134,31 @@ msgstr "Отобразить информацию о пакете"
|
|||||||
msgid "Show all information, not just for the current distro"
|
msgid "Show all information, not just for the current distro"
|
||||||
msgstr "Показывать всю информацию, не только для текущего дистрибутива"
|
msgstr "Показывать всю информацию, не только для текущего дистрибутива"
|
||||||
|
|
||||||
#: info.go:57
|
#: info.go:62
|
||||||
msgid "Error initialization database"
|
msgid "Error getting packages"
|
||||||
msgstr "Ошибка инициализации базы данных"
|
msgstr "Ошибка при получении пакетов"
|
||||||
|
|
||||||
#: info.go:64
|
#: info.go:71
|
||||||
|
msgid "Error iterating over packages"
|
||||||
|
msgstr "Ошибка при переборе пакетов"
|
||||||
|
|
||||||
|
#: info.go:92
|
||||||
msgid "Command info expected at least 1 argument, got %d"
|
msgid "Command info expected at least 1 argument, got %d"
|
||||||
msgstr "Для команды info ожидался хотя бы 1 аргумент, получено %d"
|
msgstr "Для команды info ожидался хотя бы 1 аргумент, получено %d"
|
||||||
|
|
||||||
#: info.go:78
|
#: info.go:106
|
||||||
msgid "Error finding packages"
|
msgid "Error finding packages"
|
||||||
msgstr "Ошибка при поиске пакетов"
|
msgstr "Ошибка при поиске пакетов"
|
||||||
|
|
||||||
#: info.go:94
|
#: info.go:122
|
||||||
msgid "Error parsing os-release file"
|
msgid "Error parsing os-release file"
|
||||||
msgstr "Ошибка при разборе файла выпуска операционной системы"
|
msgstr "Ошибка при разборе файла выпуска операционной системы"
|
||||||
|
|
||||||
#: info.go:103
|
#: info.go:131
|
||||||
msgid "Error resolving overrides"
|
msgid "Error resolving overrides"
|
||||||
msgstr "Ошибка устранения переорпеделений"
|
msgstr "Ошибка устранения переорпеделений"
|
||||||
|
|
||||||
#: info.go:112 info.go:118
|
#: info.go:140 info.go:146
|
||||||
msgid "Error encoding script variables"
|
msgid "Error encoding script variables"
|
||||||
msgstr "Ошибка кодирования переменных скрита"
|
msgstr "Ошибка кодирования переменных скрита"
|
||||||
|
|
||||||
@ -162,14 +170,6 @@ msgstr "Установить новый пакет"
|
|||||||
msgid "Command install expected at least 1 argument, got %d"
|
msgid "Command install expected at least 1 argument, got %d"
|
||||||
msgstr "Для команды install ожидался хотя бы 1 аргумент, получено %d"
|
msgstr "Для команды install ожидался хотя бы 1 аргумент, получено %d"
|
||||||
|
|
||||||
#: install.go:124
|
|
||||||
msgid "Error getting packages"
|
|
||||||
msgstr "Ошибка при получении пакетов"
|
|
||||||
|
|
||||||
#: install.go:133
|
|
||||||
msgid "Error iterating over packages"
|
|
||||||
msgstr "Ошибка при переборе пакетов"
|
|
||||||
|
|
||||||
#: install.go:146
|
#: install.go:146
|
||||||
msgid "Remove an installed package"
|
msgid "Remove an installed package"
|
||||||
msgstr "Удалить установленный пакет"
|
msgstr "Удалить установленный пакет"
|
||||||
@ -260,10 +260,6 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Версия базы данных не существует. Запустите alr fix, если что-то не работает."
|
"Версия базы данных не существует. Запустите alr fix, если что-то не работает."
|
||||||
|
|
||||||
#: internal/db/db_legacy.go:101
|
|
||||||
msgid "Error opening database"
|
|
||||||
msgstr "Ошибка при открытии базы данных"
|
|
||||||
|
|
||||||
#: internal/dl/dl.go:170
|
#: internal/dl/dl.go:170
|
||||||
msgid "Source can be updated, updating if required"
|
msgid "Source can be updated, updating if required"
|
||||||
msgstr "Исходный код можно обновлять, обновляя при необходимости"
|
msgstr "Исходный код можно обновлять, обновляя при необходимости"
|
||||||
@ -300,15 +296,15 @@ msgstr "Список пакетов репозитория ALR"
|
|||||||
msgid "Error listing installed packages"
|
msgid "Error listing installed packages"
|
||||||
msgstr "Ошибка при составлении списка установленных пакетов"
|
msgstr "Ошибка при составлении списка установленных пакетов"
|
||||||
|
|
||||||
#: main.go:45
|
#: main.go:44
|
||||||
msgid "Print the current ALR version and exit"
|
msgid "Print the current ALR version and exit"
|
||||||
msgstr "Показать текущую версию ALR и выйти"
|
msgstr "Показать текущую версию ALR и выйти"
|
||||||
|
|
||||||
#: main.go:61
|
#: main.go:60
|
||||||
msgid "Arguments to be passed on to the package manager"
|
msgid "Arguments to be passed on to the package manager"
|
||||||
msgstr "Аргументы, которые будут переданы менеджеру пакетов"
|
msgstr "Аргументы, которые будут переданы менеджеру пакетов"
|
||||||
|
|
||||||
#: main.go:67
|
#: main.go:66
|
||||||
msgid "Enable interactive questions and prompts"
|
msgid "Enable interactive questions and prompts"
|
||||||
msgstr "Включение интерактивных вопросов и запросов"
|
msgstr "Включение интерактивных вопросов и запросов"
|
||||||
|
|
||||||
@ -320,7 +316,7 @@ msgstr ""
|
|||||||
"Запуск ALR от имени root запрещён, так как это может привести к "
|
"Запуск ALR от имени root запрещён, так как это может привести к "
|
||||||
"катастрофическому повреждению вашей системы"
|
"катастрофическому повреждению вашей системы"
|
||||||
|
|
||||||
#: main.go:124
|
#: main.go:122
|
||||||
msgid "Error while running app"
|
msgid "Error while running app"
|
||||||
msgstr "Ошибка при запуске приложения"
|
msgstr "Ошибка при запуске приложения"
|
||||||
|
|
||||||
@ -344,7 +340,7 @@ msgstr "Сборка метаданных пакета"
|
|||||||
msgid "Compressing package"
|
msgid "Compressing package"
|
||||||
msgstr "Сжатие пакета"
|
msgstr "Сжатие пакета"
|
||||||
|
|
||||||
#: pkg/build/build.go:419
|
#: pkg/build/build.go:421
|
||||||
msgid ""
|
msgid ""
|
||||||
"Your system's CPU architecture doesn't match this package. Do you want to "
|
"Your system's CPU architecture doesn't match this package. Do you want to "
|
||||||
"build anyway?"
|
"build anyway?"
|
||||||
@ -352,44 +348,44 @@ msgstr ""
|
|||||||
"Архитектура процессора вашей системы не соответствует этому пакету. Вы все "
|
"Архитектура процессора вашей системы не соответствует этому пакету. Вы все "
|
||||||
"равно хотите выполнить сборку?"
|
"равно хотите выполнить сборку?"
|
||||||
|
|
||||||
#: pkg/build/build.go:433
|
#: pkg/build/build.go:435
|
||||||
msgid "This package is already installed"
|
msgid "This package is already installed"
|
||||||
msgstr "Этот пакет уже установлен"
|
msgstr "Этот пакет уже установлен"
|
||||||
|
|
||||||
#: pkg/build/build.go:457
|
#: pkg/build/build.go:459
|
||||||
msgid "Installing build dependencies"
|
msgid "Installing build dependencies"
|
||||||
msgstr "Установка зависимостей сборки"
|
msgstr "Установка зависимостей сборки"
|
||||||
|
|
||||||
#: pkg/build/build.go:498
|
#: pkg/build/build.go:500
|
||||||
msgid "Installing dependencies"
|
msgid "Installing dependencies"
|
||||||
msgstr "Установка зависимостей"
|
msgstr "Установка зависимостей"
|
||||||
|
|
||||||
#: pkg/build/build.go:533
|
#: pkg/build/build.go:535
|
||||||
msgid "The checksums array must be the same length as sources"
|
msgid "The checksums array must be the same length as sources"
|
||||||
msgstr "Массив контрольных сумм должен быть той же длины, что и источники"
|
msgstr "Массив контрольных сумм должен быть той же длины, что и источники"
|
||||||
|
|
||||||
#: pkg/build/build.go:584
|
#: pkg/build/build.go:586
|
||||||
msgid "Would you like to remove the build dependencies?"
|
msgid "Would you like to remove the build dependencies?"
|
||||||
msgstr "Хотели бы вы удалить зависимости сборки?"
|
msgstr "Хотели бы вы удалить зависимости сборки?"
|
||||||
|
|
||||||
#: pkg/build/build.go:647
|
#: pkg/build/build.go:649
|
||||||
msgid "Executing prepare()"
|
msgid "Executing prepare()"
|
||||||
msgstr "Исполнение prepare()"
|
msgstr "Исполнение prepare()"
|
||||||
|
|
||||||
#: pkg/build/build.go:657
|
#: pkg/build/build.go:659
|
||||||
msgid "Executing build()"
|
msgid "Executing build()"
|
||||||
msgstr "Исполнение build()"
|
msgstr "Исполнение build()"
|
||||||
|
|
||||||
#: pkg/build/build.go:687 pkg/build/build.go:707
|
#: pkg/build/build.go:689 pkg/build/build.go:709
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid "Executing %s()"
|
msgid "Executing %s()"
|
||||||
msgstr "Исполнение files()"
|
msgstr "Исполнение files()"
|
||||||
|
|
||||||
#: pkg/build/build.go:766
|
#: pkg/build/build.go:768
|
||||||
msgid "Error installing native packages"
|
msgid "Error installing native packages"
|
||||||
msgstr "Ошибка при установке нативных пакетов"
|
msgstr "Ошибка при установке нативных пакетов"
|
||||||
|
|
||||||
#: pkg/build/build.go:790
|
#: pkg/build/build.go:792
|
||||||
msgid "Error installing package"
|
msgid "Error installing package"
|
||||||
msgstr "Ошибка при установке пакета"
|
msgstr "Ошибка при установке пакета"
|
||||||
|
|
||||||
@ -447,35 +443,35 @@ msgstr "Название нового репозитория"
|
|||||||
msgid "URL of the new repo"
|
msgid "URL of the new repo"
|
||||||
msgstr "URL-адрес нового репозитория"
|
msgstr "URL-адрес нового репозитория"
|
||||||
|
|
||||||
#: repo.go:79 repo.go:136
|
#: repo.go:82 repo.go:142
|
||||||
msgid "Error opening config file"
|
msgid "Error opening config file"
|
||||||
msgstr "Ошибка при открытии конфигурационного файла"
|
msgstr "Ошибка при открытии конфигурационного файла"
|
||||||
|
|
||||||
#: repo.go:85 repo.go:142
|
#: repo.go:88 repo.go:148
|
||||||
msgid "Error encoding config"
|
msgid "Error encoding config"
|
||||||
msgstr "Ошибка при кодировании конфигурации"
|
msgstr "Ошибка при кодировании конфигурации"
|
||||||
|
|
||||||
#: repo.go:103
|
#: repo.go:108
|
||||||
msgid "Remove an existing repository"
|
msgid "Remove an existing repository"
|
||||||
msgstr "Удалить существующий репозиторий"
|
msgstr "Удалить существующий репозиторий"
|
||||||
|
|
||||||
#: repo.go:110
|
#: repo.go:115
|
||||||
msgid "Name of the repo to be deleted"
|
msgid "Name of the repo to be deleted"
|
||||||
msgstr "Название репозитория удалён"
|
msgstr "Название репозитория удалён"
|
||||||
|
|
||||||
#: repo.go:128
|
#: repo.go:134
|
||||||
msgid "Repo does not exist"
|
msgid "Repo does not exist"
|
||||||
msgstr "Репозитория не существует"
|
msgstr "Репозитория не существует"
|
||||||
|
|
||||||
#: repo.go:148
|
#: repo.go:154
|
||||||
msgid "Error removing repo directory"
|
msgid "Error removing repo directory"
|
||||||
msgstr "Ошибка при удалении каталога репозитория"
|
msgstr "Ошибка при удалении каталога репозитория"
|
||||||
|
|
||||||
#: repo.go:154
|
#: repo.go:165
|
||||||
msgid "Error removing packages from database"
|
msgid "Error removing packages from database"
|
||||||
msgstr "Ошибка при удалении пакетов из базы данных"
|
msgstr "Ошибка при удалении пакетов из базы данных"
|
||||||
|
|
||||||
#: repo.go:166
|
#: repo.go:177
|
||||||
msgid "Pull all repositories that have changed"
|
msgid "Pull all repositories that have changed"
|
||||||
msgstr "Скачать все изменённые репозитории"
|
msgstr "Скачать все изменённые репозитории"
|
||||||
|
|
||||||
@ -491,6 +487,9 @@ msgstr "Ошибка при проверке обновлений"
|
|||||||
msgid "There is nothing to do."
|
msgid "There is nothing to do."
|
||||||
msgstr "Здесь нечего делать."
|
msgstr "Здесь нечего делать."
|
||||||
|
|
||||||
|
#~ msgid "Error opening database"
|
||||||
|
#~ msgstr "Ошибка при открытии базы данных"
|
||||||
|
|
||||||
#~ msgid "Executing version()"
|
#~ msgid "Executing version()"
|
||||||
#~ msgstr "Исполнение версия()"
|
#~ msgstr "Исполнение версия()"
|
||||||
|
|
||||||
|
10
main.go
10
main.go
@ -32,7 +32,6 @@ import (
|
|||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
|
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/config"
|
"gitea.plemya-x.ru/Plemya-x/ALR/internal/config"
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/db"
|
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/translations"
|
"gitea.plemya-x.ru/Plemya-x/ALR/internal/translations"
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/pkg/manager"
|
"gitea.plemya-x.ru/Plemya-x/ALR/pkg/manager"
|
||||||
|
|
||||||
@ -84,9 +83,10 @@ func GetApp() *cli.App {
|
|||||||
},
|
},
|
||||||
Before: func(c *cli.Context) error {
|
Before: func(c *cli.Context) error {
|
||||||
ctx := c.Context
|
ctx := c.Context
|
||||||
|
cfg := config.New()
|
||||||
|
|
||||||
cmd := c.Args().First()
|
cmd := c.Args().First()
|
||||||
if cmd != "helper" && !config.Config(ctx).Unsafe.AllowRunAsRoot && os.Geteuid() == 0 {
|
if cmd != "helper" && !cfg.AllowRunAsRoot(ctx) && os.Geteuid() == 0 {
|
||||||
slog.Error(gotext.Get("Running ALR as root is forbidden as it may cause catastrophic damage to your system"))
|
slog.Error(gotext.Get("Running ALR as root is forbidden as it may cause catastrophic damage to your system"))
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
@ -98,9 +98,6 @@ func GetApp() *cli.App {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
After: func(ctx *cli.Context) error {
|
|
||||||
return db.Close()
|
|
||||||
},
|
|
||||||
EnableBashCompletion: true,
|
EnableBashCompletion: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,11 +107,12 @@ func main() {
|
|||||||
logger.SetupDefault()
|
logger.SetupDefault()
|
||||||
|
|
||||||
app := GetApp()
|
app := GetApp()
|
||||||
|
cfg := config.New()
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
// Set the root command to the one set in the ALR config
|
// Set the root command to the one set in the ALR config
|
||||||
manager.DefaultRootCmd = config.Config(ctx).RootCmd
|
manager.DefaultRootCmd = cfg.RootCmd(ctx)
|
||||||
|
|
||||||
ctx, cancel := signal.NotifyContext(ctx, syscall.SIGINT, syscall.SIGTERM)
|
ctx, cancel := signal.NotifyContext(ctx, syscall.SIGINT, syscall.SIGTERM)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
@ -306,7 +306,7 @@ func (b *Builder) executeFirstPass(
|
|||||||
interp.Env(expand.ListEnviron(env...)), // Устанавливаем окружение
|
interp.Env(expand.ListEnviron(env...)), // Устанавливаем окружение
|
||||||
interp.StdIO(os.Stdin, os.Stdout, os.Stderr), // Устанавливаем стандартный ввод-вывод
|
interp.StdIO(os.Stdin, os.Stdout, os.Stderr), // Устанавливаем стандартный ввод-вывод
|
||||||
interp.ExecHandler(helpers.Restricted.ExecHandler(handlers.NopExec)), // Ограничиваем выполнение
|
interp.ExecHandler(helpers.Restricted.ExecHandler(handlers.NopExec)), // Ограничиваем выполнение
|
||||||
interp.ReadDirHandler(handlers.RestrictedReadDir(scriptDir)), // Ограничиваем чтение директорий
|
interp.ReadDirHandler2(handlers.RestrictedReadDir(scriptDir)), // Ограничиваем чтение директорий
|
||||||
interp.StatHandler(handlers.RestrictedStat(scriptDir)), // Ограничиваем доступ к статистике файлов
|
interp.StatHandler(handlers.RestrictedStat(scriptDir)), // Ограничиваем доступ к статистике файлов
|
||||||
interp.OpenHandler(handlers.RestrictedOpen(scriptDir)), // Ограничиваем открытие файлов
|
interp.OpenHandler(handlers.RestrictedOpen(scriptDir)), // Ограничиваем открытие файлов
|
||||||
)
|
)
|
||||||
@ -397,7 +397,9 @@ func (b *Builder) executeSecondPass(
|
|||||||
runner, err := interp.New(
|
runner, err := interp.New(
|
||||||
interp.Env(expand.ListEnviron(env...)), // Устанавливаем окружение
|
interp.Env(expand.ListEnviron(env...)), // Устанавливаем окружение
|
||||||
interp.StdIO(os.Stdin, os.Stdout, os.Stderr), // Устанавливаем стандартный ввод-вывод
|
interp.StdIO(os.Stdin, os.Stdout, os.Stderr), // Устанавливаем стандартный ввод-вывод
|
||||||
interp.ExecHandler(helpers.Helpers.ExecHandler(fakeroot)), // Обрабатываем выполнение через fakeroot
|
interp.ExecHandlers(func(next interp.ExecHandlerFunc) interp.ExecHandlerFunc {
|
||||||
|
return helpers.Helpers.ExecHandler(fakeroot)
|
||||||
|
}), // Обрабатываем выполнение через fakeroot
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -79,7 +79,7 @@ func ParseOSRelease(ctx context.Context) (*OSRelease, error) {
|
|||||||
runner, err := interp.New(
|
runner, err := interp.New(
|
||||||
interp.OpenHandler(handlers.NopOpen),
|
interp.OpenHandler(handlers.NopOpen),
|
||||||
interp.ExecHandler(handlers.NopExec),
|
interp.ExecHandler(handlers.NopExec),
|
||||||
interp.ReadDirHandler(handlers.NopReadDir),
|
interp.ReadDirHandler2(handlers.NopReadDir),
|
||||||
interp.StatHandler(handlers.NopStat),
|
interp.StatHandler(handlers.NopStat),
|
||||||
interp.Env(expand.ListEnviron()),
|
interp.Env(expand.ListEnviron()),
|
||||||
)
|
)
|
||||||
|
@ -77,7 +77,7 @@ func (rs *Repos) Pull(ctx context.Context, repos []types.Repo) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
slog.Info(gotext.Get("Pulling repository"), "name", repo.Name)
|
slog.Info(gotext.Get("Pulling repository"), "name", repo.Name)
|
||||||
repoDir := filepath.Join(config.GetPaths(ctx).RepoDir, repo.Name)
|
repoDir := filepath.Join(rs.cfg.GetPaths(ctx).RepoDir, repo.Name)
|
||||||
|
|
||||||
var repoFS billy.Filesystem
|
var repoFS billy.Filesystem
|
||||||
gitDir := filepath.Join(repoDir, ".git")
|
gitDir := filepath.Join(repoDir, ".git")
|
||||||
@ -264,7 +264,7 @@ func (rs *Repos) processRepoChangesRunner(repoDir, scriptDir string) (*interp.Ru
|
|||||||
return interp.New(
|
return interp.New(
|
||||||
interp.Env(expand.ListEnviron(env...)),
|
interp.Env(expand.ListEnviron(env...)),
|
||||||
interp.ExecHandler(handlers.NopExec),
|
interp.ExecHandler(handlers.NopExec),
|
||||||
interp.ReadDirHandler(handlers.RestrictedReadDir(repoDir)),
|
interp.ReadDirHandler2(handlers.RestrictedReadDir(repoDir)),
|
||||||
interp.StatHandler(handlers.RestrictedStat(repoDir)),
|
interp.StatHandler(handlers.RestrictedStat(repoDir)),
|
||||||
interp.OpenHandler(handlers.RestrictedOpen(repoDir)),
|
interp.OpenHandler(handlers.RestrictedOpen(repoDir)),
|
||||||
interp.StdIO(handlers.NopRWC{}, handlers.NopRWC{}, handlers.NopRWC{}),
|
interp.StdIO(handlers.NopRWC{}, handlers.NopRWC{}, handlers.NopRWC{}),
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
// ALR - Any Linux Repository
|
|
||||||
// Copyright (C) 2025 Евгений Храмов
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
package repos
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/config"
|
|
||||||
database "gitea.plemya-x.ru/Plemya-x/ALR/internal/db"
|
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Pull pulls the provided repositories. If a repo doesn't exist, it will be cloned
|
|
||||||
// and its packages will be written to the DB. If it does exist, it will be pulled.
|
|
||||||
// In this case, only changed packages will be processed if possible.
|
|
||||||
// If repos is set to nil, the repos in the ALR config will be used.
|
|
||||||
//
|
|
||||||
// Deprecated: use struct method
|
|
||||||
func Pull(ctx context.Context, repos []types.Repo) error {
|
|
||||||
return GetInstance(ctx).Pull(ctx, repos)
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================
|
|
||||||
// FOR LEGACY ONLY
|
|
||||||
// =======================
|
|
||||||
|
|
||||||
var (
|
|
||||||
reposInstance *Repos
|
|
||||||
alrConfigOnce sync.Once
|
|
||||||
)
|
|
||||||
|
|
||||||
// Deprecated: For legacy only
|
|
||||||
func GetInstance(ctx context.Context) *Repos {
|
|
||||||
alrConfigOnce.Do(func() {
|
|
||||||
cfg := config.GetInstance(ctx)
|
|
||||||
db := database.GetInstance(ctx)
|
|
||||||
|
|
||||||
reposInstance = New(
|
|
||||||
cfg,
|
|
||||||
db,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
return reposInstance
|
|
||||||
}
|
|
@ -1,186 +0,0 @@
|
|||||||
// This file was originally part of the project "LURE - Linux User REpository", created by Elara Musayelyan.
|
|
||||||
// It has been modified as part of "ALR - Any Linux Repository" by Евгений Храмов.
|
|
||||||
//
|
|
||||||
// ALR - Any Linux Repository
|
|
||||||
// Copyright (C) 2025 Евгений Храмов
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
package search
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
"io"
|
|
||||||
"io/fs"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/config"
|
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/db"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Filter represents search filters.
|
|
||||||
type Filter int
|
|
||||||
|
|
||||||
// Filters
|
|
||||||
const (
|
|
||||||
FilterNone Filter = iota
|
|
||||||
FilterInRepo
|
|
||||||
FilterSupportsArch
|
|
||||||
)
|
|
||||||
|
|
||||||
// SoryBy represents a value that packages can be sorted by.
|
|
||||||
type SortBy int
|
|
||||||
|
|
||||||
// Sort values
|
|
||||||
const (
|
|
||||||
SortByNone = iota
|
|
||||||
SortByName
|
|
||||||
SortByRepo
|
|
||||||
SortByVersion
|
|
||||||
)
|
|
||||||
|
|
||||||
// Package represents a package from ALR's database
|
|
||||||
type Package struct {
|
|
||||||
Name string
|
|
||||||
Version string
|
|
||||||
Release int
|
|
||||||
Epoch uint
|
|
||||||
Description map[string]string
|
|
||||||
Homepage map[string]string
|
|
||||||
Maintainer map[string]string
|
|
||||||
Architectures []string
|
|
||||||
Licenses []string
|
|
||||||
Provides []string
|
|
||||||
Conflicts []string
|
|
||||||
Replaces []string
|
|
||||||
Depends map[string][]string
|
|
||||||
BuildDepends map[string][]string
|
|
||||||
OptDepends map[string][]string
|
|
||||||
Repository string
|
|
||||||
}
|
|
||||||
|
|
||||||
func convertPkg(p db.Package) Package {
|
|
||||||
return Package{
|
|
||||||
Name: p.Name,
|
|
||||||
Version: p.Version,
|
|
||||||
Release: p.Release,
|
|
||||||
Epoch: p.Epoch,
|
|
||||||
Description: p.Description.Val,
|
|
||||||
Homepage: p.Homepage.Val,
|
|
||||||
Maintainer: p.Maintainer.Val,
|
|
||||||
Architectures: p.Architectures.Val,
|
|
||||||
Licenses: p.Licenses.Val,
|
|
||||||
Provides: p.Provides.Val,
|
|
||||||
Conflicts: p.Conflicts.Val,
|
|
||||||
Replaces: p.Replaces.Val,
|
|
||||||
Depends: p.Depends.Val,
|
|
||||||
BuildDepends: p.BuildDepends.Val,
|
|
||||||
OptDepends: p.OptDepends.Val,
|
|
||||||
Repository: p.Repository,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Options contains the options for a search.
|
|
||||||
type Options struct {
|
|
||||||
Filter Filter
|
|
||||||
FilterValue string
|
|
||||||
SortBy SortBy
|
|
||||||
Limit int64
|
|
||||||
Query string
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search searches for packages in the database based on the given options.
|
|
||||||
func Search(ctx context.Context, opts Options) ([]Package, error) {
|
|
||||||
query := "(name LIKE ? OR description LIKE ? OR json_array_contains(provides, ?))"
|
|
||||||
args := []any{"%" + opts.Query + "%", "%" + opts.Query + "%", opts.Query}
|
|
||||||
|
|
||||||
if opts.Filter != FilterNone {
|
|
||||||
switch opts.Filter {
|
|
||||||
case FilterInRepo:
|
|
||||||
query += " AND repository = ?"
|
|
||||||
case FilterSupportsArch:
|
|
||||||
query += " AND json_array_contains(architectures, ?)"
|
|
||||||
}
|
|
||||||
args = append(args, opts.FilterValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
if opts.SortBy != SortByNone {
|
|
||||||
switch opts.SortBy {
|
|
||||||
case SortByName:
|
|
||||||
query += " ORDER BY name"
|
|
||||||
case SortByRepo:
|
|
||||||
query += " ORDER BY repository"
|
|
||||||
case SortByVersion:
|
|
||||||
query += " ORDER BY version"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if opts.Limit != 0 {
|
|
||||||
query += " LIMIT " + strconv.FormatInt(opts.Limit, 10)
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err := db.GetPkgs(ctx, query, args...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var out []Package
|
|
||||||
for result.Next() {
|
|
||||||
pkg := db.Package{}
|
|
||||||
err = result.StructScan(&pkg)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
out = append(out, convertPkg(pkg))
|
|
||||||
}
|
|
||||||
|
|
||||||
return out, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPkg gets a single package from the database and returns it.
|
|
||||||
func GetPkg(ctx context.Context, repo, name string) (Package, error) {
|
|
||||||
pkg, err := db.GetPkg(ctx, "name = ? AND repository = ?", name, repo)
|
|
||||||
return convertPkg(*pkg), err
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
// ErrInvalidArgument is an error returned by GetScript when one of its arguments
|
|
||||||
// contain invalid characters
|
|
||||||
ErrInvalidArgument = errors.New("name and repository must not contain . or /")
|
|
||||||
|
|
||||||
// ErrScriptNotFound is returned by GetScript if it can't find the script requested
|
|
||||||
// by the user.
|
|
||||||
ErrScriptNotFound = errors.New("requested script not found")
|
|
||||||
)
|
|
||||||
|
|
||||||
// GetScript returns a reader containing the build script for a given package.
|
|
||||||
func GetScript(ctx context.Context, repo, name string) (io.ReadCloser, error) {
|
|
||||||
if strings.Contains(name, "./") || strings.ContainsAny(repo, "./") {
|
|
||||||
return nil, ErrInvalidArgument
|
|
||||||
}
|
|
||||||
|
|
||||||
scriptPath := filepath.Join(config.GetPaths(ctx).RepoDir, repo, name, "alr.sh")
|
|
||||||
fl, err := os.Open(scriptPath)
|
|
||||||
if errors.Is(err, fs.ErrNotExist) {
|
|
||||||
return nil, ErrScriptNotFound
|
|
||||||
} else if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return fl, nil
|
|
||||||
}
|
|
42
repo.go
42
repo.go
@ -30,7 +30,7 @@ import (
|
|||||||
"golang.org/x/exp/slices"
|
"golang.org/x/exp/slices"
|
||||||
|
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/config"
|
"gitea.plemya-x.ru/Plemya-x/ALR/internal/config"
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/db"
|
database "gitea.plemya-x.ru/Plemya-x/ALR/internal/db"
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/types"
|
"gitea.plemya-x.ru/Plemya-x/ALR/internal/types"
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/pkg/repos"
|
"gitea.plemya-x.ru/Plemya-x/ALR/pkg/repos"
|
||||||
)
|
)
|
||||||
@ -60,21 +60,24 @@ func AddRepoCmd() *cli.Command {
|
|||||||
name := c.String("name")
|
name := c.String("name")
|
||||||
repoURL := c.String("url")
|
repoURL := c.String("url")
|
||||||
|
|
||||||
cfg := config.Config(ctx)
|
cfg := config.New()
|
||||||
|
reposSlice := cfg.Repos(ctx)
|
||||||
|
|
||||||
for _, repo := range cfg.Repos {
|
for _, repo := range reposSlice {
|
||||||
if repo.URL == repoURL {
|
if repo.URL == repoURL {
|
||||||
slog.Error("Repo already exists", "name", repo.Name)
|
slog.Error("Repo already exists", "name", repo.Name)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.Repos = append(cfg.Repos, types.Repo{
|
reposSlice = append(reposSlice, types.Repo{
|
||||||
Name: name,
|
Name: name,
|
||||||
URL: repoURL,
|
URL: repoURL,
|
||||||
})
|
})
|
||||||
|
|
||||||
cfgFl, err := os.Create(config.GetPaths(ctx).ConfigPath)
|
cfg.SetRepos(ctx, reposSlice)
|
||||||
|
|
||||||
|
cfgFl, err := os.Create(cfg.GetPaths(ctx).ConfigPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error(gotext.Get("Error opening config file"), "err", err)
|
slog.Error(gotext.Get("Error opening config file"), "err", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
@ -86,7 +89,9 @@ func AddRepoCmd() *cli.Command {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = repos.Pull(ctx, cfg.Repos)
|
db := database.New(cfg)
|
||||||
|
rs := repos.New(cfg, db)
|
||||||
|
err = rs.Pull(ctx, cfg.Repos(ctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error(gotext.Get("Error pulling repos"), "err", err)
|
slog.Error(gotext.Get("Error pulling repos"), "err", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
@ -114,11 +119,12 @@ func RemoveRepoCmd() *cli.Command {
|
|||||||
ctx := c.Context
|
ctx := c.Context
|
||||||
|
|
||||||
name := c.String("name")
|
name := c.String("name")
|
||||||
cfg := config.Config(ctx)
|
cfg := config.New()
|
||||||
|
|
||||||
found := false
|
found := false
|
||||||
index := 0
|
index := 0
|
||||||
for i, repo := range cfg.Repos {
|
reposSlice := cfg.Repos(ctx)
|
||||||
|
for i, repo := range reposSlice {
|
||||||
if repo.Name == name {
|
if repo.Name == name {
|
||||||
index = i
|
index = i
|
||||||
found = true
|
found = true
|
||||||
@ -129,9 +135,9 @@ func RemoveRepoCmd() *cli.Command {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.Repos = slices.Delete(cfg.Repos, index, index+1)
|
cfg.SetRepos(ctx, slices.Delete(reposSlice, index, index+1))
|
||||||
|
|
||||||
cfgFl, err := os.Create(config.GetPaths(ctx).ConfigPath)
|
cfgFl, err := os.Create(cfg.GetPaths(ctx).ConfigPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error(gotext.Get("Error opening config file"), "err", err)
|
slog.Error(gotext.Get("Error opening config file"), "err", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
@ -143,12 +149,17 @@ func RemoveRepoCmd() *cli.Command {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = os.RemoveAll(filepath.Join(config.GetPaths(ctx).RepoDir, name))
|
err = os.RemoveAll(filepath.Join(cfg.GetPaths(ctx).RepoDir, name))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error(gotext.Get("Error removing repo directory"), "err", err)
|
slog.Error(gotext.Get("Error removing repo directory"), "err", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db := database.New(cfg)
|
||||||
|
err = db.Init(ctx)
|
||||||
|
if err != nil {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
err = db.DeletePkgs(ctx, "repository = ?", name)
|
err = db.DeletePkgs(ctx, "repository = ?", name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error(gotext.Get("Error removing packages from database"), "err", err)
|
slog.Error(gotext.Get("Error removing packages from database"), "err", err)
|
||||||
@ -167,7 +178,14 @@ func RefreshCmd() *cli.Command {
|
|||||||
Aliases: []string{"ref"},
|
Aliases: []string{"ref"},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
ctx := c.Context
|
ctx := c.Context
|
||||||
err := repos.Pull(ctx, config.Config(ctx).Repos)
|
cfg := config.New()
|
||||||
|
db := database.New(cfg)
|
||||||
|
err := db.Init(ctx)
|
||||||
|
if err != nil {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
rs := repos.New(cfg, db)
|
||||||
|
err = rs.Pull(ctx, cfg.Repos(ctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error(gotext.Get("Error pulling repos"), "err", err)
|
slog.Error(gotext.Get("Error pulling repos"), "err", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user